2017-04-03 22:11:38 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
Import('env')
|
2018-09-28 19:29:52 +08:00
|
|
|
Import('env_modules')
|
2017-04-03 22:11:38 +08:00
|
|
|
|
2018-09-28 19:29:52 +08:00
|
|
|
env_gdnative = env_modules.Clone()
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "gdnative.cpp")
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "register_types.cpp")
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "android/*.cpp")
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "gdnative/*.cpp")
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp")
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp")
|
|
|
|
env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp")
|
2017-09-03 18:40:41 +08:00
|
|
|
|
2019-04-30 19:12:02 +08:00
|
|
|
env_gdnative.Prepend(CPPPATH=['#modules/gdnative/include/'])
|
2018-09-28 19:29:52 +08:00
|
|
|
|
|
|
|
Export('env_gdnative')
|
2017-04-03 22:11:38 +08:00
|
|
|
|
2018-06-27 02:26:51 +08:00
|
|
|
SConscript("net/SCsub")
|
2017-11-10 19:36:50 +08:00
|
|
|
SConscript("arvr/SCsub")
|
2017-10-09 05:47:38 +08:00
|
|
|
SConscript("pluginscript/SCsub")
|
2018-07-29 04:01:30 +08:00
|
|
|
SConscript("videodecoder/SCsub")
|
2017-10-07 21:51:17 +08:00
|
|
|
|
2018-09-28 19:29:52 +08:00
|
|
|
|
2018-03-18 06:23:55 +08:00
|
|
|
from platform_methods import run_in_subprocess
|
|
|
|
import gdnative_builders
|
2017-10-03 11:23:05 +08:00
|
|
|
|
2018-09-28 19:29:52 +08:00
|
|
|
_, gensource = env_gdnative.CommandNoCache(['include/gdnative_api_struct.gen.h', 'gdnative_api_struct.gen.cpp'],
|
2018-03-18 06:23:55 +08:00
|
|
|
'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_api_struct))
|
2018-09-28 19:29:52 +08:00
|
|
|
env_gdnative.add_source_files(env.modules_sources, [gensource])
|
2017-10-03 11:23:05 +08:00
|
|
|
|
2017-08-02 20:21:12 +08:00
|
|
|
env.use_ptrcall = True
|
2017-10-04 05:07:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
if ARGUMENTS.get('gdnative_wrapper', False):
|
2018-09-28 19:29:52 +08:00
|
|
|
gensource, = env_gdnative.CommandNoCache('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', run_in_subprocess(gdnative_builders.build_gdnative_wrapper_code))
|
2017-10-04 05:07:29 +08:00
|
|
|
|
|
|
|
gd_wrapper_env = env.Clone()
|
2019-04-30 19:12:02 +08:00
|
|
|
gd_wrapper_env.Prepend(CPPPATH=['#modules/gdnative/include/'])
|
2017-10-04 05:07:29 +08:00
|
|
|
|
2018-01-05 02:42:02 +08:00
|
|
|
if gd_wrapper_env['use_lto']:
|
|
|
|
if not env.msvc:
|
2018-04-30 18:59:08 +08:00
|
|
|
gd_wrapper_env.Append(CCFLAGS=['-fno-lto'])
|
|
|
|
gd_wrapper_env.Append(LINKFLAGS=['-fno-lto'])
|
2018-01-05 02:42:02 +08:00
|
|
|
else:
|
|
|
|
gd_wrapper_env.Append(CCFLAGS=['/GL-'])
|
|
|
|
gd_wrapper_env.Append(LINKFLAGS=['/LTCG:OFF'])
|
|
|
|
|
2017-11-26 03:26:42 +08:00
|
|
|
if not env.msvc:
|
|
|
|
gd_wrapper_env.Append(CCFLAGS=['-fPIC'])
|
2017-10-04 05:07:29 +08:00
|
|
|
|
2017-11-29 04:27:57 +08:00
|
|
|
lib = gd_wrapper_env.add_library("#bin/gdnative_wrapper_code", [gensource])
|