From ce54b6ea8b080085d66937750c8e729f862da3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 3 Nov 2016 00:23:55 +0100 Subject: [PATCH] scons: Reorder options for clarity Also prefix all thirdparty-related toggles with `builtin`. (cherry picked from commit cc95d4448c6005c3007c8460f09b8be1595eb3c0) --- SConstruct | 76 +++++++++++++++++++++-------------- drivers/gl_context/SCsub | 2 +- drivers/png/SCsub | 2 +- modules/freetype/SCsub | 4 +- modules/mpc/SCsub | 2 +- modules/ogg/SCsub | 2 +- modules/openssl/SCsub | 2 +- modules/opus/SCsub | 4 +- modules/speex/SCsub | 4 +- modules/squish/SCsub | 2 +- modules/theora/SCsub | 6 +-- modules/vorbis/SCsub | 4 +- modules/webp/SCsub | 2 +- platform/android/detect.py | 1 - platform/bb10/detect.py | 1 - platform/iphone/detect.py | 3 -- platform/javascript/detect.py | 3 +- platform/windows/detect.py | 2 - platform/x11/detect.py | 37 ++++++++--------- 19 files changed, 83 insertions(+), 76 deletions(-) diff --git a/SConstruct b/SConstruct index 5a6e03b831a..127b3ff35ee 100644 --- a/SConstruct +++ b/SConstruct @@ -105,6 +105,8 @@ env_base.__class__.split_lib = methods.split_lib env_base["x86_libtheora_opt_gcc"] = False env_base["x86_libtheora_opt_vc"] = False +# Build options + customs = ['custom.py'] profile = ARGUMENTS.get("profile", False) @@ -116,42 +118,54 @@ if profile: customs.append(profile + ".py") opts = Variables(customs, ARGUMENTS) -opts.Add('target', 'Compile Target (debug/release_debug/release).', "debug") -opts.Add('arch', 'Platform dependent architecture (arm/arm64/x86/x64/mips/etc)', "") -opts.Add('bits', 'Compile Target Bits (default/32/64/fat).', "default") -opts.Add('platform', 'Platform: ' + str(platform_list) + '.', "") -opts.Add('p', 'Platform (same as platform=).', "") -opts.Add('tools', 'Build Tools (Including Editor): (yes/no)', 'yes') -opts.Add('gdscript', 'Build GDSCript support: (yes/no)', 'yes') -opts.Add('libogg', 'Ogg library for ogg container support (system/builtin)', 'builtin') -opts.Add('libvorbis', 'Ogg Vorbis library for vorbis support (system/builtin)', 'builtin') -opts.Add('libtheora', 'Theora library for theora module (system/builtin)', 'builtin') -opts.Add('opus', 'Opus and opusfile library for Opus format support: (system/builtin)', 'builtin') -opts.Add('minizip', 'Build Minizip Archive Support: (yes/no)', 'yes') -opts.Add('squish', 'Squish library for BC Texture Compression in editor (system/builtin)', 'builtin') -opts.Add('freetype', 'Freetype library for TTF support via freetype module (system/builtin)', 'builtin') + +# 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('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') + +# 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('xml', "XML format support for resources (yes/no)", 'yes') + +# 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('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)", 'yes') +opts.Add('vsproj', "Generate Visual Studio Project. (yes/no)", 'no') + +# Thirdparty libraries +opts.Add('builtin_freetype', "Use the builtin freetype library (yes/no)", 'yes') +opts.Add('builtin_glew', "Use the builtin glew library (yes/no)", 'yes') +opts.Add('builtin_libmpcdec', "Use the builtin libmpcdec 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_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') # (akien) Unbundling would require work in audio_stream_speex.{cpp,h}, but since speex was # removed in 3.0+ and this is only to preserve compatibility in 2.1, I haven't worked on it. # Patches welcome if anyone cares :) -opts.Add('speex', 'Speex library for speex support', 'builtin') -opts.Add('xml', 'XML Save/Load support (yes/no)', 'yes') -opts.Add('libpng', 'libpng library for image loader support (system/builtin)', 'builtin') -opts.Add('libwebp', 'libwebp library for webp module (system/builtin)', 'builtin') -opts.Add('openssl', 'OpenSSL library for openssl module (system/builtin)', 'builtin') -opts.Add('libmpcdec', 'libmpcdec library for mpc module (system/builtin)', 'builtin') -opts.Add('glew', 'GLEW library for the gl_context (system/builtin)', 'builtin') -opts.Add("CXX", "C++ Compiler") -opts.Add("CC", "C Compiler") -opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler") +opts.Add('builtin_speex', "Use the builtin speex 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') + +# Environment setup +opts.Add("CXX", "C++ compiler") +opts.Add("CC", "C compiler") +opts.Add("CCFLAGS", "Custom flags for the C and C++ compilers") opts.Add("CFLAGS", "Custom flags for the C compiler") opts.Add("LINKFLAGS", "Custom flags for the linker") -opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.', '') -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('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes') -opts.Add('deprecated', 'Enable deprecated features (yes/no)', 'yes') -opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '') -opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no') + # add platform specific options diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index efc925dae49..a968c10cfd8 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -4,7 +4,7 @@ Import('env') if (env["platform"] in ["haiku", "osx", "windows", "x11"]): # Thirdparty source files - if (env["glew"] != "system"): # builtin + if (env['builtin_glew'] != 'no'): # builtin thirdparty_dir = "#thirdparty/glew/" thirdparty_sources = [ "glew.c", diff --git a/drivers/png/SCsub b/drivers/png/SCsub index aedde3e2b74..6684e36b20c 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -5,7 +5,7 @@ Import('env') env_png = env.Clone() # Thirdparty source files -if (env["libpng"] == "builtin"): +if (env['builtin_libpng'] != 'no'): thirdparty_dir = "#thirdparty/libpng/" thirdparty_sources = [ "png.c", diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index c68c40265c5..87652a3ddf9 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -5,7 +5,7 @@ Import('env') # Not building in a separate env as core needs it # Thirdparty source files -if (env["freetype"] != "system"): # builtin +if (env['builtin_freetype'] != 'no'): thirdparty_dir = "#thirdparty/freetype/" thirdparty_sources = [ "src/autofit/autofit.c", @@ -61,7 +61,7 @@ if (env["freetype"] != "system"): # builtin env.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/include"]) # also requires libpng headers - if (env["libpng"] != "system"): # builtin + if (env['builtin_libpng'] != 'no'): env.Append(CPPPATH=["#thirdparty/libpng"]) """ FIXME: Remove this commented code if Windows can handle the monolithic lib diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub index 80d2ab4abea..76b7cbea7a2 100644 --- a/modules/mpc/SCsub +++ b/modules/mpc/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_mpc = env_modules.Clone() # Thirdparty source files -if (env["libmpcdec"] != "system"): # builtin +if (env['builtin_libmpcdec'] != 'no'): thirdparty_dir = "#thirdparty/libmpcdec/" thirdparty_sources = [ "huffman.c", diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub index 719ee4662b6..5eabaf6f2b5 100644 --- a/modules/ogg/SCsub +++ b/modules/ogg/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_ogg = env_modules.Clone() # Thirdparty source files -if (env["libogg"] != "system"): # builtin +if (env['builtin_libogg'] != 'no'): thirdparty_dir = "#thirdparty/libogg/" thirdparty_sources = [ "bitwise.c", diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub index 3c5de728139..ae78e1c364d 100644 --- a/modules/openssl/SCsub +++ b/modules/openssl/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_openssl = env_modules.Clone() # Thirdparty source files -if (env["openssl"] != "system"): # builtin +if (env['builtin_openssl'] != 'no'): thirdparty_dir = "#thirdparty/openssl/" thirdparty_sources = [ diff --git a/modules/opus/SCsub b/modules/opus/SCsub index e116fc46071..491380c826d 100644 --- a/modules/opus/SCsub +++ b/modules/opus/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_opus = env_modules.Clone() # Thirdparty source files -if (env["opus"] != "system"): # builtin +if (env['builtin_opus'] != 'no'): thirdparty_dir = "#thirdparty/opus/" thirdparty_sources = [ @@ -208,7 +208,7 @@ if (env["opus"] != "system"): # builtin env_opus.Append(CPPPATH=[thirdparty_dir + "/" + dir for dir in thirdparty_include_paths]) # also requires libogg - if (env["libogg"] != "system"): # builtin + if (env['builtin_libogg'] != 'no'): env_opus.Append(CPPPATH=["#thirdparty/libogg"]) # Module files diff --git a/modules/speex/SCsub b/modules/speex/SCsub index 34ceafcc76d..abad3b247ff 100644 --- a/modules/speex/SCsub +++ b/modules/speex/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_speex = env_modules.Clone() # Thirdparty source files -if (env["speex"] != "system"): # builtin +if (env['builtin_speex'] != 'no'): thirdparty_dir = "#thirdparty/speex/" thirdparty_sources = [ @@ -59,7 +59,7 @@ if (env["speex"] != "system"): # builtin env_speex.Append(CPPPATH=[thirdparty_dir]) # also requires libogg - if (env["libogg"] != "system"): # builtin + if (env['builtin_libogg'] != 'no'): env_speex.Append(CPPPATH=["#thirdparty/libogg"]) # Module files diff --git a/modules/squish/SCsub b/modules/squish/SCsub index 462b6a05cf3..cca7c038f19 100644 --- a/modules/squish/SCsub +++ b/modules/squish/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_squish = env_modules.Clone() # Thirdparty source files -if (env["squish"] != "system"): # builtin +if (env['builtin_squish'] != 'no'): thirdparty_dir = "#thirdparty/squish/" thirdparty_sources = [ "alpha.cpp", diff --git a/modules/theora/SCsub b/modules/theora/SCsub index ff34b858795..2de4d296403 100644 --- a/modules/theora/SCsub +++ b/modules/theora/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_theora = env_modules.Clone() # Thirdparty source files -if (env["libtheora"] != "system"): # builtin +if (env['builtin_libtheora'] != 'no'): thirdparty_dir = "#thirdparty/libtheora/" thirdparty_sources = [ #"analyze.c", @@ -74,9 +74,9 @@ if (env["libtheora"] != "system"): # builtin env_theora.Append(CPPPATH=[thirdparty_dir]) # also requires libogg and libvorbis - if (env["libogg"] != "system"): # builtin + if (env['builtin_libogg'] != 'no'): env_theora.Append(CPPPATH=["#thirdparty/libogg"]) - if (env["libvorbis"] != "system"): # builtin + if (env['builtin_libvorbis'] != 'no'): env_theora.Append(CPPPATH=["#thirdparty/libvorbis"]) # Godot source files diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub index 3bd092105e4..d3e4f7e15ae 100644 --- a/modules/vorbis/SCsub +++ b/modules/vorbis/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_vorbis = env_modules.Clone() # Thirdparty source files -if (env["libvorbis"] != "system"): # builtin +if (env['builtin_libvorbis'] != 'no'): thirdparty_dir = "#thirdparty/libvorbis/" thirdparty_sources = [ #"analysis.c", @@ -42,7 +42,7 @@ if (env["libvorbis"] != "system"): # builtin env_vorbis.Append(CPPPATH=[thirdparty_dir]) # also requires libogg - if (env["libogg"] != "system"): # builtin + if (env['builtin_libogg'] != 'no'): env_vorbis.Append(CPPPATH=["#thirdparty/libogg"]) # Godot source files diff --git a/modules/webp/SCsub b/modules/webp/SCsub index ab60bfd6b27..92f34c4da16 100644 --- a/modules/webp/SCsub +++ b/modules/webp/SCsub @@ -6,7 +6,7 @@ Import('env_modules') env_webp = env_modules.Clone() # Thirdparty source files -if (env["libwebp"] != "system"): # builtin +if (env['builtin_libwebp'] != 'no'): thirdparty_dir = "#thirdparty/libwebp/" thirdparty_sources = [ "enc/webpenc.c", diff --git a/platform/android/detect.py b/platform/android/detect.py index 23c4470b093..7f197895f13 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -37,7 +37,6 @@ def get_flags(): return [ ('tools', 'no'), - ('openssl', 'builtin'), # use builtin openssl ] diff --git a/platform/bb10/detect.py b/platform/bb10/detect.py index 95720794b2b..d3ee9f01246 100644 --- a/platform/bb10/detect.py +++ b/platform/bb10/detect.py @@ -37,7 +37,6 @@ def get_flags(): return [ ('tools', 'no'), - ('builtin_zlib', 'yes'), ('module_theora_enabled', 'no'), ] diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py index 229038697c2..b92b64e9f11 100644 --- a/platform/iphone/detect.py +++ b/platform/iphone/detect.py @@ -41,9 +41,6 @@ def get_flags(): return [ ('tools', 'no'), - ('webp', 'yes'), - ('builtin_zlib', 'yes'), - ('openssl', 'builtin'), # use builtin openssl ] diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 7cd10858064..2ac12c5f6fc 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -30,10 +30,9 @@ def get_flags(): return [ ('tools', 'no'), - ('builtin_zlib', 'yes'), - ('module_speex_enabled', 'no'), ('module_etc1_enabled', 'no'), ('module_mpc_enabled', 'no'), + ('module_speex_enabled', 'no'), ('module_theora_enabled', 'no'), ] diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 55c9913e962..ae620c67870 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -171,8 +171,6 @@ def get_opts(): def get_flags(): return [ - ('builtin_zlib', 'yes'), - ('openssl', 'builtin'), # use builtin openssl ] diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 1574c60c487..675fea51790 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -70,9 +70,10 @@ def get_opts(): def get_flags(): return [ - ("openssl", "system"), - ('freetype', 'system'), - ('libpng', 'system'), + ('builtin_freetype', 'no'), + ('builtin_libpng', 'no'), + ('builtin_openssl', 'no'), + ('builtin_zlib', 'no'), ] @@ -132,44 +133,44 @@ def configure(env): env.ParseConfig('pkg-config xcursor --cflags --libs') env.ParseConfig('pkg-config xrandr --cflags --libs') - if (env["openssl"] == "system"): + if (env['builtin_openssl'] == 'no'): env.ParseConfig('pkg-config openssl --cflags --libs') - if (env["libwebp"] == "system"): + if (env['builtin_libwebp'] == 'no'): env.ParseConfig('pkg-config libwebp --cflags --libs') - if (env["freetype"] == "system"): - env["libpng"] = "system" # Freetype links against libpng + if (env['builtin_freetype'] == 'no'): + env['builtin_libpng'] = 'no' # Freetype links against libpng env.ParseConfig('pkg-config freetype2 --cflags --libs') - if (env["libpng"] == "system"): + if (env['builtin_libpng'] == 'no'): env.ParseConfig('pkg-config libpng --cflags --libs') - if (env["squish"] == "system" and env["tools"] == "yes"): + if (env['builtin_squish'] == 'no' and env["tools"] == "yes"): env.ParseConfig('pkg-config libsquish --cflags --libs') # Sound and video libraries # Keep the order as it triggers chained dependencies (ogg needed by others, etc.) - if (env["libtheora"] == "system"): - env["libogg"] = "system" # Needed to link against system libtheora - env["libvorbis"] = "system" # Needed to link against system libtheora + 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 env.ParseConfig('pkg-config theora theoradec --cflags --libs') - if (env["libvorbis"] == "system"): - env["libogg"] = "system" # Needed to link against system libvorbis + if (env['builtin_libvorbis'] == 'no'): + env['builtin_libogg'] = 'no' # Needed to link against system libvorbis env.ParseConfig('pkg-config vorbis vorbisfile --cflags --libs') - if (env["opus"] == "system"): - env["libogg"] = "system" # Needed to link against system opus + if (env['builtin_opus'] == 'no'): + env['builtin_libogg'] = 'no' # Needed to link against system opus env.ParseConfig('pkg-config opus opusfile --cflags --libs') - if (env["libogg"] == "system"): + if (env['builtin_libogg'] == 'no'): env.ParseConfig('pkg-config ogg --cflags --libs') env.Append(CPPFLAGS=['-DOPENGL_ENABLED']) - if (env["glew"] == "system"): + if (env['builtin_glew'] == 'no'): env.ParseConfig('pkg-config glew --cflags --libs') if os.system("pkg-config --exists alsa") == 0: