| 1 |
|
| 2 |
from misc.utility.scons_hints import * |
| 3 |
|
| 4 |
Import("env") |
| 5 |
|
| 6 |
env_crypto = env.Clone() |
| 7 |
|
| 8 |
is_builtin = env["builtin_mbedtls"] |
| 9 |
has_module = env["module_mbedtls_enabled"] |
| 10 |
thirdparty_obj = [] |
| 11 |
|
| 12 |
if is_builtin or not has_module: |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
env_crypto.Prepend(CPPPATH=["#thirdparty/mbedtls/include"]) |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
if not has_module: |
| 24 |
|
| 25 |
config_path = "thirdparty/mbedtls/include/godot_core_mbedtls_config.h" |
| 26 |
config_path = f"<{config_path}>" if env_crypto["ninja"] and env_crypto.msvc else f'\\"{config_path}\\"' |
| 27 |
env_crypto.Append(CPPDEFINES=[("MBEDTLS_CONFIG_FILE", config_path)]) |
| 28 |
|
| 29 |
env_thirdparty = env_crypto.Clone() |
| 30 |
env_thirdparty.disable_warnings() |
| 31 |
thirdparty_mbedtls_dir = "#thirdparty/mbedtls/library/" |
| 32 |
thirdparty_mbedtls_sources = [ |
| 33 |
"aes.c", |
| 34 |
"base64.c", |
| 35 |
"constant_time.c", |
| 36 |
"ctr_drbg.c", |
| 37 |
"entropy.c", |
| 38 |
"md.c", |
| 39 |
"md5.c", |
| 40 |
"sha1.c", |
| 41 |
"sha256.c", |
| 42 |
"godot_core_mbedtls_platform.c", |
| 43 |
] |
| 44 |
thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources] |
| 45 |
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_mbedtls_sources) |
| 46 |
|
| 47 |
env_thirdparty.Depends(thirdparty_obj, "#thirdparty/mbedtls/include/godot_core_mbedtls_config.h") |
| 48 |
env.core_sources += thirdparty_obj |
| 49 |
elif is_builtin: |
| 50 |
|
| 51 |
config_path = "thirdparty/mbedtls/include/godot_module_mbedtls_config.h" |
| 52 |
config_path = f"<{config_path}>" if env_crypto["ninja"] and env_crypto.msvc else f'\\"{config_path}\\"' |
| 53 |
env_crypto.Append(CPPDEFINES=[("MBEDTLS_CONFIG_FILE", config_path)]) |
| 54 |
|
| 55 |
thirdparty_obj = ["#thirdparty/mbedtls/include/godot_module_mbedtls_config.h"] |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
core_obj = [] |
| 60 |
|
| 61 |
env_crypto.add_source_files(core_obj, "*.cpp") |
| 62 |
env.core_sources += core_obj |
| 63 |
|
| 64 |
|
| 65 |
env.Depends(core_obj, thirdparty_obj) |