Use BoolVariable in target/component/advanced options.

This commit is contained in:
Elliott Sales de Andrade 2017-09-25 00:04:49 -04:00
parent f9e463bce2
commit ffab67b8da
14 changed files with 44 additions and 44 deletions

View file

@ -136,25 +136,25 @@ opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32
opts.Add('p', "Platform (alias for 'platform')", '') opts.Add('p', "Platform (alias for 'platform')", '')
opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '') opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release'))) opts.Add(EnumVariable('target', "Compilation target", 'debug', ('debug', 'release_debug', 'release')))
opts.Add('tools', "Build the tools a.k.a. the Godot editor (yes/no)", 'yes') opts.Add(BoolVariable('tools', "Build the tools a.k.a. the Godot editor", True))
# Components # Components
opts.Add('deprecated', "Enable deprecated features (yes/no)", 'yes') opts.Add(BoolVariable('deprecated', "Enable deprecated features", True))
opts.Add('gdscript', "Build GDSCript support (yes/no)", 'yes') opts.Add(BoolVariable('gdscript', "Build GDSCript support", True))
opts.Add('minizip', "Build minizip archive support (yes/no)", 'yes') opts.Add(BoolVariable('minizip', "Build minizip archive support", True))
opts.Add('xaudio2', "XAudio2 audio driver (yes/no)", 'no') opts.Add(BoolVariable('xaudio2', "XAudio2 audio driver", False))
opts.Add('xml', "XML format support for resources (yes/no)", 'yes') opts.Add(BoolVariable('xml', "XML format support for resources", True))
# Advanced options # Advanced options
opts.Add('disable_3d', "Disable 3D nodes for smaller executable (yes/no)", 'no') opts.Add(BoolVariable('disable_3d', "Disable 3D nodes for smaller executable", False))
opts.Add('disable_advanced_gui', "Disable advance 3D gui nodes and behaviors (yes/no)", 'no') 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('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('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(BoolVariable('verbose', "Enable verbose output for the compilation", False))
opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no') 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(EnumVariable('warnings', "Set the level of warnings emitted during compilation", 'no', ('extra', 'all', 'moderate', 'no')))
opts.Add('progress', "Show a progress indicator during build (yes/no)", 'yes') opts.Add(BoolVariable('progress', "Show a progress indicator during build", True))
opts.Add('dev', "If yes, alias for verbose=yes warnings=all (yes/no)", 'no') opts.Add(BoolVariable('dev', "If yes, alias for verbose=yes warnings=all", False))
# Thirdparty libraries # Thirdparty libraries
opts.Add('builtin_enet', "Use the builtin enet library (yes/no)", 'yes') opts.Add('builtin_enet', "Use the builtin enet library (yes/no)", 'yes')
@ -213,7 +213,7 @@ if (env_base['target'] == 'debug'):
env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC']) env_base.Append(CPPFLAGS=['-DDEBUG_MEMORY_ALLOC'])
env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE']) env_base.Append(CPPFLAGS=['-DSCI_NAMESPACE'])
if (env_base['deprecated'] == 'no'): if not env_base['deprecated']:
env_base.Append(CPPFLAGS=['-DDISABLE_DEPRECATED']) env_base.Append(CPPFLAGS=['-DDISABLE_DEPRECATED'])
env_base.platforms = {} env_base.platforms = {}
@ -237,11 +237,11 @@ if selected_platform in platform_list:
else: else:
env = env_base.Clone() env = env_base.Clone()
if (env["dev"] == "yes"): if env['dev']:
env["warnings"] = "all" env["warnings"] = "all"
env["verbose"] = "yes" env['verbose'] = True
if env['vsproj'] == "yes": if env['vsproj']:
env.vs_incs = [] env.vs_incs = []
env.vs_srcs = [] env.vs_srcs = []
@ -319,19 +319,19 @@ if selected_platform in platform_list:
suffix = "." + selected_platform suffix = "." + selected_platform
if (env["target"] == "release"): if (env["target"] == "release"):
if (env["tools"] == "yes"): if env["tools"]:
print("Tools can only be built with targets 'debug' and 'release_debug'.") print("Tools can only be built with targets 'debug' and 'release_debug'.")
sys.exit(255) sys.exit(255)
suffix += ".opt" suffix += ".opt"
env.Append(CCFLAGS=['-DNDEBUG']) env.Append(CCFLAGS=['-DNDEBUG'])
elif (env["target"] == "release_debug"): elif (env["target"] == "release_debug"):
if (env["tools"] == "yes"): if env["tools"]:
suffix += ".opt.tools" suffix += ".opt.tools"
else: else:
suffix += ".opt.debug" suffix += ".opt.debug"
else: else:
if (env["tools"] == "yes"): if env["tools"]:
suffix += ".tools" suffix += ".tools"
else: else:
suffix += ".debug" suffix += ".debug"
@ -386,22 +386,22 @@ if selected_platform in platform_list:
# to test 64 bits compiltion # to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64']) # env.Append(CPPFLAGS=['-m64'])
if (env['tools'] == 'yes'): if env['tools']:
env.Append(CPPFLAGS=['-DTOOLS_ENABLED']) env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d'] == 'yes'): if env['disable_3d']:
env.Append(CPPFLAGS=['-D_3D_DISABLED']) env.Append(CPPFLAGS=['-D_3D_DISABLED'])
if (env['gdscript'] == 'yes'): if env['gdscript']:
env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED']) env.Append(CPPFLAGS=['-DGDSCRIPT_ENABLED'])
if (env['disable_advanced_gui'] == 'yes'): if env['disable_advanced_gui']:
env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED']) env.Append(CPPFLAGS=['-DADVANCED_GUI_DISABLED'])
if (env['minizip'] == 'yes'): if env['minizip']:
env.Append(CPPFLAGS=['-DMINIZIP_ENABLED']) env.Append(CPPFLAGS=['-DMINIZIP_ENABLED'])
if (env['xml'] == 'yes'): if env['xml']:
env.Append(CPPFLAGS=['-DXML_ENABLED']) env.Append(CPPFLAGS=['-DXML_ENABLED'])
if (env['verbose'] == 'no'): if not env['verbose']:
methods.no_verbose(sys, env) methods.no_verbose(sys, env)
if (True): # FIXME: detect GLES3 if (True): # FIXME: detect GLES3
@ -423,7 +423,7 @@ if selected_platform in platform_list:
SConscript("platform/" + selected_platform + "/SCsub") # build selected platform SConscript("platform/" + selected_platform + "/SCsub") # build selected platform
# Microsoft Visual Studio Project Generation # Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes": if env['vsproj']:
methods.generate_vs_project(env, GetOption("num_jobs")) methods.generate_vs_project(env, GetOption("num_jobs"))
# Check for the existence of headers # Check for the existence of headers
@ -470,7 +470,7 @@ def progress_finish(target, source, env):
with open(node_count_fname, 'w') as f: with open(node_count_fname, 'w') as f:
f.write('%d\n' % node_count) f.write('%d\n' % node_count)
if ('env' in locals() and env["progress"] == "yes"): if 'env' in locals() and env['progress']:
try: try:
with open(node_count_fname) as f: with open(node_count_fname) as f:
node_count_max = int(f.readline()) node_count_max = int(f.readline())

6
drivers/SCsub vendored
View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -32,7 +32,7 @@ def get_opts():
def get_flags(): def get_flags():
return [ return [
('tools', 'no'), ('tools', False),
] ]

View file

@ -37,7 +37,7 @@ def get_opts():
def get_flags(): def get_flags():
return [ return [
('tools', 'no'), ('tools', False),
] ]

View file

@ -27,7 +27,7 @@ def get_opts():
def get_flags(): def get_flags():
return [ return [
('tools', 'no'), ('tools', False),
('module_theora_enabled', 'no'), ('module_theora_enabled', 'no'),
] ]

View file

@ -86,7 +86,7 @@ def configure(env):
if (env['builtin_enet'] == 'no'): if (env['builtin_enet'] == 'no'):
env.ParseConfig('pkg-config libenet --cflags --libs') env.ParseConfig('pkg-config libenet --cflags --libs')
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"): if env['builtin_squish'] == 'no' and env['tools']:
env.ParseConfig('pkg-config libsquish --cflags --libs') env.ParseConfig('pkg-config libsquish --cflags --libs')
if env['builtin_zstd'] == 'no': if env['builtin_zstd'] == 'no':

View file

@ -33,8 +33,8 @@ def get_opts():
def get_flags(): def get_flags():
return [ return [
('tools', 'no'), ('tools', False),
('xaudio2', 'yes'), ('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"]) binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation # Microsoft Visual Studio Project Generation
if (env['vsproj']) == "yes": if env['vsproj']:
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"] env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win: for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)] env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]

View file

@ -159,7 +159,7 @@ def configure(env):
if (env['builtin_enet'] == 'no'): if (env['builtin_enet'] == 'no'):
env.ParseConfig('pkg-config libenet --cflags --libs') env.ParseConfig('pkg-config libenet --cflags --libs')
if (env['builtin_squish'] == 'no' and env["tools"] == "yes"): if env['builtin_squish'] == 'no' and env['tools']:
env.ParseConfig('pkg-config libsquish --cflags --libs') env.ParseConfig('pkg-config libsquish --cflags --libs')
if env['builtin_zstd'] == 'no': if env['builtin_zstd'] == 'no':

View file

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