summaryrefslogtreecommitdiffstats
path: root/SConstruct
diff options
context:
space:
mode:
authorMarc <marc.gilleron@gmail.com>2021-01-31 19:32:56 +0000
committerGitHub <noreply@github.com>2021-01-31 19:32:56 +0000
commit1aab5e3962e311caebae04f44fff9c4e1cd7d9c0 (patch)
treec55e3435691883c62bed6375c6b236a9715c85c7 /SConstruct
parent2559c70e274f9239cd29c434ab262c46f6dc8552 (diff)
parent35f78dea5196d4d676946a84c10206a5cb1a1fa0 (diff)
downloadredot-cpp-1aab5e3962e311caebae04f44fff9c4e1cd7d9c0.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct53
1 files changed, 29 insertions, 24 deletions
diff --git a/SConstruct b/SConstruct
index 881b44d..d22c9a3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -68,6 +68,17 @@ else:
'platform=<platform>'
)
+env = Environment(ENV = os.environ)
+
+is64 = sys.maxsize > 2**32
+if (
+ env['TARGET_ARCH'] == 'amd64' or
+ env['TARGET_ARCH'] == 'emt64' or
+ env['TARGET_ARCH'] == 'x86_64' or
+ env['TARGET_ARCH'] == 'arm64-v8a'
+):
+ is64 = True
+
opts = Variables([], ARGUMENTS)
opts.Add(EnumVariable(
'platform',
@@ -79,8 +90,8 @@ opts.Add(EnumVariable(
opts.Add(EnumVariable(
'bits',
'Target platform bits',
- 'default',
- ('default', '32', '64')
+ '64' if is64 else '32',
+ ('32', '64')
))
opts.Add(BoolVariable(
'use_llvm',
@@ -144,23 +155,15 @@ opts.Add(
'Path to your Android NDK installation. By default, uses ANDROID_NDK_ROOT from your defined environment variables.',
os.environ.get("ANDROID_NDK_ROOT", None)
)
+opts.Add(BoolVariable(
+ 'generate_template_get_node',
+ "Generate a template version of the Node class's get_node.",
+ True
+))
-env = Environment(ENV = os.environ)
opts.Update(env)
Help(opts.GenerateHelpText(env))
-is64 = sys.maxsize > 2**32
-if (
- env['TARGET_ARCH'] == 'amd64' or
- env['TARGET_ARCH'] == 'emt64' or
- env['TARGET_ARCH'] == 'x86_64' or
- env['TARGET_ARCH'] == 'arm64-v8a'
-):
- is64 = True
-
-if env['bits'] == 'default':
- env['bits'] = '64' if is64 else '32'
-
# This makes sure to keep the session environment variables on Windows.
# This way, you can run SCons in a Visual Studio 2017 prompt and it will find
# all the required tools
@@ -176,11 +179,11 @@ if env['platform'] == 'linux':
if env['use_llvm']:
env['CXX'] = 'clang++'
- env.Append(CCFLAGS=['-fPIC', '-g', '-std=c++14', '-Wwrite-strings'])
+ env.Append(CCFLAGS=['-fPIC', '-std=c++14', '-Wwrite-strings'])
env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
if env['target'] == 'debug':
- env.Append(CCFLAGS=['-Og'])
+ env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
@@ -200,7 +203,7 @@ elif env['platform'] == 'osx':
'Only 64-bit builds are supported for the macOS target.'
)
- env.Append(CCFLAGS=['-g', '-std=c++14', '-arch', 'x86_64'])
+ env.Append(CCFLAGS=['-std=c++14', '-arch', 'x86_64'])
env.Append(LINKFLAGS=[
'-arch',
'x86_64',
@@ -210,7 +213,7 @@ elif env['platform'] == 'osx':
])
if env['target'] == 'debug':
- env.Append(CCFLAGS=['-Og'])
+ env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
@@ -235,7 +238,7 @@ elif env['platform'] == 'ios':
env['AR'] = compiler_path + 'ar'
env['RANLIB'] = compiler_path + 'ranlib'
- env.Append(CCFLAGS=['-g', '-std=c++14', '-arch', env['ios_arch'], '-isysroot', sdk_path])
+ env.Append(CCFLAGS=['-std=c++14', '-arch', env['ios_arch'], '-isysroot', sdk_path])
env.Append(LINKFLAGS=[
'-arch',
env['ios_arch'],
@@ -247,7 +250,7 @@ elif env['platform'] == 'ios':
])
if env['target'] == 'debug':
- env.Append(CCFLAGS=['-Og'])
+ env.Append(CCFLAGS=['-Og', '-g'])
elif env['target'] == 'release':
env.Append(CCFLAGS=['-O3'])
@@ -278,13 +281,15 @@ elif env['platform'] == 'windows':
# Native or cross-compilation using MinGW
if host_platform == 'linux' or host_platform == 'osx' or env['use_mingw']:
- env.Append(CCFLAGS=['-g', '-O3', '-std=c++14', '-Wwrite-strings'])
+ # These options are for a release build even using target=debug
+ env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings'])
env.Append(LINKFLAGS=[
'--static',
'-Wl,--no-undefined',
'-static-libgcc',
'-static-libstdc++',
])
+
elif env['platform'] == 'android':
if host_platform == 'windows':
env = env.Clone(tools=['mingw'])
@@ -356,13 +361,13 @@ json_api_file = ''
if 'custom_api_file' in env:
json_api_file = env['custom_api_file']
else:
- json_api_file = os.path.join(os.getcwd(), 'godot_headers', 'api.json')
+ json_api_file = os.path.join(os.getcwd(), env['headers_dir'], 'api.json')
if env['generate_bindings']:
# Actually create the bindings here
import binding_generator
- binding_generator.generate_bindings(json_api_file)
+ binding_generator.generate_bindings(json_api_file, env['generate_template_get_node'])
# Sources to compile
sources = []