Browse Source

Use BoolVariable in target/component/advanced options.

Elliott Sales de Andrade 8 years ago
parent
commit
ffab67b8da

+ 28 - 28
SConstruct

@@ -136,25 +136,25 @@ opts.Add(EnumVariable('bits', "Target platform bits", 'default', ('default', '32
 opts.Add('p', "Platform (alias for 'platform')", '')
 opts.Add('platform', "Target platform (%s)" % ('|'.join(platform_list), ), '')
 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
-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(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('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('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')
@@ -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"
@@ -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())

+ 3 - 3
drivers/SCsub

@@ -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:

+ 1 - 1
editor/SCsub

@@ -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'

+ 1 - 1
modules/etc/config.py

@@ -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"):
+    if not env['tools']:
         env["module_etc_enabled"] = "no"
         env.disabled_modules.append("etc")

+ 1 - 1
modules/squish/config.py

@@ -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"):
+    if not env['tools']:
         env["module_squish_enabled"] = "no"
         env.disabled_modules.append("squish")

+ 1 - 1
modules/tinyexr/config.py

@@ -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"):
+    if not env['tools']:
         env["module_tinyexr_enabled"] = "no"
         env.disabled_modules.append("tinyexr")

+ 1 - 1
platform/android/detect.py

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

+ 1 - 1
platform/iphone/detect.py

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

+ 1 - 1
platform/javascript/detect.py

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

+ 1 - 1
platform/server/detect.py

@@ -86,7 +86,7 @@ def configure(env):
     if (env['builtin_enet'] == 'no'):
         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')
 
     if env['builtin_zstd'] == 'no':

+ 2 - 2
platform/uwp/detect.py

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

+ 1 - 1
platform/windows/SCsub

@@ -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)]

+ 1 - 1
platform/x11/detect.py

@@ -159,7 +159,7 @@ def configure(env):
     if (env['builtin_enet'] == 'no'):
         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')
 
     if env['builtin_zstd'] == 'no':

+ 1 - 1
scene/3d/SCsub

@@ -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")