mirror of
https://github.com/Relintai/pandemonium_engine_minimal.git
synced 2024-11-10 20:12:10 +01:00
Now freetype, libpng and zlib is always built in.
This commit is contained in:
parent
b564b6e261
commit
c4cb4e366b
@ -171,12 +171,9 @@ opts.Add(BoolVariable("editor_docs", "Whether to add docs to an editor build or
|
||||
# Thirdparty libraries
|
||||
opts.Add(BoolVariable("builtin_certs", "Use the built-in SSL certificates bundles", True))
|
||||
opts.Add(BoolVariable("builtin_enet", "Use the built-in ENet library", True))
|
||||
opts.Add(BoolVariable("builtin_freetype", "Use the built-in FreeType library", True))
|
||||
opts.Add(BoolVariable("builtin_libpng", "Use the built-in libpng library", True))
|
||||
opts.Add(BoolVariable("builtin_mbedtls", "Use the built-in mbedTLS library", True))
|
||||
opts.Add(BoolVariable("builtin_pcre2", "Use the built-in PCRE2 library", True))
|
||||
opts.Add(BoolVariable("builtin_pcre2_with_jit", "Use JIT compiler for the built-in PCRE2 library", True))
|
||||
opts.Add(BoolVariable("builtin_zlib", "Use the built-in zlib library", True))
|
||||
|
||||
# Compilation environment setup
|
||||
opts.Add("CXX", "C++ compiler")
|
||||
|
19
core/SCsub
19
core/SCsub
@ -64,9 +64,8 @@ thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_mis
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_misc_sources)
|
||||
|
||||
# Zlib library, can be unbundled
|
||||
if env["builtin_zlib"]:
|
||||
thirdparty_zlib_dir = "thirdparty/zlib/"
|
||||
thirdparty_zlib_sources = [
|
||||
thirdparty_zlib_dir = "thirdparty/zlib/"
|
||||
thirdparty_zlib_sources = [
|
||||
"adler32.c",
|
||||
"compress.c",
|
||||
"crc32.c",
|
||||
@ -78,16 +77,16 @@ if env["builtin_zlib"]:
|
||||
"trees.c",
|
||||
"uncompr.c",
|
||||
"zutil.c",
|
||||
]
|
||||
thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
|
||||
]
|
||||
thirdparty_zlib_sources = [thirdparty_zlib_dir + file for file in thirdparty_zlib_sources]
|
||||
|
||||
env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
|
||||
# Needs to be available in main env too
|
||||
env.Prepend(CPPPATH=[thirdparty_zlib_dir])
|
||||
if env["target"] == "debug":
|
||||
env_thirdparty.Prepend(CPPPATH=[thirdparty_zlib_dir])
|
||||
# Needs to be available in main env too
|
||||
env.Prepend(CPPPATH=[thirdparty_zlib_dir])
|
||||
if env["target"] == "debug":
|
||||
env_thirdparty.Append(CPPDEFINES=["ZLIB_DEBUG"])
|
||||
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_zlib_sources)
|
||||
|
||||
env.core_sources += thirdparty_obj
|
||||
|
||||
|
@ -11,9 +11,8 @@ env_freetype = env_modules.Clone()
|
||||
|
||||
thirdparty_obj = []
|
||||
|
||||
if env["builtin_freetype"]:
|
||||
thirdparty_dir = "freetype/"
|
||||
thirdparty_sources = [
|
||||
thirdparty_dir = "freetype/"
|
||||
thirdparty_sources = [
|
||||
"src/autofit/autofit.c",
|
||||
"src/base/ftbase.c",
|
||||
"src/base/ftbbox.c",
|
||||
@ -58,10 +57,10 @@ if env["builtin_freetype"]:
|
||||
"src/type42/type42.c",
|
||||
"src/winfonts/winfnt.c",
|
||||
]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
thirdparty_brotli_dir = "brotli/"
|
||||
thirdparty_brotli_sources = [
|
||||
thirdparty_brotli_dir = "brotli/"
|
||||
thirdparty_brotli_sources = [
|
||||
"common/constants.c",
|
||||
"common/context.c",
|
||||
"common/dictionary.c",
|
||||
@ -73,55 +72,54 @@ if env["builtin_freetype"]:
|
||||
"dec/huffman.c",
|
||||
"dec/state.c",
|
||||
]
|
||||
thirdparty_sources += [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
|
||||
env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
|
||||
env_freetype.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
|
||||
thirdparty_sources += [thirdparty_brotli_dir + file for file in thirdparty_brotli_sources]
|
||||
env_freetype.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"])
|
||||
env_freetype.Prepend(CPPPATH=[thirdparty_brotli_dir + "include"])
|
||||
|
||||
if env["platform"] == "uwp":
|
||||
if env["platform"] == "uwp":
|
||||
# Include header for UWP to fix build issues
|
||||
env_freetype.Append(CCFLAGS=["/FI", '"modules/freetype/uwpdef.h"'])
|
||||
# Globally too, as freetype is used in scene (see bottom)
|
||||
env.Append(CCFLAGS=["/FI", '"modules/freetype/uwpdef.h"'])
|
||||
|
||||
env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
|
||||
# Also needed in main env for scene/
|
||||
env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
|
||||
env_freetype.Prepend(CPPPATH=[thirdparty_dir + "/include"])
|
||||
# Also needed in main env for scene/
|
||||
env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
|
||||
|
||||
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
|
||||
if env["target"] == "debug":
|
||||
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
|
||||
if env["target"] == "debug":
|
||||
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])
|
||||
|
||||
# Also requires libpng headers
|
||||
if env["builtin_libpng"]:
|
||||
env_freetype.Prepend(CPPPATH=["#modules/png/libpng"])
|
||||
# Also requires libpng headers
|
||||
env_freetype.Prepend(CPPPATH=["#modules/png/libpng"])
|
||||
|
||||
sfnt = thirdparty_dir + "src/sfnt/sfnt.c"
|
||||
# Must be done after all CPPDEFINES are being set so we can copy them.
|
||||
if env["platform"] == "javascript":
|
||||
sfnt = thirdparty_dir + "src/sfnt/sfnt.c"
|
||||
# Must be done after all CPPDEFINES are being set so we can copy them.
|
||||
if env["platform"] == "javascript":
|
||||
# Forcibly undefine this macro so SIMD is not used in this file,
|
||||
# since currently unsupported in WASM
|
||||
tmp_env = env_freetype.Clone()
|
||||
tmp_env.disable_warnings()
|
||||
tmp_env.Append(CPPFLAGS=["-U__OPTIMIZE__"])
|
||||
sfnt = tmp_env.Object(sfnt)
|
||||
thirdparty_sources += [sfnt]
|
||||
thirdparty_sources += [sfnt]
|
||||
|
||||
env_thirdparty = env_freetype.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
lib = env_thirdparty.add_library("freetype_builtin", thirdparty_sources)
|
||||
thirdparty_obj += lib
|
||||
env_thirdparty = env_freetype.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
lib = env_thirdparty.add_library("freetype_builtin", thirdparty_sources)
|
||||
thirdparty_obj += lib
|
||||
|
||||
# Needs to be appended to arrive after libscene in the linker call,
|
||||
# but we don't want it to arrive *after* system libs, so manual hack
|
||||
# LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
|
||||
# and then plain strings for system library. We insert between the two.
|
||||
inserted = False
|
||||
for idx, linklib in enumerate(env["LIBS"]):
|
||||
# Needs to be appended to arrive after libscene in the linker call,
|
||||
# but we don't want it to arrive *after* system libs, so manual hack
|
||||
# LIBS contains first SCons Library objects ("SCons.Node.FS.File object")
|
||||
# and then plain strings for system library. We insert between the two.
|
||||
inserted = False
|
||||
for idx, linklib in enumerate(env["LIBS"]):
|
||||
if isbasestring(linklib): # first system lib such as "X11", otherwise SCons lib object
|
||||
env["LIBS"].insert(idx, lib)
|
||||
inserted = True
|
||||
break
|
||||
if not inserted:
|
||||
if not inserted:
|
||||
env.Append(LIBS=[lib])
|
||||
|
||||
|
||||
|
@ -9,9 +9,8 @@ env_png = env_modules.Clone()
|
||||
|
||||
thirdparty_obj = []
|
||||
|
||||
if env["builtin_libpng"]:
|
||||
thirdparty_dir = "libpng/"
|
||||
thirdparty_sources = [
|
||||
thirdparty_dir = "libpng/"
|
||||
thirdparty_sources = [
|
||||
"png.c",
|
||||
"pngerror.c",
|
||||
"pngget.c",
|
||||
@ -27,27 +26,27 @@ if env["builtin_libpng"]:
|
||||
"pngwrite.c",
|
||||
"pngwtran.c",
|
||||
"pngwutil.c",
|
||||
]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
]
|
||||
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
|
||||
|
||||
env_png.Prepend(CPPPATH=[thirdparty_dir])
|
||||
# Needed for drivers includes and in platform/javascript
|
||||
env.Prepend(CPPPATH=[thirdparty_dir])
|
||||
env_png.Prepend(CPPPATH=[thirdparty_dir])
|
||||
# Needed for drivers includes and in platform/javascript
|
||||
env.Prepend(CPPPATH=[thirdparty_dir])
|
||||
|
||||
# Currently .ASM filter_neon.S does not compile on NT.
|
||||
import os
|
||||
# Currently .ASM filter_neon.S does not compile on NT.
|
||||
import os
|
||||
|
||||
use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt"
|
||||
if use_neon:
|
||||
use_neon = "neon_enabled" in env and env["neon_enabled"] and os.name != "nt"
|
||||
if use_neon:
|
||||
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 2)])
|
||||
else:
|
||||
else:
|
||||
env_png.Append(CPPDEFINES=[("PNG_ARM_NEON_OPT", 0)])
|
||||
|
||||
env_thirdparty = env_png.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
||||
env_thirdparty = env_png.Clone()
|
||||
env_thirdparty.disable_warnings()
|
||||
env_thirdparty.add_source_files(thirdparty_obj, thirdparty_sources)
|
||||
|
||||
if use_neon:
|
||||
if use_neon:
|
||||
env_neon = env_thirdparty.Clone()
|
||||
if "S_compiler" in env:
|
||||
env_neon["CC"] = env["S_compiler"]
|
||||
@ -58,7 +57,7 @@ if env["builtin_libpng"]:
|
||||
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/palette_neon_intrinsics.c"))
|
||||
thirdparty_obj += neon_sources
|
||||
|
||||
env.modules_sources += thirdparty_obj
|
||||
env.modules_sources += thirdparty_obj
|
||||
|
||||
|
||||
# Pandemonium source files
|
||||
|
@ -178,25 +178,6 @@ def configure(env):
|
||||
|
||||
## Dependencies
|
||||
|
||||
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
|
||||
|
||||
# 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"] or env["builtin_libpng"] or env["builtin_zlib"]:
|
||||
env["builtin_freetype"] = True
|
||||
env["builtin_libpng"] = True
|
||||
env["builtin_zlib"] = True
|
||||
|
||||
if not env["builtin_freetype"]:
|
||||
env.ParseConfig("pkg-config freetype2 --cflags --libs")
|
||||
|
||||
if not env["builtin_libpng"]:
|
||||
env.ParseConfig("pkg-config libpng16 --cflags --libs")
|
||||
|
||||
if False: # not env['builtin_assimp']:
|
||||
# FIXME: Add min version check
|
||||
env.ParseConfig("pkg-config assimp --cflags --libs")
|
||||
|
||||
if not env["builtin_enet"]:
|
||||
env.ParseConfig("pkg-config libenet --cflags --libs")
|
||||
|
||||
@ -214,10 +195,6 @@ def configure(env):
|
||||
|
||||
## Flags
|
||||
|
||||
# Linkflags below this line should typically stay the last ones
|
||||
if not env["builtin_zlib"]:
|
||||
env.ParseConfig("pkg-config zlib --cflags --libs")
|
||||
|
||||
env.Prepend(CPPPATH=["#platform/server"])
|
||||
env.Append(CPPDEFINES=["SERVER_ENABLED", "UNIX_ENABLED"])
|
||||
|
||||
|
@ -264,23 +264,6 @@ def configure(env):
|
||||
|
||||
# FIXME: Check for existence of the libs before parsing their flags with pkg-config
|
||||
|
||||
# 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"] or env["builtin_libpng"] or env["builtin_zlib"]:
|
||||
env["builtin_freetype"] = True
|
||||
env["builtin_libpng"] = True
|
||||
env["builtin_zlib"] = True
|
||||
|
||||
if not env["builtin_freetype"]:
|
||||
env.ParseConfig("pkg-config freetype2 --cflags --libs")
|
||||
|
||||
if not env["builtin_libpng"]:
|
||||
env.ParseConfig("pkg-config libpng16 --cflags --libs")
|
||||
|
||||
if False: # not env['builtin_assimp']:
|
||||
# FIXME: Add min version check
|
||||
env.ParseConfig("pkg-config assimp --cflags --libs")
|
||||
|
||||
if not env["builtin_enet"]:
|
||||
env.ParseConfig("pkg-config libenet --cflags --libs")
|
||||
|
||||
@ -323,10 +306,6 @@ def configure(env):
|
||||
else:
|
||||
env["udev"] = False # Linux specific
|
||||
|
||||
# Linkflags below this line should typically stay the last ones
|
||||
if not env["builtin_zlib"]:
|
||||
env.ParseConfig("pkg-config zlib --cflags --libs")
|
||||
|
||||
env.Prepend(CPPPATH=["#platform/x11"])
|
||||
env.Append(CPPDEFINES=["X11_ENABLED", "UNIX_ENABLED", "OPENGL_ENABLED", "GLES_ENABLED", ("_FILE_OFFSET_BITS", 64)])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user