mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
Use BoolVariable for third-party options.
This commit is contained in:
parent
ffab67b8da
commit
45a9a680a3
30
SConstruct
30
SConstruct
@ -157,21 +157,21 @@ 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")
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
2
drivers/SCsub
vendored
2
drivers/SCsub
vendored
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
@ -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",
|
||||
|
@ -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 = [
|
||||
|
@ -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
|
||||
|
@ -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])
|
||||
|
||||
|
@ -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']
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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",
|
||||
|
@ -97,7 +97,7 @@ def configure(env):
|
||||
|
||||
## Dependencies
|
||||
|
||||
if (env['builtin_libtheora'] != 'no'):
|
||||
if env['builtin_libtheora']:
|
||||
env["x86_libtheora_opt_gcc"] = True
|
||||
|
||||
## Flags
|
||||
|
@ -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']:
|
||||
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'])
|
||||
|
@ -62,10 +62,10 @@ def get_opts():
|
||||
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),
|
||||
]
|
||||
|
||||
|
||||
@ -137,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']:
|
||||
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
|
||||
@ -226,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'])
|
||||
|
Loading…
Reference in New Issue
Block a user