SCsub 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env python
  2. Import("env")
  3. env_crypto = env.Clone()
  4. is_builtin = env["builtin_mbedtls"]
  5. has_module = env["module_mbedtls_enabled"]
  6. if is_builtin or not has_module:
  7. # Use our headers for builtin or if the module is not going to be compiled.
  8. # We decided not to depend on system mbedtls just for these few files that can
  9. # be easily extracted.
  10. env_crypto.Prepend(CPPPATH=["#thirdparty/mbedtls/include"])
  11. # MbedTLS core functions (for CryptoCore).
  12. # If the mbedtls module is compiled we don't need to add the .c files with our
  13. # custom config since they will be built by the module itself.
  14. # Only if the module is not enabled, we must compile here the required sources
  15. # to make a "light" build with only the necessary mbedtls files.
  16. if not has_module:
  17. env_thirdparty = env_crypto.Clone()
  18. env_thirdparty.disable_warnings()
  19. # Custom config file
  20. env_thirdparty.Append(
  21. CPPDEFINES=[("MBEDTLS_CONFIG_FILE", '\\"thirdparty/mbedtls/include/godot_core_mbedtls_config.h\\"')]
  22. )
  23. thirdparty_mbedtls_dir = "#thirdparty/mbedtls/library/"
  24. thirdparty_mbedtls_sources = [
  25. "aes.c",
  26. "base64.c",
  27. "md5.c",
  28. "sha1.c",
  29. "sha256.c",
  30. "godot_core_mbedtls_platform.c",
  31. ]
  32. thirdparty_mbedtls_sources = [thirdparty_mbedtls_dir + file for file in thirdparty_mbedtls_sources]
  33. env_thirdparty.add_source_files(env.core_sources, thirdparty_mbedtls_sources)
  34. env_crypto.add_source_files(env.core_sources, "*.cpp")