Setup proper scu mbedtls build.

This commit is contained in:
Relintai 2023-12-16 15:18:10 +01:00
parent 7ee808e892
commit ee5d1c51ae
4 changed files with 37 additions and 12 deletions

View File

@ -412,7 +412,7 @@ if selected_platform in platform_list:
# Run SCU file generation script if in a SCU build. # Run SCU file generation script if in a SCU build.
if env["scu_build"]: if env["scu_build"]:
methods.set_scu_folders(scu_builders.generate_scu_files(env["verbose"], env_base["target"] != "debug"), env) methods.set_scu_folders(scu_builders.generate_scu_files(env["verbose"], env_base["target"] != "debug", env))
# Must happen after the flags' definition, as configure is when most flags # Must happen after the flags' definition, as configure is when most flags
# are actually handled to change compile options, etc. # are actually handled to change compile options, etc.

View File

@ -151,7 +151,12 @@ if env["builtin_zstd"]:
env.core_sources += thirdparty_obj env.core_sources += thirdparty_obj
env.Prepend(CPPPATH=["#thirdparty/mbedtls/include/"]) if env["scu_build"]:
if env["builtin_mbedtls"] and not env["module_mbedtls_enabled"]:
env.Prepend(CPPPATH=["crypto/mbedtls/include"])
if env["builtin_mbedtls"] and env["module_mbedtls_enabled"]:
env.Prepend(CPPPATH=["#modules/mbedtls/mbedtls/include"])
# Pandemonium source files # Pandemonium source files

View File

@ -8,7 +8,13 @@ is_builtin = env["builtin_mbedtls"]
has_module = env["module_mbedtls_enabled"] has_module = env["module_mbedtls_enabled"]
thirdparty_obj = [] thirdparty_obj = []
if is_builtin or not has_module: 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:
# Use our headers for builtin or if the module is not going to be compiled. # 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 # We decided not to depend on system mbedtls just for these few files that can
# be easily extracted. # be easily extracted.

View File

@ -163,6 +163,8 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=
if len(folders) == 0: if len(folders) == 0:
return return
extensions = extension.split(" ")
# Construct the filename prefix from the FIRST folder name # Construct the filename prefix from the FIRST folder name
# e.g. "scene_3d" # e.g. "scene_3d"
out_filename = find_section_name(folders[0]) out_filename = find_section_name(folders[0])
@ -179,16 +181,17 @@ def process_folder(folders, sought_exceptions=[], includes_per_scu=0, extension=
_scu_folders.add(main_folder) _scu_folders.add(main_folder)
# main folder (first) # main folder (first)
found_includes, found_exceptions = find_files_in_folder( for ext in extensions:
main_folder, "", found_includes, extension, sought_exceptions, found_exceptions
)
# sub folders
for d in range(1, len(folders)):
found_includes, found_exceptions = find_files_in_folder( found_includes, found_exceptions = find_files_in_folder(
main_folder, folders[d], found_includes, extension, sought_exceptions, found_exceptions main_folder, "", found_includes, ext, sought_exceptions, found_exceptions
) )
# sub folders
for d in range(1, len(folders)):
found_includes, found_exceptions = find_files_in_folder(
main_folder, folders[d], found_includes, ext, sought_exceptions, found_exceptions
)
found_includes = sorted(found_includes) found_includes = sorted(found_includes)
# calculate how many lines to write in each file # calculate how many lines to write in each file
@ -277,8 +280,19 @@ def generate_scu_files(verbose, is_release_build, env):
#process_folder(["core/io"]) #process_folder(["core/io"])
#process_folder(["core/crypto"]) #process_folder(["core/crypto"])
process_folder(["core", "bind", "config", "containers", "error", "input", "log", "math", "object", has_mbedtyls_module = False
"os", "string", "variant", "io", "crypto"])
try:
has_mbedtyls_module = env["module_mbedtls_enabled"]
except:
pass
if has_mbedtyls_module:
process_folder(["core", "bind", "config", "containers", "error", "input", "log", "math", "object",
"os", "string", "variant", "io", "crypto"])
else:
process_folder(["core", "bind", "config", "containers", "error", "input", "log", "math", "object",
"os", "string", "variant", "io", "crypto", "crypto/mbedtls/library"], [], 0, "cpp c")
process_folder(["drivers/gles2"]) process_folder(["drivers/gles2"])
process_folder(["drivers/unix"]) process_folder(["drivers/unix"])