build: featurize use_libcrypto

This commit is contained in:
Andrei Alexeyev 2022-12-14 07:35:51 +01:00
parent b393077f71
commit 79ab72292a
No known key found for this signature in database
GPG key ID: 72D26128040B9690
3 changed files with 5 additions and 14 deletions

View file

@ -175,7 +175,7 @@ dep_zlib = dependency('zlib', required : t
dep_zstd = dependency('libzstd', version : '>=1.4.0', required : true)
dep_zip = dependency('libzip', version : '>=1.5.0', required : opt_vfs_zip)
dep_cglm = dependency('cglm', version : '>=0.7.8', required : true)
dep_crypto = dependency('libcrypto', required : false)
dep_crypto = dependency('libcrypto', required : get_option('use_libcrypto'))
dep_gamemode = dependency('gamemode', required : false)
dep_m = cc.find_library('m', required : false)
@ -187,6 +187,7 @@ dep_koishi = subproject('koishi').get_variable('koishi_dep')
taisei_deps = [
dep_basisu_transcoder,
dep_cglm,
dep_crypto,
dep_freetype,
dep_gamemode,
dep_koishi,

View file

@ -192,8 +192,8 @@ option(
option(
'use_libcrypto',
type : 'combo',
choices : ['auto', 'true', 'false'],
type : 'feature',
deprecated : {'true' : 'enabled', 'false' : 'disabled'},
description : 'Use libcrypto from OpenSSL for better SHA implementations'
)

View file

@ -29,18 +29,8 @@ config.set('TAISEI_BUILDCONF_USE_DESIGNATED_INIT', cc.compiles(
args : ['-Wattributes', '-Werror']
))
use_libcrypto = get_option('use_libcrypto')
if use_libcrypto == 'auto'
use_libcrypto = dep_crypto.found()
else
use_libcrypto = (use_libcrypto == 'true')
endif
if use_libcrypto
assert(dep_crypto.found(), 'use_libcrypto forced but libcrypto not found. Install OpenSSL or disable use_libcrypto.')
if dep_crypto.found()
util_src += files('sha256_openssl.c')
util_deps += [dep_crypto]
else
util_src += files('sha256.c')
endif