Use BoolVariable in platform-specific options.

This commit is contained in:
Elliott Sales de Andrade 2017-09-25 00:37:17 -04:00
parent 5be675eb03
commit 3e69d19116
8 changed files with 47 additions and 47 deletions

View File

@ -265,7 +265,7 @@ if env["platform"] == 'uwp':
else:
import platform
is_x11_or_server_arm = ((env["platform"] == 'x11' or env["platform"] == 'server') and platform.machine().startswith('arm'))
is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"] == "yes")
is_ios_x86 = (env["platform"] == 'iphone' and env["ios_sim"])
is_android_x86 = (env["platform"] == 'android' and env["android_arch"] == 'x86')
if is_android_x86:
cpu_bits = '32'

View File

@ -18,14 +18,14 @@ def can_build():
def get_opts():
from SCons.Variables import EnumVariable
from SCons.Variables import BoolVariable, EnumVariable
return [
('ANDROID_NDK_ROOT', 'Path to the Android NDK', os.environ.get("ANDROID_NDK_ROOT", 0)),
('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'armv6', 'arm64v8', 'x86')),
('android_neon', 'Enable NEON support (armv7 only)', "yes"),
('android_stl', 'Enable Android STL support (for modules)', "no")
BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True),
BoolVariable('android_stl', 'Enable Android STL support (for modules)', False),
]
@ -94,7 +94,7 @@ def configure(env):
env['android_arch'] = 'armv7'
neon_text = ""
if env["android_arch"] == "armv7" and env['android_neon'] == 'yes':
if env["android_arch"] == "armv7" and env['android_neon']:
neon_text = " (with NEON)"
print("Building for Android (" + env['android_arch'] + ")" + neon_text)
@ -118,7 +118,7 @@ def configure(env):
target_subpath = "arm-linux-androideabi-4.9"
abi_subpath = "arm-linux-androideabi"
arch_subpath = "armeabi-v7a"
if env['android_neon'] == 'yes':
if env['android_neon']:
env.extra_suffix = ".armv7.neon" + env.extra_suffix
else:
env.extra_suffix = ".armv7" + env.extra_suffix
@ -200,7 +200,7 @@ def configure(env):
elif env["android_arch"] == "armv7":
target_opts = ['-target', 'armv7-none-linux-androideabi']
env.Append(CPPFLAGS='-D__ARM_ARCH_7__ -D__ARM_ARCH_7A__ -march=armv7-a -mfloat-abi=softfp'.split())
if env['android_neon'] == 'yes':
if env['android_neon']:
env['neon_enabled'] = True
env.Append(CPPFLAGS=['-mfpu=neon', '-D__ARM_NEON__'])
else:
@ -214,7 +214,7 @@ def configure(env):
env.Append(CPPFLAGS=target_opts)
env.Append(CPPFLAGS=common_opts)
if (env['android_stl'] == 'yes'):
if env['android_stl']:
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/include"])
env.Append(CPPPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath + "/include"])
env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/gnu-libstdc++/4.9/libs/" + arch_subpath])

View File

@ -20,17 +20,17 @@ def can_build():
def get_opts():
from SCons.Variables import BoolVariable
return [
('IPHONEPLATFORM', 'Name of the iPhone platform', 'iPhoneOS'),
('IPHONEPATH', 'Path to iPhone toolchain', '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain'),
('IPHONESDK', 'Path to the iPhone SDK', '/Applications/Xcode.app/Contents/Developer/Platforms/${IPHONEPLATFORM}.platform/Developer/SDKs/${IPHONEPLATFORM}.sdk/'),
('game_center', 'Support for game center', 'yes'),
('store_kit', 'Support for in-app store', 'yes'),
('icloud', 'Support for iCloud', 'yes'),
('ios_exceptions', 'Enable exceptions', 'no'),
BoolVariable('game_center', 'Support for game center', True),
BoolVariable('store_kit', 'Support for in-app store', True),
BoolVariable('icloud', 'Support for iCloud', True),
BoolVariable('ios_exceptions', 'Enable exceptions', False),
('ios_triple', 'Triple for ios toolchain', ''),
('ios_sim', 'Build simulator binary', 'no'),
BoolVariable('ios_sim', 'Build simulator binary', False),
]
@ -58,7 +58,7 @@ def configure(env):
## Architecture
if (env["ios_sim"] == "yes" or env["arch"] == "x86"): # i386, simulator
if env["ios_sim"] or env["arch"] == "x86": # i386, simulator
env["arch"] = "x86"
env["bits"] = "32"
elif (env["arch"] == "arm" or env["arch"] == "arm32" or env["arch"] == "armv7" or env["bits"] == "32"): # arm
@ -91,7 +91,7 @@ def configure(env):
env.Append(CPPFLAGS=['-DNEED_LONG_INT'])
env.Append(CPPFLAGS=['-DLIBYUV_DISABLE_NEON'])
if env['ios_exceptions'] == 'yes':
if env['ios_exceptions']:
env.Append(CPPFLAGS=['-fexceptions'])
else:
env.Append(CPPFLAGS=['-fno-exceptions'])
@ -129,15 +129,15 @@ def configure(env):
])
# Feature options
if env['game_center'] == 'yes':
if env['game_center']:
env.Append(CPPFLAGS=['-DGAME_CENTER_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'GameKit'])
if env['store_kit'] == 'yes':
if env['store_kit']:
env.Append(CPPFLAGS=['-DSTOREKIT_ENABLED'])
env.Append(LINKFLAGS=['-framework', 'StoreKit'])
if env['icloud'] == 'yes':
if env['icloud']:
env.Append(CPPFLAGS=['-DICLOUD_ENABLED'])
env.Append(CPPPATH=['$IPHONESDK/usr/include',

View File

@ -29,7 +29,7 @@ zip_dir = target_dir.Dir('.javascript_zip')
zip_files = env.InstallAs(zip_dir.File('godot.html'), '#misc/dist/html/default.html')
implicit_targets = []
if env['wasm'] == 'yes':
if env['wasm']:
wasm = target_dir.File(basename + '.wasm')
implicit_targets.append(wasm)
zip_files.append(InstallAs(zip_dir.File('godot.wasm'), wasm))

View File

@ -17,10 +17,10 @@ def can_build():
def get_opts():
from SCons.Variables import BoolVariable
return [
['wasm', 'Compile to WebAssembly', 'no'],
['javascript_eval', 'Enable JavaScript eval interface', 'yes'],
BoolVariable('wasm', 'Compile to WebAssembly', False),
BoolVariable('javascript_eval', 'Enable JavaScript eval interface', True),
]
@ -95,7 +95,7 @@ def configure(env):
# These flags help keep the file size down
env.Append(CPPFLAGS=["-fno-exceptions", '-DNO_SAFE_CAST', '-fno-rtti'])
if env['javascript_eval'] == 'yes':
if env['javascript_eval']:
env.Append(CPPFLAGS=['-DJAVASCRIPT_EVAL_ENABLED'])
## Link flags
@ -103,7 +103,7 @@ def configure(env):
env.Append(LINKFLAGS=['-s', 'EXTRA_EXPORTED_RUNTIME_METHODS="[\'FS\']"'])
env.Append(LINKFLAGS=['-s', 'USE_WEBGL2=1'])
if (env['wasm'] == 'yes'):
if env['wasm']:
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
# In contrast to asm.js, enabling memory growth on WebAssembly has no
# major performance impact, and causes only a negligible increase in

View File

@ -19,9 +19,9 @@ def can_build():
def get_opts():
from SCons.Variables import BoolVariable
return [
('use_llvm', 'Use the LLVM compiler', 'no'),
BoolVariable('use_llvm', 'Use the LLVM compiler', False),
]
@ -52,7 +52,7 @@ def configure(env):
## Compiler configuration
if (env["use_llvm"] == "yes"):
if env['use_llvm']:
if ('clang++' not in env['CXX']):
env["CC"] = "clang"
env["CXX"] = "clang++"

View File

@ -49,7 +49,7 @@ def can_build():
def get_opts():
from SCons.Variables import EnumVariable
from SCons.Variables import BoolVariable, EnumVariable
mingw32 = ""
mingw64 = ""
@ -65,7 +65,7 @@ def get_opts():
return [
('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
('use_lto', 'Use link time optimization (when using MingW)', 'no'),
BoolVariable('use_lto', 'Use link time optimization (when using MingW)', False),
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@ -263,7 +263,7 @@ def configure(env):
env['LD'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True
if (env["use_lto"] == "yes"):
if env['use_lto']:
env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])

View File

@ -45,16 +45,16 @@ def can_build():
return True
def get_opts():
from SCons.Variables import EnumVariable
from SCons.Variables import BoolVariable, EnumVariable
return [
('use_llvm', 'Use the LLVM compiler', 'no'),
('use_static_cpp', 'Link stdc++ statically', 'no'),
('use_sanitizer', 'Use LLVM compiler address sanitizer', 'no'),
('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', 'no'),
('use_lto', 'Use link time optimization', 'no'),
('pulseaudio', 'Detect & use pulseaudio', 'yes'),
('udev', 'Use udev for gamepad connection callbacks', 'no'),
BoolVariable('use_llvm', 'Use the LLVM compiler', False),
BoolVariable('use_static_cpp', 'Link stdc++ statically', False),
BoolVariable('use_sanitizer', 'Use LLVM compiler address sanitizer', False),
BoolVariable('use_leak_sanitizer', 'Use LLVM compiler memory leaks sanitizer (implies use_sanitizer)', False),
BoolVariable('use_lto', 'Use link time optimization', False),
BoolVariable('pulseaudio', 'Detect & use pulseaudio', True),
BoolVariable('udev', 'Use udev for gamepad connection callbacks', False),
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@ -101,7 +101,7 @@ def configure(env):
## Compiler configuration
if (env["use_llvm"] == "yes"):
if env['use_llvm']:
if ('clang++' not in env['CXX']):
env["CC"] = "clang"
env["CXX"] = "clang++"
@ -110,18 +110,18 @@ def configure(env):
env.extra_suffix = ".llvm" + env.extra_suffix
# leak sanitizer requires (address) sanitizer
if (env["use_sanitizer"] == "yes" or env["use_leak_sanitizer"] == "yes"):
if env['use_sanitizer'] or env['use_leak_sanitizer']:
env.Append(CCFLAGS=['-fsanitize=address', '-fno-omit-frame-pointer'])
env.Append(LINKFLAGS=['-fsanitize=address'])
env.extra_suffix += "s"
if (env["use_leak_sanitizer"] == "yes"):
if env['use_leak_sanitizer']:
env.Append(CCFLAGS=['-fsanitize=leak'])
env.Append(LINKFLAGS=['-fsanitize=leak'])
if (env["use_lto"] == "yes"):
if env['use_lto']:
env.Append(CCFLAGS=['-flto'])
env.Append(LINKFLAGS=['-flto'])
if (env["use_llvm"] == "no"):
if not env['use_llvm']:
env['RANLIB'] = 'gcc-ranlib'
env['AR'] = 'gcc-ar'
@ -206,7 +206,7 @@ def configure(env):
else:
print("ALSA libraries not found, disabling driver")
if (env["pulseaudio"] == "yes"):
if env['pulseaudio']:
if (os.system("pkg-config --exists libpulse-simple") == 0): # 0 means found
print("Enabling PulseAudio")
env.Append(CPPFLAGS=["-DPULSEAUDIO_ENABLED"])
@ -217,7 +217,7 @@ def configure(env):
if (platform.system() == "Linux"):
env.Append(CPPFLAGS=["-DJOYDEV_ENABLED"])
if (env["udev"] == "yes"):
if env['udev']:
if (os.system("pkg-config --exists libudev") == 0): # 0 means found
print("Enabling udev support")
env.Append(CPPFLAGS=["-DUDEV_ENABLED"])
@ -245,5 +245,5 @@ def configure(env):
env.Append(CPPFLAGS=['-m64'])
env.Append(LINKFLAGS=['-m64', '-L/usr/lib/i686-linux-gnu'])
if (env["use_static_cpp"] == "yes"):
if env['use_static_cpp']:
env.Append(LINKFLAGS=['-static-libstdc++'])