diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ad70fc2d7..a86346ca33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -404,7 +404,7 @@ jobs: if: ${{matrix.run_tests}} macos-universal: name: macOS universal app bundle - runs-on: macos-14 + runs-on: macos-15 needs: [macos-cmake, build_variables] steps: - name: Checkout diff --git a/CMakeLists.txt b/CMakeLists.txt index c22e8412ae..0e8ffb0915 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,9 +142,9 @@ if (MACOS_USE_DEPENDENCIES) # if we're building on macOS, then we need the dependencies include(cmake/download.cmake) - set(MACOS_DYLIBS_VERSION "38") + set(MACOS_DYLIBS_VERSION "40") set(MACOS_DYLIBS_ZIPFILE "openrct2-libs-v${MACOS_DYLIBS_VERSION}-universal-macos-dylibs.zip") - set(MACOS_DYLIBS_SHA256 "900f298be7bf2b8469d0b9f1700f09a61ded3daafea32f599d58c88b6d7c9ce7") + set(MACOS_DYLIBS_SHA256 "dfbdf2a2bb09cdf52e77b2a4ed3889845bb0203ae4cb6be4f2a161ebacc9b02f") set(MACOS_DYLIBS_DIR "${ROOT_DIR}/lib/macos") set(MACOS_DYLIBS_URL "https://github.com/OpenRCT2/Dependencies/releases/download/v${MACOS_DYLIBS_VERSION}/${MACOS_DYLIBS_ZIPFILE}") diff --git a/scripts/create-macos-universal b/scripts/create-macos-universal index 185ccf6ff1..2a2545c8fd 100755 --- a/scripts/create-macos-universal +++ b/scripts/create-macos-universal @@ -19,9 +19,8 @@ lipo -create x64/OpenRCT2.app/Contents/MacOS/OpenRCT2 arm64/OpenRCT2.app/Content # copy frameworks mkdir OpenRCT2-universal.app/Contents/Frameworks -# with the exception of libopenrct2.dylib, the Frameworks are identical and are already universal dylibs -rsync -ah --exclude 'libopenrct2.dylib' x64/OpenRCT2.app/Contents/Frameworks/* OpenRCT2-universal.app/Contents/Frameworks -lipo -create x64/OpenRCT2.app/Contents/Frameworks/libopenrct2.dylib arm64/OpenRCT2.app/Contents/Frameworks/libopenrct2.dylib -output OpenRCT2-universal.app/Contents/Frameworks/libopenrct2.dylib +# the Frameworks are identical and are already universal dylibs +rsync -ah x64/OpenRCT2.app/Contents/Frameworks/* OpenRCT2-universal.app/Contents/Frameworks # handle Info.plist defaults import $PWD/OpenRCT2-universal.app/Contents/Info $PWD/x64/OpenRCT2.app/Contents/Info.plist $PWD/arm64/OpenRCT2.app/Contents/Info.plist diff --git a/src/openrct2/CMakeLists.txt b/src/openrct2/CMakeLists.txt index 6d4de005ec..5cbe194a0a 100644 --- a/src/openrct2/CMakeLists.txt +++ b/src/openrct2/CMakeLists.txt @@ -19,7 +19,16 @@ if (ENABLE_SCRIPTING) endif () endif () -add_library(libopenrct2 ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES}) +# On macOS the compiler computes typeids to different values in shared library and in the executable. +# This causes issues with RTTI and results in "bad any cast" exception getting thrown at runtime. +# It should be possible to expose relevant types with visibility default attribute, but we can make the whole issue go away by +# linking the library and executable statically. There is no openrct2-cli in macOS package, so no code gets duplicated. +# https://github.com/OpenRCT2/OpenRCT2/issues/24936 +set(LIBOPENRCT2_LINKAGE) +if (APPLE) + set(LIBOPENRCT2_LINKAGE STATIC) +endif() +add_library(libopenrct2 ${LIBOPENRCT2_LINKAGE} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES}) add_library(OpenRCT2::libopenrct2 ALIAS libopenrct2) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13") @@ -81,15 +90,15 @@ if (NOT DISABLE_TTF) if (UNIX AND NOT APPLE AND NOT MSVC) PKG_CHECK_MODULES(FONTCONFIG REQUIRED fontconfig) endif () - + if (MSVC) find_package(freetype REQUIRED) else () PKG_CHECK_MODULES(FREETYPE REQUIRED IMPORTED_TARGET freetype2) endif () - + target_include_directories(libopenrct2 SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS}) - + if (UNIX AND NOT APPLE) target_include_directories(libopenrct2 SYSTEM PRIVATE ${FONTCONFIG_INCLUDE_DIRS}) endif () @@ -193,9 +202,9 @@ if (NOT MINGW AND NOT MSVC AND NOT EMSCRIPTEN) endif () # For unicode code page conversion. find_package(ICU 59.0 REQUIRED COMPONENTS uc) - + target_include_directories(libopenrct2 SYSTEM PRIVATE ${ICU_INCLUDE_DIRS}) - + if (STATIC) target_link_libraries(libopenrct2 ${ICU_STATIC_LIBRARIES}) else () @@ -206,7 +215,7 @@ endif () if (NOT DISABLE_TTF) if (STATIC) target_link_libraries(libopenrct2 ${FREETYPE_STATIC_LIBRARIES}) - + if (UNIX AND NOT APPLE) target_link_libraries(libopenrct2 ${FONTCONFIG_STATIC_LIBRARIES}) endif () @@ -216,7 +225,7 @@ if (NOT DISABLE_TTF) else () target_link_libraries(libopenrct2 ${FREETYPE_LIBRARIES}) endif () - + if (UNIX AND NOT APPLE) target_link_libraries(libopenrct2 ${FONTCONFIG_LIBRARIES}) endif ()