SCsub 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/usr/bin/env python
  2. Import("env")
  3. Import("env_modules")
  4. env_mbed_tls = env_modules.Clone()
  5. # Thirdparty source files
  6. thirdparty_obj = []
  7. if env["builtin_mbedtls"]:
  8. thirdparty_sources = [
  9. "aes.c",
  10. "aesce.c",
  11. "aesni.c",
  12. "aria.c",
  13. "asn1parse.c",
  14. "asn1write.c",
  15. "base64.c",
  16. "bignum.c",
  17. "bignum_core.c",
  18. "bignum_mod_raw.c",
  19. "camellia.c",
  20. "ccm.c",
  21. "chacha20.c",
  22. "chachapoly.c",
  23. "cipher.c",
  24. "cipher_wrap.c",
  25. "cmac.c",
  26. "constant_time.c",
  27. "ctr_drbg.c",
  28. "debug.c",
  29. "des.c",
  30. "dhm.c",
  31. "ecdh.c",
  32. "ecdsa.c",
  33. "ecjpake.c",
  34. "ecp.c",
  35. "ecp_curves.c",
  36. "entropy.c",
  37. "entropy_poll.c",
  38. "error.c",
  39. "gcm.c",
  40. "hkdf.c",
  41. "hmac_drbg.c",
  42. "md.c",
  43. "md5.c",
  44. "memory_buffer_alloc.c",
  45. "mps_reader.c",
  46. "mps_trace.c",
  47. "net_sockets.c",
  48. "nist_kw.c",
  49. "oid.c",
  50. "padlock.c",
  51. "pem.c",
  52. "pk.c",
  53. "pk_ecc.c",
  54. "pk_wrap.c",
  55. "pkcs12.c",
  56. "pkcs5.c",
  57. "pkcs7.c",
  58. "pkparse.c",
  59. "pkwrite.c",
  60. "platform.c",
  61. "platform_util.c",
  62. "poly1305.c",
  63. "ripemd160.c",
  64. "rsa.c",
  65. "rsa_alt_helpers.c",
  66. "sha1.c",
  67. "sha3.c",
  68. "sha256.c",
  69. "sha512.c",
  70. "ssl_cache.c",
  71. "ssl_ciphersuites.c",
  72. "ssl_client.c",
  73. "ssl_cookie.c",
  74. "ssl_debug_helpers_generated.c",
  75. "ssl_msg.c",
  76. "ssl_ticket.c",
  77. "ssl_tls.c",
  78. "ssl_tls12_client.c",
  79. "ssl_tls12_server.c",
  80. "ssl_tls13_client.c",
  81. "ssl_tls13_generic.c",
  82. "ssl_tls13_keys.c",
  83. "ssl_tls13_server.c",
  84. "threading.c",
  85. "timing.c",
  86. "version.c",
  87. "version_features.c",
  88. "x509.c",
  89. "x509_create.c",
  90. "x509_crl.c",
  91. "x509_crt.c",
  92. "x509_csr.c",
  93. "x509write.c",
  94. "x509write_crt.c",
  95. "x509write_csr.c",
  96. ]
  97. thirdparty_dir = "#thirdparty/mbedtls/library/"
  98. thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
  99. env_mbed_tls.Prepend(CPPPATH=["#thirdparty/mbedtls/include/"])
  100. config_path = "thirdparty/mbedtls/include/godot_module_mbedtls_config.h"
  101. config_path = f"<{config_path}>" if env_mbed_tls["ninja"] and env_mbed_tls.msvc else f'\\"{config_path}\\"'
  102. env_mbed_tls.Append(CPPDEFINES=[("MBEDTLS_CONFIG_FILE", config_path)])
  103. env_thirdparty = env_mbed_tls.Clone()
  104. env_thirdparty.disable_warnings()
  105. env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
  106. env_thirdparty.Depends(thirdparty_obj, "#thirdparty/mbedtls/include/godot_module_mbedtls_config.h")
  107. env.modules_sources += thirdparty_obj
  108. # Godot source files
  109. module_obj = []
  110. env_mbed_tls.add_source_files(module_obj, "*.cpp")
  111. if env["tests"]:
  112. env_mbed_tls.Append(CPPDEFINES=["TESTS_ENABLED"])
  113. env_mbed_tls.add_source_files(module_obj, "./tests/*.cpp")
  114. if env["disable_exceptions"]:
  115. env_mbed_tls.Append(CPPDEFINES=["DOCTEST_CONFIG_NO_EXCEPTIONS_BUT_WITH_ALL_ASSERTS"])
  116. env.modules_sources += module_obj
  117. # Needed to force rebuilding the module files when the thirdparty library is updated.
  118. env.Depends(module_obj, thirdparty_obj)