| 1 |
|
| 2 |
from misc.utility.scons_hints import * |
| 3 |
|
| 4 |
Import("env") |
| 5 |
Import("env_modules") |
| 6 |
|
| 7 |
env_mbed_tls = env_modules.Clone() |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
thirdparty_obj = [] |
| 12 |
|
| 13 |
if env["builtin_mbedtls"]: |
| 14 |
thirdparty_sources = [ |
| 15 |
"aes.c", |
| 16 |
"aesce.c", |
| 17 |
"aesni.c", |
| 18 |
"aria.c", |
| 19 |
"asn1parse.c", |
| 20 |
"asn1write.c", |
| 21 |
"base64.c", |
| 22 |
"bignum.c", |
| 23 |
"bignum_core.c", |
| 24 |
"bignum_mod_raw.c", |
| 25 |
"camellia.c", |
| 26 |
"ccm.c", |
| 27 |
"chacha20.c", |
| 28 |
"chachapoly.c", |
| 29 |
"cipher.c", |
| 30 |
"cipher_wrap.c", |
| 31 |
"cmac.c", |
| 32 |
"constant_time.c", |
| 33 |
"ctr_drbg.c", |
| 34 |
"debug.c", |
| 35 |
"des.c", |
| 36 |
"dhm.c", |
| 37 |
"ecdh.c", |
| 38 |
"ecdsa.c", |
| 39 |
"ecjpake.c", |
| 40 |
"ecp.c", |
| 41 |
"ecp_curves.c", |
| 42 |
"entropy.c", |
| 43 |
"entropy_poll.c", |
| 44 |
"error.c", |
| 45 |
"gcm.c", |
| 46 |
"hkdf.c", |
| 47 |
"hmac_drbg.c", |
| 48 |
"md.c", |
| 49 |
"md5.c", |
| 50 |
"memory_buffer_alloc.c", |
| 51 |
"mps_reader.c", |
| 52 |
"mps_trace.c", |
| 53 |
"net_sockets.c", |
| 54 |
"nist_kw.c", |
| 55 |
"oid.c", |
| 56 |
"padlock.c", |
| 57 |
"pem.c", |
| 58 |
"pk.c", |
| 59 |
"pk_ecc.c", |
| 60 |
"pk_wrap.c", |
| 61 |
"pkcs12.c", |
| 62 |
"pkcs5.c", |
| 63 |
"pkcs7.c", |
| 64 |
"pkparse.c", |
| 65 |
"pkwrite.c", |
| 66 |
"platform.c", |
| 67 |
"platform_util.c", |
| 68 |
"poly1305.c", |
| 69 |
"psa_crypto.c", |
| 70 |
"psa_crypto_aead.c", |
| 71 |
"psa_crypto_cipher.c", |
| 72 |
"psa_crypto_client.c", |
| 73 |
"psa_crypto_driver_wrappers_no_static.c", |
| 74 |
"psa_crypto_ecp.c", |
| 75 |
"psa_crypto_ffdh.c", |
| 76 |
"psa_crypto_hash.c", |
| 77 |
"psa_crypto_mac.c", |
| 78 |
"psa_crypto_pake.c", |
| 79 |
"psa_crypto_rsa.c", |
| 80 |
"psa_crypto_se.c", |
| 81 |
"psa_crypto_slot_management.c", |
| 82 |
"psa_crypto_storage.c", |
| 83 |
"psa_its_file.c", |
| 84 |
"psa_util.c", |
| 85 |
"ripemd160.c", |
| 86 |
"rsa.c", |
| 87 |
"rsa_alt_helpers.c", |
| 88 |
"sha1.c", |
| 89 |
"sha3.c", |
| 90 |
"sha256.c", |
| 91 |
"sha512.c", |
| 92 |
"ssl_cache.c", |
| 93 |
"ssl_ciphersuites.c", |
| 94 |
"ssl_client.c", |
| 95 |
"ssl_cookie.c", |
| 96 |
"ssl_debug_helpers_generated.c", |
| 97 |
"ssl_msg.c", |
| 98 |
"ssl_ticket.c", |
| 99 |
"ssl_tls.c", |
| 100 |
"ssl_tls12_client.c", |
| 101 |
"ssl_tls12_server.c", |
| 102 |
"ssl_tls13_client.c", |
| 103 |
"ssl_tls13_generic.c", |
| 104 |
"ssl_tls13_keys.c", |
| 105 |
"ssl_tls13_server.c", |
| 106 |
"threading.c", |
| 107 |
"timing.c", |
| 108 |
"version.c", |
| 109 |
"version_features.c", |
| 110 |
"x509.c", |
| 111 |
"x509_create.c", |
| 112 |
"x509_crl.c", |
| 113 |
"x509_crt.c", |
| 114 |
"x509_csr.c", |
| 115 |
"x509write.c", |
| 116 |
"x509write_crt.c", |
| 117 |
"x509write_csr.c", |
| 118 |
] |
| 119 |
|
| 120 |
thirdparty_dir = "#thirdparty/mbedtls/library/" |
| 121 |
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] |
| 122 |
|
| 123 |
env_mbed_tls.Prepend(CPPPATH=["#thirdparty/mbedtls/include/"]) |
| 124 |
config_path = "thirdparty/mbedtls/include/godot_module_mbedtls_config.h" |
| 125 |
config_path = f"<{config_path}>" if env_mbed_tls["ninja"] and env_mbed_tls.msvc else f'\\"{config_path}\\"' |
| 126 |
env_mbed_tls.Append(CPPDEFINES=[("MBEDTLS_CONFIG_FILE", config_path)]) |
| 127 |
|
| 128 |
env_thirdparty = env_mbed_tls.Clone() |
| 129 |
env_thirdparty.disable_warnings() |
| 130 |
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources) |
| 131 |
env_thirdparty.Depends(thirdparty_obj, "#thirdparty/mbedtls/include/godot_module_mbedtls_config.h") |
| 132 |
env.modules_sources += thirdparty_obj |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
module_obj = [] |
| 138 |
|
| 139 |
env_mbed_tls.add_source_files(module_obj, "*.cpp") |
| 140 |
|
| 141 |
if env["tests"]: |
| 142 |
env_mbed_tls.Append(CPPDEFINES=["TESTS_ENABLED"]) |
| 143 |
env_mbed_tls.add_source_files(module_obj, "./tests/*.cpp") |
| 144 |
|
| 145 |
if env["disable_exceptions"]: |
| 146 |
env_mbed_tls.Append(CPPDEFINES=["DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS"]) |
| 147 |
|
| 148 |
env.modules_sources += module_obj |
| 149 |
|
| 150 |
|
| 151 |
env.Depends(module_obj, thirdparty_obj) |