SCsub 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/usr/bin/env python
  2. Import("env")
  3. Import("env_modules")
  4. env_gdnative = env_modules.Clone()
  5. env_gdnative.add_source_files(env.modules_sources, "gdnative.cpp")
  6. env_gdnative.add_source_files(env.modules_sources, "register_types.cpp")
  7. env_gdnative.add_source_files(env.modules_sources, "android/*.cpp")
  8. env_gdnative.add_source_files(env.modules_sources, "gdnative/*.cpp")
  9. env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp")
  10. env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
  11. env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
  12. env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"])
  13. Export("env_gdnative")
  14. SConscript("net/SCsub")
  15. SConscript("arvr/SCsub")
  16. SConscript("pluginscript/SCsub")
  17. SConscript("videodecoder/SCsub")
  18. from methods import get_cmdline_bool
  19. from platform_methods import run_in_subprocess
  20. import gdnative_builders
  21. _, gensource = env_gdnative.CommandNoCache(
  22. ["include/gdnative_api_struct.gen.h", "gdnative_api_struct.gen.cpp"],
  23. "gdnative_api.json",
  24. run_in_subprocess(gdnative_builders.build_gdnative_api_struct),
  25. )
  26. env_gdnative.add_source_files(env.modules_sources, [gensource])
  27. env.use_ptrcall = True
  28. if get_cmdline_bool("gdnative_wrapper", False):
  29. (gensource,) = env_gdnative.CommandNoCache(
  30. "gdnative_wrapper_code.gen.cpp",
  31. "gdnative_api.json",
  32. run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code),
  33. )
  34. gd_wrapper_env = env.Clone()
  35. gd_wrapper_env.Prepend(CPPPATH=["#modules/gdnative/include/"])
  36. if gd_wrapper_env["use_lto"]:
  37. if not env.msvc:
  38. gd_wrapper_env.Append(CCFLAGS=["-fno-lto"])
  39. gd_wrapper_env.Append(LINKFLAGS=["-fno-lto"])
  40. else:
  41. gd_wrapper_env.Append(CCFLAGS=["/GL-"])
  42. gd_wrapper_env.Append(LINKFLAGS=["/LTCG:OFF"])
  43. if not env.msvc:
  44. gd_wrapper_env.Append(CCFLAGS=["-fPIC"])
  45. lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource])