Merge pull request #11567 from QuLogic/scons-var-types

Add types to scons command-line options
This commit is contained in:
Rémi Verschelde 2017-09-25 22:44:05 +02:00 committed by GitHub
commit 78aa7b382a
33 changed files with 197 additions and 196 deletions

View file

@ -132,46 +132,46 @@ opts = Variables(customs, ARGUMENTS)
# Target build options
opts.Add('arch', "Platform-dependent architecture (arm/arm64/x86/x64/mips/etc)", '')
opts.Add('bits', "Target platform bits (default/32/64/fat)", 'default')
opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32', '64', 'fat')))
opts.Add('p', "Platform (alias for 'platform')", '')
opts.Add('platform', "Target platform: any in " + str(platform_list), '')
opts.Add('target', "Compilation target (debug/release_debug/release)", 'debug')
opts.Add('tools', "Build the tools a.k.a. the Godot editor (yes/no)", 'yes')
opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release')))
opts.Add(BoolVariable('tools', "Build the tools a.k.a. the Godot editor", True))
# Components
opts.Add('deprecated', "Enable deprecated features (yes/no)", 'yes')
opts.Add('gdscript', "Build GDSCript support (yes/no)", 'yes')
opts.Add('minizip', "Build minizip archive support (yes/no)", 'yes')
opts.Add('xaudio2', "XAudio2 audio driver (yes/no)", 'no')
opts.Add('xml', "XML format support for resources (yes/no)", 'yes')
opts.Add(BoolVariable('deprecated', "Enable deprecated features", True))
opts.Add(BoolVariable('gdscript', "Build GDSCript support", True))
opts.Add(BoolVariable('minizip', "Build minizip archive support", True))
opts.Add(BoolVariable('xaudio2', "XAudio2 audio driver", False))
opts.Add(BoolVariable('xml', "XML format support for resources", True))
# Advanced options
opts.Add('disable_3d', "Disable 3D nodes for smaller executable (yes/no)", 'no')
opts.Add('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors (yes/no)", 'no')
opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for smaller executable", False))
opts.Add(BoolVariable('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors", False))
opts.Add('extra_suffix', "Custom extra suffix added to the base filename of all generated binary files", '')
opts.Add('unix_global_settings_path', "UNIX-specific path to system-wide settings. Currently only used for templates", '')
opts.Add('verbose', "Enable verbose output for the compilation (yes/no)", 'no')
opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no')
opts.Add('warnings', "Set the level of warnings emitted during compilation (extra/all/moderate/no)", 'no')
opts.Add('progress', "Show a progress indicator during build (yes/no)", 'yes')
opts.Add('dev', "If yes, alias for verbose=yes warnings=all (yes/no)", 'no')
opts.Add(BoolVariable('verbose', "Enable verbose output for the compilation", False))
opts.Add(BoolVariable('vsproj', "Generate Visual Studio Project.", False))
opts.Add(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no')))
opts.Add(BoolVariable('progress', "Show a progress indicator during build", True))
opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
# Thirdparty libraries
opts.Add('builtin_enet', "Use the builtin enet library (yes/no)", 'yes')
opts.Add('builtin_freetype', "Use the builtin freetype library (yes/no)", 'yes')
opts.Add('builtin_libogg', "Use the builtin libogg library (yes/no)", 'yes')
opts.Add('builtin_libpng', "Use the builtin libpng library (yes/no)", 'yes')
opts.Add('builtin_libtheora', "Use the builtin libtheora library (yes/no)", 'yes')
opts.Add('builtin_libvorbis', "Use the builtin libvorbis library (yes/no)", 'yes')
opts.Add('builtin_libvpx', "Use the builtin libvpx library (yes/no)", 'yes')
opts.Add('builtin_libwebp', "Use the builtin libwebp library (yes/no)", 'yes')
opts.Add('builtin_openssl', "Use the builtin openssl library (yes/no)", 'yes')
opts.Add('builtin_opus', "Use the builtin opus library (yes/no)", 'yes')
opts.Add('builtin_pcre2', "Use the builtin pcre2 library (yes/no)", 'yes')
opts.Add('builtin_recast', "Use the builtin recast library (yes/no)", 'yes')
opts.Add('builtin_squish', "Use the builtin squish library (yes/no)", 'yes')
opts.Add('builtin_zlib', "Use the builtin zlib library (yes/no)", 'yes')
opts.Add('builtin_zstd', "Use the builtin zstd library (yes/no)", 'yes')
opts.Add(BoolVariable('builtin_enet', "Use the builtin enet library", True))
opts.Add(BoolVariable('builtin_freetype', "Use the builtin freetype library", True))
opts.Add(BoolVariable('builtin_libogg', "Use the builtin libogg library", True))
opts.Add(BoolVariable('builtin_libpng', "Use the builtin libpng library", True))
opts.Add(BoolVariable('builtin_libtheora', "Use the builtin libtheora library", True))
opts.Add(BoolVariable('builtin_libvorbis', "Use the builtin libvorbis library", True))
opts.Add(BoolVariable('builtin_libvpx', "Use the builtin libvpx library", True))
opts.Add(BoolVariable('builtin_libwebp', "Use the builtin libwebp library", True))
opts.Add(BoolVariable('builtin_openssl', "Use the builtin openssl library", True))
opts.Add(BoolVariable('builtin_opus', "Use the builtin opus library", True))
opts.Add(BoolVariable('builtin_pcre2', "Use the builtin pcre2 library)", True))
opts.Add(BoolVariable('builtin_recast', "Use the builtin recast library", True))
opts.Add(BoolVariable('builtin_squish', "Use the builtin squish library", True))
opts.Add(BoolVariable('builtin_zlib', "Use the builtin zlib library", True))
opts.Add(BoolVariable('builtin_zstd', "Use the builtin zstd library", True))
# Environment setup
opts.Add("CXX", "C++ compiler")
@ -186,10 +186,10 @@ opts.Add("LINKFLAGS", "Custom flags for the linker")
for k in platform_opts.keys():
opt_list = platform_opts[k]
for o in opt_list:
opts.Add(o[0], o[1], o[2])
opts.Add(o)
for x in module_list:
opts.Add('module_' + x + '_enabled', "Enable module '" + x + "' (yes/no)", "yes")
opts.Add(BoolVariable('module_' + x + '_enabled', "Enable module '%s'" % (x, ), True))
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
@ -213,7 +213,7 @@ if (env_base['target'] == 'debug'):
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
if (env_base['deprecated'] == 'no'):
if not env_base['deprecated']:
env_base.Append(CPPFLAGS=['-DDISABLE_DEPRECATED'])
env_base.platforms = {}
@ -237,11 +237,11 @@ if selected_platform in platform_list:
else:
env = env_base.Clone()
if (env["dev"] == "yes"):
if env['dev']:
env["warnings"] = "all"
env["verbose"] = "yes"
env['verbose'] = True
if env['vsproj'] == "yes":
if env['vsproj']:
env.vs_incs = []
env.vs_srcs = []
@ -319,19 +319,19 @@ if selected_platform in platform_list:
suffix = "." + selected_platform
if (env["target"] == "release"):
if (env["tools"] == "yes"):
if env["tools"]:
print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255)
suffix += ".opt"
env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"] == "release_debug"):
if (env["tools"] == "yes"):
if env["tools"]:
suffix += ".opt.tools"
else:
suffix += ".opt.debug"
else:
if (env["tools"] == "yes"):
if env["tools"]:
suffix += ".tools"
else:
suffix += ".debug"
@ -359,7 +359,7 @@ if selected_platform in platform_list:
env.doc_class_path={}
for x in module_list:
if env['module_' + x + '_enabled'] != "yes":
if not env['module_' + x + '_enabled']:
continue
tmppath = "./modules/" + x
sys.path.append(tmppath)
@ -386,22 +386,22 @@ if selected_platform in platform_list:
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
if (env['tools'] == 'yes'):
if env['tools']:
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d'] == 'yes'):
if env['disable_3d']:
env.Append(CPPFLAGS=['-D_3D_DISABLED'])
if (env['gdscript'] == 'yes'):
if env['gdscript']:
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
if (env['disable_advanced_gui'] == 'yes'):
if env['disable_advanced_gui']:
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
if (env['minizip'] == 'yes'):
if env['minizip']:
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
if (env['xml'] == 'yes'):
if env['xml']:
env.Append(CPPFLAGS=['-DXML_ENABLED'])
if (env['verbose'] == 'no'):
if not env['verbose']:
methods.no_verbose(sys, env)
if (True): # FIXME: detect GLES3
@ -423,7 +423,7 @@ if selected_platform in platform_list:
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
# Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes":
if env['vsproj']:
methods.generate_vs_project(env, GetOption("num_jobs"))
# Check for the existence of headers
@ -470,7 +470,7 @@ def progress_finish(target, source, env):
with open(node_count_fname, 'w') as f:
f.write('%d\n' % node_count)
if ('env' in locals() and env["progress"] == "yes"):
if 'env' in locals() and env['progress']:
try:
with open(node_count_fname) as f:
node_count_max = int(f.readline())

View file

@ -83,7 +83,7 @@ thirdparty_minizip_sources = [
thirdparty_minizip_sources = [thirdparty_minizip_dir + file for file in thirdparty_minizip_sources]
env.add_source_files(env.core_sources, thirdparty_minizip_sources)
if "builtin_zstd" in env and env["builtin_zstd"] == "yes":
if 'builtin_zstd' in env and env['builtin_zstd']:
SConscript("#thirdparty/zstd/SCsub")

8
drivers/SCsub vendored
View file

@ -4,7 +4,7 @@ Import('env')
env.drivers_sources = []
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
if 'builtin_zlib' in env and env['builtin_zlib']:
SConscript("zlib/SCsub")
# OS drivers
@ -17,7 +17,7 @@ SConscript('pulseaudio/SCsub')
if (env["platform"] == "windows"):
SConscript("rtaudio/SCsub")
SConscript("wasapi/SCsub")
if (env["xaudio2"] == "yes"):
if env['xaudio2']:
SConscript("xaudio2/SCsub")
# Graphics drivers
@ -29,10 +29,10 @@ SConscript("png/SCsub")
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
if (env["tools"] == "yes"):
if env['tools']:
SConscript("convex_decomp/SCsub")
if env['vsproj'] == "yes":
if env['vsproj']:
env.AddToVSProject(env.drivers_sources)
if env.split_drivers:

View file

@ -5,7 +5,7 @@ Import('env')
env_png = env.Clone()
# Thirdparty source files
if (env['builtin_libpng'] != 'no'):
if env['builtin_libpng']:
thirdparty_dir = "#thirdparty/libpng/"
thirdparty_sources = [
"png.c",

View file

@ -395,8 +395,8 @@ def _make_doc_data_class_path(to_path):
g.write("{NULL,NULL}\n")
g.write("};\n")
if (env["tools"] == "yes"):
if env['tools']:
# Register exporters
reg_exporters_inc = '#include "register_exporters.h"\n'
reg_exporters = 'void register_exporters() {\n'

View file

@ -7,7 +7,7 @@ Import('env_modules')
env_enet = env_modules.Clone()
if (env['builtin_enet'] != 'no'):
if env['builtin_enet']:
thirdparty_dir = "#thirdparty/enet/"
thirdparty_sources = [
"godot.cpp",

View file

@ -6,6 +6,6 @@ def can_build(platform):
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
if (env["tools"] == "no"):
env["module_etc_enabled"] = "no"
if not env['tools']:
env['module_etc_enabled'] = False
env.disabled_modules.append("etc")

View file

@ -6,7 +6,7 @@ from compat import isbasestring
# Not building in a separate env as scene needs it
# Thirdparty source files
if (env['builtin_freetype'] != 'no'):
if env['builtin_freetype']:
thirdparty_dir = "#thirdparty/freetype/"
thirdparty_sources = [
"src/autofit/autofit.c",
@ -65,7 +65,7 @@ if (env['builtin_freetype'] != 'no'):
env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"])
# also requires libpng headers
if (env['builtin_libpng'] != 'no'):
if env['builtin_libpng']:
env.Append(CPPPATH=["#thirdparty/libpng"])
lib = env.Library("freetype_builtin", thirdparty_sources)

View file

@ -6,7 +6,7 @@ Import('env_modules')
env_ogg = env_modules.Clone()
# Thirdparty source files
if (env['builtin_libogg'] != 'no'):
if env['builtin_libogg']:
thirdparty_dir = "#thirdparty/libogg/"
thirdparty_sources = [
"bitwise.c",

View file

@ -6,7 +6,7 @@ Import('env_modules')
env_openssl = env_modules.Clone()
# Thirdparty source files
if (env['builtin_openssl'] != 'no'):
if env['builtin_openssl']:
thirdparty_dir = "#thirdparty/openssl/"
thirdparty_sources = [

View file

@ -6,7 +6,7 @@ Import('env_modules')
env_opus = env_modules.Clone()
# Thirdparty source files
if (env['builtin_opus'] != 'no'):
if env['builtin_opus']:
thirdparty_dir = "#thirdparty/opus/"
thirdparty_sources = [
@ -209,7 +209,7 @@ if (env['builtin_opus'] != 'no'):
env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths])
# also requires libogg
if (env['builtin_libogg'] != 'no'):
if env['builtin_libogg']:
env_opus.Append(CPPPATH=["#thirdparty/libogg"])
# Module files

View file

@ -5,7 +5,7 @@ Import('env')
# Not building in a separate env as core needs it
# Thirdparty source files
if (env['builtin_recast'] != 'no'):
if env['builtin_recast']:
thirdparty_dir = "#thirdparty/recastnavigation/Recast/"
thirdparty_sources = [
"Source/Recast.cpp",
@ -24,10 +24,6 @@ if (env['builtin_recast'] != 'no'):
env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/Include"])
# also requires recast headers
if (env['builtin_recast'] != 'no'):
env.Append(CPPPATH=["#thirdparty/recastnavigation/Recast"])
lib = env.Library("recast_builtin", thirdparty_sources)
env.Append(LIBS=[lib])

View file

@ -7,7 +7,7 @@ env_regex = env_modules.Clone()
env_regex.Append(CPPFLAGS=["-DPCRE2_CODE_UNIT_WIDTH=0"])
env_regex.add_source_files(env.modules_sources, "*.cpp")
if (env['builtin_pcre2'] != 'no'):
if env['builtin_pcre2']:
jit_blacklist = ['javascript']
thirdparty_dir = '#thirdparty/pcre2/src/'
thirdparty_flags = ['-DPCRE2_STATIC', '-DHAVE_CONFIG_H']

View file

@ -6,7 +6,7 @@ Import('env_modules')
env_squish = env_modules.Clone()
# Thirdparty source files
if (env['builtin_squish'] != 'no'):
if env['builtin_squish']:
thirdparty_dir = "#thirdparty/squish/"
thirdparty_sources = [
"alpha.cpp",

View file

@ -6,6 +6,6 @@ def can_build(platform):
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
if (env["tools"] == "no"):
env["module_squish_enabled"] = "no"
if not env['tools']:
env['module_squish_enabled'] = False
env.disabled_modules.append("squish")

View file

@ -6,7 +6,7 @@ Import('env_modules')
env_theora = env_modules.Clone()
# Thirdparty source files
if (env['builtin_libtheora'] != 'no'):
if env['builtin_libtheora']:
thirdparty_dir = "#thirdparty/libtheora/"
thirdparty_sources = [
#"analyze.c",
@ -74,9 +74,9 @@ if (env['builtin_libtheora'] != 'no'):
env_theora.Append(CPPPATH=[thirdparty_dir])
# also requires libogg and libvorbis
if (env['builtin_libogg'] != 'no'):
if env['builtin_libogg']:
env_theora.Append(CPPPATH=["#thirdparty/libogg"])
if (env['builtin_libvorbis'] != 'no'):
if env['builtin_libvorbis']:
env_theora.Append(CPPPATH=["#thirdparty/libvorbis"])
# Godot source files

View file

@ -6,6 +6,6 @@ def can_build(platform):
def configure(env):
# Tools only, disabled for non-tools
# TODO: Find a cleaner way to achieve that
if (env["tools"] == "no"):
env["module_tinyexr_enabled"] = "no"
if not env['tools']:
env['module_tinyexr_enabled'] = False
env.disabled_modules.append("tinyexr")

View file

@ -6,7 +6,7 @@ Import('env_modules')
env_vorbis = env_modules.Clone()
# Thirdparty source files
if (env['builtin_libvorbis'] != 'no'):
if env['builtin_libvorbis']:
thirdparty_dir = "#thirdparty/libvorbis/"
thirdparty_sources = [
#"analysis.c",
@ -42,7 +42,7 @@ if (env['builtin_libvorbis'] != 'no'):
env_vorbis.Append(CPPPATH=[thirdparty_dir])
# also requires libogg
if (env['builtin_libogg'] != 'no'):
if env['builtin_libogg']:
env_vorbis.Append(CPPPATH=["#thirdparty/libogg"])
# Godot source files

View file

@ -19,14 +19,14 @@ env_webm.add_source_files(env.modules_sources, thirdparty_libsimplewebm_sources)
env_webm.Append(CPPPATH=[thirdparty_libsimplewebm_dir, thirdparty_libsimplewebm_dir + "libwebm/"])
# also requires libogg, libvorbis and libopus
if (env['builtin_libogg'] != 'no'):
if env['builtin_libogg']:
env_webm.Append(CPPPATH=["#thirdparty/libogg"])
if (env['builtin_libvorbis'] != 'no'):
if env['builtin_libvorbis']:
env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
if (env['builtin_opus'] != 'no'):
if env['builtin_opus']:
env_webm.Append(CPPPATH=["#thirdparty/opus"])
if (env['builtin_libvpx'] != 'no'):
if env['builtin_libvpx']:
Export('env_webm')
SConscript("libvpx/SCsub")

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

@ -6,7 +6,7 @@ Import('env_modules')
env_webp = env_modules.Clone()
# Thirdparty source files
if (env['builtin_libwebp'] != 'no'):
if env['builtin_libwebp']:
thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_sources = [
"dec/alpha_dec.c",

View file

@ -18,20 +18,21 @@ def can_build():
def get_opts():
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"),
('android_arch', 'Target architecture (armv7/armv6/arm64v8/x86)', "armv7"),
('android_neon', 'Enable NEON support (armv7 only)', "yes"),
('android_stl', 'Enable Android STL support (for modules)', "no")
EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'armv6', 'arm64v8', 'x86')),
BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True),
BoolVariable('android_stl', 'Enable Android STL support (for modules)', False),
]
def get_flags():
return [
('tools', 'no'),
('tools', False),
]
@ -93,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)
@ -117,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
@ -199,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:
@ -213,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])
@ -243,7 +244,7 @@ def configure(env):
env.Append(LIBS=['OpenSLES', 'EGL', 'GLESv3', 'android', 'log', 'z', 'dl'])
# TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
if 'module_opus_enabled' in env and env['module_opus_enabled']:
if (env["android_arch"] == "armv6" or env["android_arch"] == "armv7"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])
env.opus_fixed_point = "yes"

View file

@ -19,9 +19,10 @@ def can_build():
def get_opts():
from SCons.Variables import EnumVariable
return [
('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]

View file

@ -20,24 +20,24 @@ 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),
]
def get_flags():
return [
('tools', 'no'),
('tools', 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',
@ -151,7 +151,7 @@ def configure(env):
env.Append(CPPFLAGS=['-DIPHONE_ENABLED', '-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DMPC_FIXED_POINT'])
# TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
if 'module_opus_enabled' in env and env['module_opus_enabled']:
env.opus_fixed_point = "yes"
if (env["arch"] == "arm"):
env.Append(CFLAGS=["-DOPUS_ARM_OPT"])

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,18 +17,18 @@ 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),
]
def get_flags():
return [
('tools', 'no'),
('module_theora_enabled', 'no'),
('tools', False),
('module_theora_enabled', False),
]
@ -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
@ -116,5 +116,5 @@ def configure(env):
env.Append(LINKFLAGS=['--memory-init-file', '1'])
# TODO: Move that to opus module's config
if("module_opus_enabled" in env and env["module_opus_enabled"] != "no"):
if 'module_opus_enabled' in env and env['module_opus_enabled']:
env.opus_fixed_point = "yes"

View file

@ -19,10 +19,11 @@ def can_build():
def get_opts():
from SCons.Variables import EnumVariable
return [
('osxcross_sdk', 'OSXCross SDK version', 'darwin14'),
('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes'),
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@ -96,7 +97,7 @@ def configure(env):
## Dependencies
if (env['builtin_libtheora'] != 'no'):
if env['builtin_libtheora']:
env["x86_libtheora_opt_gcc"] = True
## Flags

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++"
@ -64,60 +64,60 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
if (env['builtin_openssl'] == 'no'):
if not env['builtin_openssl']:
env.ParseConfig('pkg-config openssl --cflags --libs')
if (env['builtin_libwebp'] == 'no'):
if not env['builtin_libwebp']:
env.ParseConfig('pkg-config libwebp --cflags --libs')
# freetype depends on libpng and zlib, so bundling one of them while keeping others
# as shared libraries leads to weird issues
if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'):
env['builtin_freetype'] = 'yes'
env['builtin_libpng'] = 'yes'
env['builtin_zlib'] = 'yes'
if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
env['builtin_freetype'] = True
env['builtin_libpng'] = True
env['builtin_zlib'] = True
if (env['builtin_freetype'] == 'no'):
if not env['builtin_freetype']:
env.ParseConfig('pkg-config freetype2 --cflags --libs')
if (env['builtin_libpng'] == 'no'):
if not env['builtin_libpng']:
env.ParseConfig('pkg-config libpng --cflags --libs')
if (env['builtin_enet'] == 'no'):
if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
if not env['builtin_squish'] and env['tools']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
if env['builtin_zstd'] == 'no':
if not env['builtin_zstd']:
env.ParseConfig('pkg-config libzstd --cflags --libs')
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
if (env['builtin_libtheora'] == 'no'):
env['builtin_libogg'] = 'no' # Needed to link against system libtheora
env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora
if not env['builtin_libtheora']:
env['builtin_libogg'] = False # Needed to link against system libtheora
env['builtin_libvorbis'] = False # Needed to link against system libtheora
env.ParseConfig('pkg-config theora theoradec --cflags --libs')
if (env['builtin_libvpx'] == 'no'):
if not env['builtin_libvpx']:
env.ParseConfig('pkg-config vpx --cflags --libs')
if (env['builtin_libvorbis'] == 'no'):
env['builtin_libogg'] = 'no' # Needed to link against system libvorbis
if not env['builtin_libvorbis']:
env['builtin_libogg'] = False # Needed to link against system libvorbis
env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
if (env['builtin_opus'] == 'no'):
env['builtin_libogg'] = 'no' # Needed to link against system opus
if not env['builtin_opus']:
env['builtin_libogg'] = False # Needed to link against system opus
env.ParseConfig('pkg-config opus opusfile --cflags --libs')
if (env['builtin_libogg'] == 'no'):
if not env['builtin_libogg']:
env.ParseConfig('pkg-config ogg --cflags --libs')
## Flags
# Linkflags below this line should typically stay the last ones
if (env['builtin_zlib'] == 'no'):
if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
env.Append(CPPPATH=['#platform/server'])

View file

@ -33,8 +33,8 @@ def get_opts():
def get_flags():
return [
('tools', 'no'),
('xaudio2', 'yes'),
('tools', False),
('xaudio2', True),
]

View file

@ -30,7 +30,7 @@ common_win.append(obj)
binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes":
if env['vsproj']:
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]

View file

@ -49,6 +49,7 @@ def can_build():
def get_opts():
from SCons.Variables import BoolVariable, EnumVariable
mingw32 = ""
mingw64 = ""
@ -64,8 +65,8 @@ 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'),
('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
BoolVariable('use_lto', 'Use link time optimization (when using MingW)', False),
EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@ -262,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,26 +45,27 @@ def can_build():
return True
def get_opts():
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'),
('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
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')),
]
def get_flags():
return [
('builtin_freetype', 'no'),
('builtin_libpng', 'no'),
('builtin_openssl', 'no'),
('builtin_zlib', 'no'),
('builtin_freetype', False),
('builtin_libpng', False),
('builtin_openssl', False),
('builtin_zlib', False),
]
@ -100,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++"
@ -109,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'
@ -136,64 +137,64 @@ def configure(env):
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
if (env['builtin_openssl'] == 'no'):
if not env['builtin_openssl']:
env.ParseConfig('pkg-config openssl --cflags --libs')
if (env['builtin_libwebp'] == 'no'):
if not env['builtin_libwebp']:
env.ParseConfig('pkg-config libwebp --cflags --libs')
# freetype depends on libpng and zlib, so bundling one of them while keeping others
# as shared libraries leads to weird issues
if (env['builtin_freetype'] == 'yes' or env['builtin_libpng'] == 'yes' or env['builtin_zlib'] == 'yes'):
env['builtin_freetype'] = 'yes'
env['builtin_libpng'] = 'yes'
env['builtin_zlib'] = 'yes'
if env['builtin_freetype'] or env['builtin_libpng'] or env['builtin_zlib']:
env['builtin_freetype'] = True
env['builtin_libpng'] = True
env['builtin_zlib'] = True
if (env['builtin_freetype'] == 'no'):
if not env['builtin_freetype']:
env.ParseConfig('pkg-config freetype2 --cflags --libs')
if (env['builtin_libpng'] == 'no'):
if not env['builtin_libpng']:
env.ParseConfig('pkg-config libpng --cflags --libs')
if (env['builtin_enet'] == 'no'):
if not env['builtin_enet']:
env.ParseConfig('pkg-config libenet --cflags --libs')
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"):
if not env['builtin_squish'] and env['tools']:
env.ParseConfig('pkg-config libsquish --cflags --libs')
if env['builtin_zstd'] == 'no':
if not env['builtin_zstd']:
env.ParseConfig('pkg-config libzstd --cflags --libs')
# Sound and video libraries
# Keep the order as it triggers chained dependencies (ogg needed by others, etc.)
if (env['builtin_libtheora'] == 'no'):
env['builtin_libogg'] = 'no' # Needed to link against system libtheora
env['builtin_libvorbis'] = 'no' # Needed to link against system libtheora
if not env['builtin_libtheora']:
env['builtin_libogg'] = False # Needed to link against system libtheora
env['builtin_libvorbis'] = False # Needed to link against system libtheora
env.ParseConfig('pkg-config theora theoradec --cflags --libs')
if (env['builtin_libvpx'] == 'no'):
if not env['builtin_libvpx']:
env.ParseConfig('pkg-config vpx --cflags --libs')
if (env['builtin_libvorbis'] == 'no'):
env['builtin_libogg'] = 'no' # Needed to link against system libvorbis
if not env['builtin_libvorbis']:
env['builtin_libogg'] = False # Needed to link against system libvorbis
env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs')
if (env['builtin_opus'] == 'no'):
env['builtin_libogg'] = 'no' # Needed to link against system opus
if not env['builtin_opus']:
env['builtin_libogg'] = False # Needed to link against system opus
env.ParseConfig('pkg-config opus opusfile --cflags --libs')
if (env['builtin_libogg'] == 'no'):
if not env['builtin_libogg']:
env.ParseConfig('pkg-config ogg --cflags --libs')
if (env['builtin_libtheora'] != 'no'):
if env['builtin_libtheora']:
list_of_x86 = ['x86_64', 'x86', 'i386', 'i586']
if any(platform.machine() in s for s in list_of_x86):
env["x86_libtheora_opt_gcc"] = True
# On Linux wchar_t should be 32-bits
# 16-bit library shouldn't be required due to compiler optimisations
if (env['builtin_pcre2'] == 'no'):
if not env['builtin_pcre2']:
env.ParseConfig('pkg-config libpcre2-32 --cflags --libs')
## Flags
@ -205,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"])
@ -216,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"])
@ -225,7 +226,7 @@ def configure(env):
print("libudev development libraries not found, disabling udev support")
# Linkflags below this line should typically stay the last ones
if (env['builtin_zlib'] == 'no'):
if not env['builtin_zlib']:
env.ParseConfig('pkg-config zlib --cflags --libs')
env.Append(CPPPATH=['#platform/x11'])
@ -244,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++'])

View file

@ -3,7 +3,7 @@
Import('env')
if (env["disable_3d"] == "yes"):
if env['disable_3d']:
env.scene_sources.append("3d/spatial.cpp")
env.scene_sources.append("3d/skeleton.cpp")