1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Use macos-15-built libraries v40 (#24939)

* Use macos-15-built libraries v40

Windows version is the same as v38, no need to update

* Use macos-15 in CI

* Build libopenrct2 statically

* Skip creating universal libopenrct2.dylib as it no longer exists

* Force static linking on macOS
This commit is contained in:
Michał Janiszewski
2025-08-26 07:04:30 +02:00
committed by GitHub
parent be125fc9e1
commit 66665c8a81
4 changed files with 22 additions and 14 deletions

View File

@@ -404,7 +404,7 @@ jobs:
if: ${{matrix.run_tests}} if: ${{matrix.run_tests}}
macos-universal: macos-universal:
name: macOS universal app bundle name: macOS universal app bundle
runs-on: macos-14 runs-on: macos-15
needs: [macos-cmake, build_variables] needs: [macos-cmake, build_variables]
steps: steps:
- name: Checkout - name: Checkout

View File

@@ -142,9 +142,9 @@ if (MACOS_USE_DEPENDENCIES)
# if we're building on macOS, then we need the dependencies # if we're building on macOS, then we need the dependencies
include(cmake/download.cmake) 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_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_DIR "${ROOT_DIR}/lib/macos")
set(MACOS_DYLIBS_URL "https://github.com/OpenRCT2/Dependencies/releases/download/v${MACOS_DYLIBS_VERSION}/${MACOS_DYLIBS_ZIPFILE}") set(MACOS_DYLIBS_URL "https://github.com/OpenRCT2/Dependencies/releases/download/v${MACOS_DYLIBS_VERSION}/${MACOS_DYLIBS_ZIPFILE}")

View File

@@ -19,9 +19,8 @@ lipo -create x64/OpenRCT2.app/Contents/MacOS/OpenRCT2 arm64/OpenRCT2.app/Content
# copy frameworks # copy frameworks
mkdir OpenRCT2-universal.app/Contents/Frameworks mkdir OpenRCT2-universal.app/Contents/Frameworks
# with the exception of libopenrct2.dylib, the Frameworks are identical and are already universal dylibs # the Frameworks are identical and are already universal dylibs
rsync -ah --exclude 'libopenrct2.dylib' x64/OpenRCT2.app/Contents/Frameworks/* OpenRCT2-universal.app/Contents/Frameworks rsync -ah 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
# handle Info.plist # 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 defaults import $PWD/OpenRCT2-universal.app/Contents/Info $PWD/x64/OpenRCT2.app/Contents/Info.plist $PWD/arm64/OpenRCT2.app/Contents/Info.plist

View File

@@ -19,7 +19,16 @@ if (ENABLE_SCRIPTING)
endif () endif ()
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) add_library(OpenRCT2::libopenrct2 ALIAS libopenrct2)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13") 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) if (UNIX AND NOT APPLE AND NOT MSVC)
PKG_CHECK_MODULES(FONTCONFIG REQUIRED fontconfig) PKG_CHECK_MODULES(FONTCONFIG REQUIRED fontconfig)
endif () endif ()
if (MSVC) if (MSVC)
find_package(freetype REQUIRED) find_package(freetype REQUIRED)
else () else ()
PKG_CHECK_MODULES(FREETYPE REQUIRED IMPORTED_TARGET freetype2) PKG_CHECK_MODULES(FREETYPE REQUIRED IMPORTED_TARGET freetype2)
endif () endif ()
target_include_directories(libopenrct2 SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS}) target_include_directories(libopenrct2 SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS})
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
target_include_directories(libopenrct2 SYSTEM PRIVATE ${FONTCONFIG_INCLUDE_DIRS}) target_include_directories(libopenrct2 SYSTEM PRIVATE ${FONTCONFIG_INCLUDE_DIRS})
endif () endif ()
@@ -193,9 +202,9 @@ if (NOT MINGW AND NOT MSVC AND NOT EMSCRIPTEN)
endif () endif ()
# For unicode code page conversion. # For unicode code page conversion.
find_package(ICU 59.0 REQUIRED COMPONENTS uc) find_package(ICU 59.0 REQUIRED COMPONENTS uc)
target_include_directories(libopenrct2 SYSTEM PRIVATE ${ICU_INCLUDE_DIRS}) target_include_directories(libopenrct2 SYSTEM PRIVATE ${ICU_INCLUDE_DIRS})
if (STATIC) if (STATIC)
target_link_libraries(libopenrct2 ${ICU_STATIC_LIBRARIES}) target_link_libraries(libopenrct2 ${ICU_STATIC_LIBRARIES})
else () else ()
@@ -206,7 +215,7 @@ endif ()
if (NOT DISABLE_TTF) if (NOT DISABLE_TTF)
if (STATIC) if (STATIC)
target_link_libraries(libopenrct2 ${FREETYPE_STATIC_LIBRARIES}) target_link_libraries(libopenrct2 ${FREETYPE_STATIC_LIBRARIES})
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
target_link_libraries(libopenrct2 ${FONTCONFIG_STATIC_LIBRARIES}) target_link_libraries(libopenrct2 ${FONTCONFIG_STATIC_LIBRARIES})
endif () endif ()
@@ -216,7 +225,7 @@ if (NOT DISABLE_TTF)
else () else ()
target_link_libraries(libopenrct2 ${FREETYPE_LIBRARIES}) target_link_libraries(libopenrct2 ${FREETYPE_LIBRARIES})
endif () endif ()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
target_link_libraries(libopenrct2 ${FONTCONFIG_LIBRARIES}) target_link_libraries(libopenrct2 ${FONTCONFIG_LIBRARIES})
endif () endif ()