SCsub 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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.Append(CPPPATH=['#modules/gdnative/include/'])
  13. Export('env_gdnative')
  14. SConscript("net/SCsub")
  15. SConscript("arvr/SCsub")
  16. SConscript("pluginscript/SCsub")
  17. from platform_methods import run_in_subprocess
  18. import gdnative_builders
  19. _, gensource = env_gdnative.CommandNoCache(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'],
  20. 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_api_struct))
  21. env_gdnative.add_source_files(env.modules_sources, [gensource])
  22. env.use_ptrcall = True
  23. if ARGUMENTS.get('gdnative_wrapper', False):
  24. gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code))
  25. gd_wrapper_env = env.Clone()
  26. gd_wrapper_env.Append(CPPPATH=['#modules/gdnative/include/'])
  27. if gd_wrapper_env['use_lto']:
  28. if not env.msvc:
  29. gd_wrapper_env.Append(CCFLAGS=['-fno-lto'])
  30. gd_wrapper_env.Append(LINKFLAGS=['-fno-lto'])
  31. else:
  32. gd_wrapper_env.Append(CCFLAGS=['/GL-'])
  33. gd_wrapper_env.Append(LINKFLAGS=['/LTCG:OFF'])
  34. if not env.msvc:
  35. gd_wrapper_env.Append(CCFLAGS=['-fPIC'])
  36. lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource])