SCsub 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env python
  2. import build_scripts.tls_configure as tls_configure
  3. import build_scripts.mono_configure as mono_configure
  4. Import("env")
  5. Import("env_modules")
  6. env_mono = env_modules.Clone()
  7. if env_mono["tools"]:
  8. # NOTE: It is safe to generate this file here, since this is still executed serially
  9. import build_scripts.gen_cs_glue_version as gen_cs_glue_version
  10. gen_cs_glue_version.generate_header("glue/GodotSharp", "glue/cs_glue_version.gen.h")
  11. # Glue sources
  12. if env_mono["mono_glue"]:
  13. env_mono.Append(CPPDEFINES=["MONO_GLUE_ENABLED"])
  14. import os.path
  15. if not os.path.isfile("glue/mono_glue.gen.cpp"):
  16. raise RuntimeError("Mono glue sources not found. Did you forget to run '--generate-mono-glue'?")
  17. # Configure Thread Local Storage
  18. conf = Configure(env_mono)
  19. tls_configure.configure(conf)
  20. env_mono = conf.Finish()
  21. # Configure Mono
  22. mono_configure.configure(env, env_mono)
  23. if env_mono["tools"] and env_mono["mono_glue"] and env_mono["build_cil"]:
  24. # Build Godot API solution
  25. import build_scripts.api_solution_build as api_solution_build
  26. api_sln_cmd = api_solution_build.build(env_mono)
  27. # Build GodotTools
  28. import build_scripts.godot_tools_build as godot_tools_build
  29. godot_tools_build.build(env_mono, api_sln_cmd)
  30. # Add sources
  31. env_mono.add_source_files(env.modules_sources, "*.cpp")
  32. env_mono.add_source_files(env.modules_sources, "glue/*.cpp")
  33. env_mono.add_source_files(env.modules_sources, "glue/mono_glue.gen.cpp")
  34. env_mono.add_source_files(env.modules_sources, "mono_gd/*.cpp")
  35. env_mono.add_source_files(env.modules_sources, "utils/*.cpp")
  36. env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.cpp")
  37. if env["platform"] in ["osx", "iphone"]:
  38. env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.mm")
  39. env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.m")
  40. elif env["platform"] == "android":
  41. env_mono.add_source_files(env.modules_sources, "mono_gd/android_mono_config.gen.cpp")
  42. if env["tools"]:
  43. env_mono.add_source_files(env.modules_sources, "editor/*.cpp")