mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
macOS cmake CI fixes
Use ninja instead of make for faster builds Proper library linking of dependencies
This commit is contained in:
parent
f51fea47df
commit
9efe184538
4 changed files with 52 additions and 34 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
@ -156,15 +156,20 @@ jobs:
|
|||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Build OpenRCT2
|
||||
run: . scripts/setenv -q && build -DWITH_TESTS=on -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
run: |
|
||||
brew install ninja
|
||||
. scripts/setenv -q && build -DWITH_TESTS=on -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=on -DDISABLE_DISCORD_RPC=on
|
||||
- name: Run Tests
|
||||
shell: bash
|
||||
run: . scripts/setenv -q && run-tests
|
||||
- name: Build artifacts
|
||||
shell: bash
|
||||
run: . scripts/setenv -q && build-portable artifacts/OpenRCT2-MacOS-x64-cmake.tar.gz bin/install/usr
|
||||
- name: Upload artifacts (CI)
|
||||
uses: actions/upload-artifact@v2-preview
|
||||
with:
|
||||
name: "OpenRCT2-macOS-cmake"
|
||||
path: build/install/*
|
||||
path: artifacts
|
||||
|
||||
linux-portable:
|
||||
name: Linux (x64, portable)
|
||||
|
|
|
@ -33,22 +33,11 @@ else
|
|||
echo -e "\033[0;36mBuilding OpenRCT2...\033[0m"
|
||||
mkdir -p bin && cd bin
|
||||
export DESTDIR=install
|
||||
|
||||
# macOS runners do not have Ninja installed by default
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=./install "$@"
|
||||
else
|
||||
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"
|
||||
fi
|
||||
cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=/usr "$@"
|
||||
|
||||
if [[ "$TESTPAINT" == "true" ]]; then
|
||||
testpaint_target=testpaint
|
||||
fi
|
||||
|
||||
# macOS runners do not have Ninja installed by default
|
||||
if [[ $(uname) == "Darwin" ]]; then
|
||||
make install
|
||||
else
|
||||
ninja -k0 $testpaint_target all install
|
||||
fi
|
||||
ninja -k0 $testpaint_target all install
|
||||
fi
|
||||
|
|
|
@ -12,8 +12,8 @@ if (MSVC)
|
|||
find_package(SDL2 REQUIRED)
|
||||
find_library(SPEEX_LDFLAGS libspeexdsp)
|
||||
else ()
|
||||
PKG_CHECK_MODULES(SDL2 REQUIRED sdl2)
|
||||
PKG_CHECK_MODULES(SPEEX REQUIRED speexdsp)
|
||||
PKG_CHECK_MODULES(SDL2 REQUIRED IMPORTED_TARGET sdl2)
|
||||
PKG_CHECK_MODULES(SPEEX REQUIRED IMPORTED_TARGET speexdsp)
|
||||
endif ()
|
||||
|
||||
if (NOT DISABLE_OPENGL)
|
||||
|
@ -42,10 +42,15 @@ project(openrct2 CXX)
|
|||
add_executable(${PROJECT_NAME} ${OPENRCT2_UI_SOURCES} ${OPENRCT2_UI_MM_SOURCES})
|
||||
SET_CHECK_CXX_FLAGS(${PROJECT_NAME})
|
||||
ipo_set_target_properties(${PROJECT_NAME})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} "libopenrct2"
|
||||
${SDL2_LDFLAGS}
|
||||
${SPEEX_LDFLAGS})
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} "libopenrct2"
|
||||
PkgConfig::SDL2
|
||||
PkgConfig::SPEEX)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} "libopenrct2"
|
||||
${SDL2_LDFLAGS}
|
||||
${SPEEX_LDFLAGS})
|
||||
endif ()
|
||||
target_link_platform_libraries(${PROJECT_NAME})
|
||||
|
||||
if (NOT DISABLE_OPENGL)
|
||||
|
|
|
@ -19,6 +19,9 @@ if (APPLE)
|
|||
endif ()
|
||||
|
||||
add_library(${PROJECT_NAME} ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES})
|
||||
if (APPLE)
|
||||
target_link_platform_libraries(${PROJECT_NAME})
|
||||
endif ()
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
||||
SET_CHECK_CXX_FLAGS(${PROJECT_NAME})
|
||||
|
||||
|
@ -34,10 +37,11 @@ if (NOT DISABLE_NETWORK OR NOT DISABLE_HTTP)
|
|||
target_link_libraries(${PROJECT_NAME} bcrypt)
|
||||
else ()
|
||||
if (APPLE)
|
||||
# Needed for linking with non-broken OpenSSL on Apple platforms
|
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/openssl/lib/pkgconfig")
|
||||
if (NOT MACOS_USE_DEPENDENCIES)
|
||||
# Needed for linking with non-broken OpenSSL on Apple platforms
|
||||
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/openssl/lib/pkgconfig")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
find_package(OpenSSL 1.0.0 REQUIRED)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${OPENSSL_INCLUDE_DIR})
|
||||
|
@ -78,7 +82,7 @@ if (NOT DISABLE_TTF)
|
|||
if (MSVC)
|
||||
find_package(freetype REQUIRED)
|
||||
else ()
|
||||
PKG_CHECK_MODULES(FREETYPE REQUIRED freetype2)
|
||||
PKG_CHECK_MODULES(FREETYPE REQUIRED IMPORTED_TARGET freetype2)
|
||||
endif ()
|
||||
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${FREETYPE_INCLUDE_DIRS})
|
||||
|
@ -118,16 +122,16 @@ if (MSVC)
|
|||
find_path(LIBZIP_INCLUDE_DIRS zip.h)
|
||||
find_library(LIBZIP_LIBRARIES zip)
|
||||
else ()
|
||||
PKG_CHECK_MODULES(LIBZIP REQUIRED libzip>=1.0)
|
||||
PKG_CHECK_MODULES(ZLIB REQUIRED zlib)
|
||||
PKG_CHECK_MODULES(LIBZIP REQUIRED IMPORTED_TARGET libzip>=1.0)
|
||||
PKG_CHECK_MODULES(ZLIB REQUIRED IMPORTED_TARGET zlib)
|
||||
|
||||
PKG_CHECK_MODULES(PNG libpng>=1.6)
|
||||
PKG_CHECK_MODULES(PNG IMPORTED_TARGET libpng>=1.6)
|
||||
if (NOT PNG_FOUND)
|
||||
PKG_CHECK_MODULES(PNG libpng16)
|
||||
PKG_CHECK_MODULES(PNG IMPORTED_TARGET libpng16)
|
||||
if (NOT PNG_FOUND)
|
||||
PKG_CHECK_MODULES(PNG libpng>=1.2)
|
||||
PKG_CHECK_MODULES(PNG IMPORTED_TARGET libpng>=1.2)
|
||||
if (NOT PNG_FOUND)
|
||||
PKG_CHECK_MODULES(PNG REQUIRED libpng12)
|
||||
PKG_CHECK_MODULES(PNG REQUIRED IMPORTED_TARGET libpng12)
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
@ -139,10 +143,17 @@ if (STATIC)
|
|||
${ZLIB_STATIC_LIBRARIES}
|
||||
${LIBZIP_STATIC_LIBRARIES})
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PkgConfig::PNG
|
||||
PkgConfig::ZLIB
|
||||
PkgConfig::LIBZIP)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
${PNG_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${LIBZIP_LIBRARIES})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (MINGW)
|
||||
|
@ -176,13 +187,21 @@ endif ()
|
|||
|
||||
if (NOT DISABLE_TTF)
|
||||
if (STATIC)
|
||||
target_link_libraries(${PROJECT_NAME} ${FREETYPE_STATIC_LIBRARIES})
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} PkgConfig::FREETYPE_STATIC)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} ${FREETYPE_STATIC_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} ${FONTCONFIG_STATIC_LIBRARIES})
|
||||
endif ()
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} ${FREETYPE_LIBRARIES})
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(${PROJECT_NAME} PkgConfig::FREETYPE)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} ${FREETYPE_LIBRARIES})
|
||||
endif ()
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
target_link_libraries(${PROJECT_NAME} ${FONTCONFIG_LIBRARIES})
|
||||
|
|
Loading…
Reference in a new issue