pandemonium_engine_minimal/core/crypto/SCsub

59 lines
2.0 KiB
Plaintext
Raw Normal View History

2023-12-14 21:54:22 +01:00
#!/usr/bin/env python
Import("env")
env_crypto = env.Clone()
is_builtin = env["builtin_mbedtls"]
has_module = env["module_mbedtls_enabled"]
thirdparty_obj = []
2023-12-16 15:18:10 +01:00
if is_builtin and not has_module:
# Use our headers for builtin or if the module is not going to be compiled.
# We decided not to depend on system mbedtls just for these few files that can
# be easily extracted.
env_crypto.Prepend(CPPPATH=["mbedtls/include"])
if is_builtin and has_module:
2023-12-14 21:54:22 +01:00
# Use our headers for builtin or if the module is not going to be compiled.
# We decided not to depend on system mbedtls just for these few files that can
# be easily extracted.
2023-12-16 14:49:19 +01:00
env_crypto.Prepend(CPPPATH=["#modules/mbedtls/mbedtls/include"])
2023-12-14 21:54:22 +01:00
# MbedTLS core functions (for CryptoCore).
# If the mbedtls module is compiled we don't need to add the .c files with our
# custom config since they will be built by the module itself.
# Only if the module is not enabled, we must compile here the required sources
# to make a "light" build with only the necessary mbedtls files.
if not has_module:
env_thirdparty = env_crypto.Clone()
env_thirdparty.disable_warnings()
# Custom config file
env_thirdparty.Append(
CPPDEFINES=[("MBEDTLS_CONFIG_FILE", '\\"core/crypto/mbedtls/include/pandemonium_core_mbedtls_config.h\\"')]
2023-12-14 21:54:22 +01:00
)
thirdparty_mbedtls_dir = "mbedtls/library/"
2023-12-14 21:54:22 +01:00
thirdparty_mbedtls_sources = [
"aes.c",
"base64.c",
"constant_time.c",
"md5.c",
"sha1.c",
"sha256.c",
"pandemonium_core_mbedtls_platform.c",
]
thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources]
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_mbedtls_sources)
env.core_sources += thirdparty_obj
# Godot source files
core_obj = []
env_crypto.add_source_files(core_obj, "*.cpp")
env.core_sources += core_obj
# Needed to force rebuilding the core files when the thirdparty library is updated.
env.Depends(core_obj, thirdparty_obj)