scons: Reorder options for clarity

Also prefix all thirdparty-related toggles with `builtin`.
This commit is contained in:
Rémi Verschelde 2016-11-03 00:23:55 +01:00
parent cc54189911
commit cc95d4448c
21 changed files with 89 additions and 84 deletions

View File

@ -104,6 +104,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)
@ -115,41 +117,53 @@ 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('libvpx', 'VPX library for webm 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')
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('enet', 'ENet library (system/builtin)', 'builtin')
opts.Add('glew', 'GLEW library for the gl_context (system/builtin)', 'builtin')
opts.Add('xaudio2', 'XAudio2 audio driver (yes/no)', 'no')
opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler")
opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler")
# 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('xaudio2', "XAudio2 audio driver (yes/no)", 'no')
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_enet', "Use the builtin enet library (yes/no)", 'yes')
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_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_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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 = [

View File

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

View File

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

View File

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

View File

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

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["libogg"] != "system"): # builtin
if (env['builtin_libogg'] != 'no'):
env_webm.Append(CPPPATH=["#thirdparty/libogg"])
if (env["libvorbis"] != "system"): # builtin
if (env['builtin_libvorbis'] != 'no'):
env_webm.Append(CPPPATH=["#thirdparty/libvorbis"])
if (env["opus"] != "system"): # builtin
if (env['builtin_opus'] != 'no'):
env_webm.Append(CPPPATH=["#thirdparty"])
if (env["libvpx"] != "system"): # builtin
if (env['builtin_libvpx'] != 'no'):
Export('env_webm')
SConscript("libvpx/SCsub")

View File

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

View File

@ -37,7 +37,6 @@ def get_flags():
return [
('tools', 'no'),
('openssl', 'builtin'), # use builtin openssl
]

View File

@ -37,7 +37,6 @@ def get_flags():
return [
('tools', 'no'),
('builtin_zlib', 'yes'),
('module_theora_enabled', 'no'),
]

View File

@ -41,9 +41,6 @@ def get_flags():
return [
('tools', 'no'),
('webp', 'yes'),
('builtin_zlib', 'yes'),
('openssl', 'builtin'), # use builtin openssl
]

View File

@ -31,7 +31,6 @@ def get_flags():
return [
('tools', 'no'),
('builtin_zlib', 'yes'),
('module_etc1_enabled', 'no'),
('module_mpc_enabled', 'no'),
('module_theora_enabled', 'no'),

View File

@ -180,8 +180,6 @@ def get_opts():
def get_flags():
return [
('builtin_zlib', 'yes'),
('openssl', 'builtin'), # use builtin openssl
]

View File

@ -33,8 +33,6 @@ def get_flags():
return [
('tools', 'no'),
('builtin_zlib', 'yes'),
('openssl', 'builtin'),
('xaudio2', 'yes'),
]

View File

@ -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,50 +133,50 @@ 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["enet"] == "system"):
if (env['builtin_enet'] == 'no'):
env.ParseConfig('pkg-config libenet --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["libvpx"] == "system"):
if (env['builtin_libvpx'] == 'no'):
env.ParseConfig('pkg-config vpx --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: