From e2fc0acd36df57779ad2d914cac9b2f1848255cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 16 Feb 2023 12:15:16 +0100 Subject: Fix includes of thirdparty libs which can be unbundled on Linux Changes `builtin_icu` and `builtin_recast` to match the folder names in `thirdparty`. --- SConstruct | 4 +-- modules/basis_universal/SCsub | 3 ++ modules/navigation/SCsub | 2 +- modules/ogg/ogg_packet_sequence.h | 5 ++- modules/text_server_adv/SCsub | 5 ++- modules/vorbis/audio_stream_ogg_vorbis.cpp | 3 +- modules/vorbis/audio_stream_ogg_vorbis.h | 3 +- modules/vorbis/resource_importer_ogg_vorbis.cpp | 5 +-- platform/linuxbsd/detect.py | 37 +++++++++++++--------- thirdparty/basis_universal/encoder/basisu_comp.cpp | 2 +- .../transcoder/basisu_transcoder.cpp | 2 +- 11 files changed, 41 insertions(+), 30 deletions(-) diff --git a/SConstruct b/SConstruct index 845b9be4a6..0536cab14b 100644 --- a/SConstruct +++ b/SConstruct @@ -217,7 +217,7 @@ opts.Add(BoolVariable("builtin_msdfgen", "Use the built-in MSDFgen library", Tru opts.Add(BoolVariable("builtin_glslang", "Use the built-in glslang library", True)) opts.Add(BoolVariable("builtin_graphite", "Use the built-in Graphite library", True)) opts.Add(BoolVariable("builtin_harfbuzz", "Use the built-in HarfBuzz library", True)) -opts.Add(BoolVariable("builtin_icu", "Use the built-in ICU library", True)) +opts.Add(BoolVariable("builtin_icu4c", "Use the built-in ICU library", True)) opts.Add(BoolVariable("builtin_libogg", "Use the built-in libogg library", True)) opts.Add(BoolVariable("builtin_libpng", "Use the built-in libpng library", True)) opts.Add(BoolVariable("builtin_libtheora", "Use the built-in libtheora library", True)) @@ -228,7 +228,7 @@ opts.Add(BoolVariable("builtin_mbedtls", "Use the built-in mbedTLS library", Tru opts.Add(BoolVariable("builtin_miniupnpc", "Use the built-in miniupnpc 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_recast", "Use the built-in Recast library", True)) +opts.Add(BoolVariable("builtin_recastnavigation", "Use the built-in Recast navigation library", True)) opts.Add(BoolVariable("builtin_rvo2", "Use the built-in RVO2 library", True)) opts.Add(BoolVariable("builtin_squish", "Use the built-in squish library", True)) opts.Add(BoolVariable("builtin_xatlas", "Use the built-in xatlas library", True)) diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub index 161b0f3814..14669847bc 100644 --- a/modules/basis_universal/SCsub +++ b/modules/basis_universal/SCsub @@ -40,6 +40,9 @@ if not env.msvc: else: env_basisu.Prepend(CPPPATH=[thirdparty_dir]) +if env["builtin_zstd"]: + env_basisu.Prepend(CPPPATH=["#thirdparty/zstd"]) + if env.dev_build: env_basisu.Append(CPPDEFINES=[("BASISU_DEVEL_MESSAGES", 1), ("BASISD_ENABLE_DEBUG_FLAGS", 1)]) diff --git a/modules/navigation/SCsub b/modules/navigation/SCsub index 0b0822db2d..a9277657f4 100644 --- a/modules/navigation/SCsub +++ b/modules/navigation/SCsub @@ -10,7 +10,7 @@ env_navigation = env_modules.Clone() thirdparty_obj = [] # Recast Thirdparty source files -if env["builtin_recast"]: +if env["builtin_recastnavigation"]: thirdparty_dir = "#thirdparty/recastnavigation/Recast/" thirdparty_sources = [ "Source/Recast.cpp", diff --git a/modules/ogg/ogg_packet_sequence.h b/modules/ogg/ogg_packet_sequence.h index 4aa5ffa254..7085504500 100644 --- a/modules/ogg/ogg_packet_sequence.h +++ b/modules/ogg/ogg_packet_sequence.h @@ -32,11 +32,10 @@ #define OGG_PACKET_SEQUENCE_H #include "core/io/resource.h" -#include "core/object/gdvirtual.gen.inc" -#include "core/variant/native_ptr.h" #include "core/variant/typed_array.h" #include "core/variant/variant.h" -#include "thirdparty/libogg/ogg/ogg.h" + +#include class OggPacketSequencePlayback; diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub index 4a9c7b3567..b7b7dccdb0 100644 --- a/modules/text_server_adv/SCsub +++ b/modules/text_server_adv/SCsub @@ -7,7 +7,6 @@ env_text_server_adv = env_modules.Clone() def make_icu_data(target, source, env): - dst = target[0].srcnode().abspath g = open(dst, "w", encoding="utf-8") @@ -126,7 +125,7 @@ if env["builtin_harfbuzz"]: env_harfbuzz.Prepend(CPPPATH=["#thirdparty/harfbuzz/src"]) env_harfbuzz.Append(CCFLAGS=["-DHAVE_ICU"]) - if env["builtin_icu"]: + if env["builtin_icu4c"]: env_harfbuzz.Prepend(CPPPATH=["#thirdparty/icu4c/common/", "#thirdparty/icu4c/i18n/"]) env_harfbuzz.Append(CCFLAGS=["-DU_HAVE_LIB_SUFFIX=1", "-DU_LIB_SUFFIX_C_NAME=_godot", "-DHAVE_ICU_BUILTIN"]) @@ -240,7 +239,7 @@ if env["builtin_graphite"] and freetype_enabled and env["graphite"]: env.Append(LIBS=[lib]) -if env["builtin_icu"]: +if env["builtin_icu4c"]: env_icu = env_modules.Clone() env_icu.disable_warnings() diff --git a/modules/vorbis/audio_stream_ogg_vorbis.cpp b/modules/vorbis/audio_stream_ogg_vorbis.cpp index f3ae35ce42..fcd717cfec 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/vorbis/audio_stream_ogg_vorbis.cpp @@ -32,7 +32,8 @@ #include "core/io/file_access.h" #include "core/variant/typed_array.h" -#include "thirdparty/libogg/ogg/ogg.h" + +#include int AudioStreamPlaybackOggVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) { ERR_FAIL_COND_V(!ready, 0); diff --git a/modules/vorbis/audio_stream_ogg_vorbis.h b/modules/vorbis/audio_stream_ogg_vorbis.h index ad6746eae2..c76df7f84d 100644 --- a/modules/vorbis/audio_stream_ogg_vorbis.h +++ b/modules/vorbis/audio_stream_ogg_vorbis.h @@ -34,7 +34,8 @@ #include "core/variant/variant.h" #include "modules/ogg/ogg_packet_sequence.h" #include "servers/audio/audio_stream.h" -#include "thirdparty/libvorbis/vorbis/codec.h" + +#include class AudioStreamOggVorbis; diff --git a/modules/vorbis/resource_importer_ogg_vorbis.cpp b/modules/vorbis/resource_importer_ogg_vorbis.cpp index b712d63030..9e280de0ca 100644 --- a/modules/vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/vorbis/resource_importer_ogg_vorbis.cpp @@ -33,8 +33,9 @@ #include "core/io/file_access.h" #include "core/io/resource_saver.h" #include "scene/resources/texture.h" -#include "thirdparty/libogg/ogg/ogg.h" -#include "thirdparty/libvorbis/vorbis/codec.h" + +#include +#include #ifdef TOOLS_ENABLED #include "editor/import/audio_stream_import_settings.h" diff --git a/platform/linuxbsd/detect.py b/platform/linuxbsd/detect.py index bae5a98aee..09a257d995 100644 --- a/platform/linuxbsd/detect.py +++ b/platform/linuxbsd/detect.py @@ -190,19 +190,21 @@ def configure(env: "Environment"): # 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"] - or env["builtin_graphite"] - or env["builtin_harfbuzz"] - ): - env["builtin_freetype"] = True - env["builtin_libpng"] = True - env["builtin_zlib"] = True - env["builtin_graphite"] = True - env["builtin_harfbuzz"] = True + # as shared libraries leads to weird issues. And graphite and harfbuzz need freetype. + ft_linked_deps = [ + env["builtin_freetype"], + env["builtin_libpng"], + env["builtin_zlib"], + env["builtin_graphite"], + env["builtin_harfbuzz"], + ] + if (not all(ft_linked_deps)) and any(ft_linked_deps): # All or nothing. + print( + "These libraries should be either all builtin, or all system provided:\n" + "freetype, libpng, zlib, graphite, harfbuzz.\n" + "Please specify `builtin_=no` for all of them, or none." + ) + sys.exit() if not env["builtin_freetype"]: env.ParseConfig("pkg-config freetype2 --cflags --libs") @@ -210,8 +212,8 @@ def configure(env: "Environment"): if not env["builtin_graphite"]: env.ParseConfig("pkg-config graphite2 --cflags --libs") - if not env["builtin_icu"]: - env.ParseConfig("pkg-config icu-uc --cflags --libs") + if not env["builtin_icu4c"]: + env.ParseConfig("pkg-config icu-i18n icu-uc --cflags --libs") if not env["builtin_harfbuzz"]: env.ParseConfig("pkg-config harfbuzz harfbuzz-icu --cflags --libs") @@ -266,6 +268,11 @@ def configure(env: "Environment"): if not env["builtin_pcre2"]: env.ParseConfig("pkg-config libpcre2-32 --cflags --libs") + if not env["builtin_recastnavigation"]: + # No pkgconfig file so far, hardcode default paths. + env.Prepend(CPPPATH=["/usr/include/recastnavigation"]) + env.Append(LIBS=["Recast"]) + if not env["builtin_embree"]: # No pkgconfig file so far, hardcode expected lib name. env.Append(LIBS=["embree3"]) diff --git a/thirdparty/basis_universal/encoder/basisu_comp.cpp b/thirdparty/basis_universal/encoder/basisu_comp.cpp index 41eae2b78a..4e69e9e2ee 100644 --- a/thirdparty/basis_universal/encoder/basisu_comp.cpp +++ b/thirdparty/basis_universal/encoder/basisu_comp.cpp @@ -28,7 +28,7 @@ #endif #if BASISD_SUPPORT_KTX2_ZSTD -#include "../zstd/zstd.h" +#include #endif // Set to 1 to disable the mipPadding alignment workaround (which only seems to be needed when no key-values are written at all) diff --git a/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp b/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp index 3aeba0ee7a..c698861f3b 100644 --- a/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp +++ b/thirdparty/basis_universal/transcoder/basisu_transcoder.cpp @@ -155,7 +155,7 @@ // If BASISD_SUPPORT_KTX2_ZSTD is 0, UASTC files compressed with Zstd cannot be loaded. #if BASISD_SUPPORT_KTX2_ZSTD // We only use two Zstd API's: ZSTD_decompress() and ZSTD_isError() - #include "../zstd/zstd.h" + #include #endif #endif -- cgit v1.2.3