From f2623218641abe5e06fff5556729cce4b4d70791 Mon Sep 17 00:00:00 2001 From: Pentarctagon Date: Thu, 10 May 2018 18:50:28 -0500 Subject: [PATCH] Fix building with osx+cmake on travis. (cherry-picked from commit f5d74cd5ed0991ac02e3476e44ab1d615a6614a0) --- src/CMakeLists.txt | 36 +++++++++++++++++++++++++++++------ utils/travis/steps/install.sh | 3 ++- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 719a1e30315..7044786a85c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -285,8 +285,8 @@ add_library(wesnoth-game ${LIBRARY_TYPE} EXCLUDE_FROM_ALL ${libwesnoth-game_STAT if(ENABLE_GAME) add_executable(wesnoth WIN32 wesnoth.cpp) - target_link_libraries(wesnoth - -Wl,--start-group + if(NOT APPLE) + set(static-libs -Wl,--start-group wesnoth-client lua wesnoth-core @@ -294,7 +294,19 @@ if(ENABLE_GAME) wesnoth-sdl ${WIDGETS_LIB} wesnoth-client - -Wl,--end-group + -Wl,--end-group) + else() + set(static-libs wesnoth-client + lua + wesnoth-core + wesnoth-game + wesnoth-sdl + ${WIDGETS_LIB} + wesnoth-client) + endif(NOT APPLE) + + target_link_libraries(wesnoth + ${static-libs} ${game-external-libs} ) set_target_properties(wesnoth @@ -367,8 +379,8 @@ if(ENABLE_TESTS) add_executable(boost_unit_tests ${test_SRC}) - target_link_libraries(boost_unit_tests - -Wl,--start-group + if(NOT APPLE) + set(static-libs -Wl,--start-group wesnoth-client lua wesnoth-core @@ -376,7 +388,19 @@ if(ENABLE_TESTS) wesnoth-sdl ${WIDGETS_LIB} wesnoth-client - -Wl,--end-group + -Wl,--end-group) + else() + set(static-libs wesnoth-client + lua + wesnoth-core + wesnoth-game + wesnoth-sdl + ${WIDGETS_LIB} + wesnoth-client) + endif(NOT APPLE) + + target_link_libraries(boost_unit_tests + ${static-libs} ${game-external-libs} boost_unit_test_framework ) diff --git a/utils/travis/steps/install.sh b/utils/travis/steps/install.sh index 7b563e1413f..c632b0b0788 100755 --- a/utils/travis/steps/install.sh +++ b/utils/travis/steps/install.sh @@ -23,9 +23,10 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install ccache travis_wait ./projectfiles/Xcode/Fix_Xcode_Dependencies else - brew install scons cairo pango moreutils sdl2_image sdl2_ttf sdl2_mixer openssl glew + brew install scons cairo pango moreutils sdl2_image sdl2_ttf sdl2_mixer openssl glew ccache export CXXFLAGS="-I/usr/local/opt/openssl/include $CFLAGS" export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS" + export PATH="/usr/local/opt/openssl/include:$PATH" fi else if [ "$NLS" != "true" ]; then