build: fix macOS build issues blocking app compilation

- engine: liboakengine.dylib intentionally leaves olive::k_app_version
  to the final executable (olive-version-obj); whitelist that symbol
  with -U on Apple, where undefined symbols in dylibs are an error
  (ELF allows them by default).
- app/common/configwrapper.h: only declare the int64_t/uint64_t
  conversion/assignment overloads on Linux LP64, where they differ
  from qint64/quint64; elsewhere both are long long and the extra
  overloads are redeclarations.
This commit is contained in:
2026-07-27 17:14:56 +08:00
parent c0dcd33de0
commit 18aed979a2
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -58,6 +58,10 @@ public:
{
return static_cast<quint64>(oakengine_config_get_int(key_utf8(), 0));
}
// int64_t/uint64_t overloads only exist where they differ from
// qint64/quint64 (Linux LP64: int64_t is long; on macOS/Windows both are
// long long, where declaring them would be a redeclaration).
#if defined(__linux__)
operator int64_t() const
{
return oakengine_config_get_int(key_utf8(), 0);
@@ -66,6 +70,7 @@ public:
{
return static_cast<uint64_t>(oakengine_config_get_int(key_utf8(), 0));
}
#endif
operator QString() const
{
char buf[1024];
@@ -103,6 +108,7 @@ public:
oakengine_config_set_int(key_utf8(), static_cast<int64_t>(v));
return *this;
}
#if defined(__linux__)
OakConfigValue &operator=(int64_t v)
{
oakengine_config_set_int(key_utf8(), v);
@@ -113,6 +119,7 @@ public:
oakengine_config_set_int(key_utf8(), static_cast<int64_t>(v));
return *this;
}
#endif
OakConfigValue &operator=(const QString &v)
{
const QByteArray utf8 = v.toUtf8();
+8
View File
@@ -114,6 +114,14 @@ if (UNIX AND NOT APPLE)
${CMAKE_CURRENT_SOURCE_DIR}/oakengine.ver)
endif ()
# olive::k_app_version is intentionally left undefined in the shared library
# and provided by the final executable via olive-version-obj (see
# worker/CMakeLists.txt). ELF allows undefined symbols in shared libraries by
# default; the macOS linker does not, so whitelist that one symbol.
if (APPLE)
target_link_options(oakengine PRIVATE "LINKER:-U,__ZN5olive13k_app_versionE")
endif ()
# Install into the platform's standard library directory (/usr/lib,
# /usr/lib64 or the Debian multiarch path); Windows DLLs go next to the
# executables in bin.