From e4437c49749bf2a30b9f639a85061eea99df6aa7 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Thu, 18 Jun 2020 20:27:00 +0200 Subject: [PATCH] Add iOS CMake build to Travis CI Use the following CMake flags: -DCMAKE_SYSTEM_NAME=iOS - for specifying it is an iOS build -DCMAKE_FIND_ROOT_PATH=/usr/local - dir to search for the built wxWidgets libraries -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO - don't require signing app packages -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 - specify a target so both the libraries and sample will use the same architecture Also use the code signing flag when testing precompiled header support. Don't build the default samples, widgets sample has features that are not supported by the iOS build. Xcode seems to rebuild the libraries when installing, so call CMake only once. --- .travis.yml | 4 ++++ build/cmake/init.cmake | 8 +++++++- build/tools/travis-ci.sh | 26 +++++++++++++++----------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index c687031cc6..50e8e80fcd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,6 +49,10 @@ matrix: osx_image: xcode11.4 env: wxCONFIGURE_FLAGS="--enable-monolithic --with-cxx=17 --host=i686-apple-darwin_sim --build=x86_64-apple-darwin17.7.0 --with-osx_iphone --with-macosx-version-min=10.0 --with-macosx-sdk=$(xcrun --sdk iphonesimulator --show-sdk-path) --enable-stl --disable-sys-libs" wxSKIP_GUI=1 wxSKIP_TESTING=1 wxSKIP_SAMPLES=1 name: wxOSX iOS Xcode 11.4 + - os: osx + osx_image: xcode11.4 + env: wxTOOLSET=cmake wxCMAKE_GENERATOR=Xcode wxCMAKE_DEFINES="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_FIND_ROOT_PATH=/usr/local -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12" wxCMAKE_SAMPLES=OFF wxCMAKE_TESTS=OFF + name: wxOSX iOS CMake Xcode 11.4 - dist: bionic compiler: gcc env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1 diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 27ef13cacc..4524bc70e6 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -543,17 +543,23 @@ endif() set(wxBUILD_PRECOMP_PREV ${wxBUILD_PRECOMP} CACHE INTERNAL "") if(wxBUILD_PRECOMP) + if(DEFINED CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED) + set(try_flags "-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=${CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED}") + endif() if (CLEAN_PRECOMP_TEST) try_compile(RESULT_VAR_CLEAN "${wxBINARY_DIR}/CMakeFiles/cotire_test" "${wxSOURCE_DIR}/build/cmake/modules/cotire_test" CotireExample clean_cotire + CMAKE_FLAGS ${try_flags} ) endif() try_compile(RESULT_VAR "${wxBINARY_DIR}/CMakeFiles/cotire_test" "${wxSOURCE_DIR}/build/cmake/modules/cotire_test" - CotireExample OUTPUT_VARIABLE OUTPUT_VAR + CotireExample + CMAKE_FLAGS ${try_flags} + OUTPUT_VARIABLE OUTPUT_VAR ) # check if output has precompiled header warnings. The build can still succeed, so check the output diff --git a/build/tools/travis-ci.sh b/build/tools/travis-ci.sh index 411c8d9cb8..c618b08bbb 100755 --- a/build/tools/travis-ci.sh +++ b/build/tools/travis-ci.sh @@ -11,6 +11,7 @@ wxBUILD_ARGS="-j$wxPROC_COUNT" case $wxTOOLSET in cmake) if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi + if [ -z $wxCMAKE_SAMPLES ]; then wxCMAKE_SAMPLES=SOME; fi if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then wxBUILD_ARGS="-jobs $wxPROC_COUNT -quiet" fi @@ -20,13 +21,22 @@ case $wxTOOLSET in echo 'Configuring...' mkdir build_cmake pushd build_cmake - cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES -D wxBUILD_SAMPLES=SOME -D wxBUILD_TESTS=$wxCMAKE_TESTS .. + cmake -G "$wxCMAKE_GENERATOR" $wxCMAKE_DEFINES -D wxBUILD_SAMPLES=$wxCMAKE_SAMPLES -D wxBUILD_TESTS=$wxCMAKE_TESTS .. echo 'travis_fold:end:configure' - echo 'travis_fold:start:building' - echo 'Building...' - cmake --build . -- $wxBUILD_ARGS - echo 'travis_fold:end:building' + if [ "$wxCMAKE_GENERATOR" != "Xcode" ]; then + echo 'travis_fold:start:building' + echo 'Building...' + cmake --build . -- $wxBUILD_ARGS + echo 'travis_fold:end:building' + fi + + echo 'travis_fold:start:install' + if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then echo -n 'Building and '; fi + echo 'Installing...' + sudo env "PATH=$PATH" cmake --build . --target install -- $wxBUILD_ARGS + popd + echo 'travis_fold:end:install' if [ "$wxCMAKE_TESTS" != "OFF" ]; then echo 'travis_fold:start:testing' @@ -35,12 +45,6 @@ case $wxTOOLSET in echo 'travis_fold:end:testing' fi - echo 'travis_fold:start:install' - echo 'Installing...' - sudo env "PATH=$PATH" cmake --build . --target install -- $wxBUILD_ARGS - popd - echo 'travis_fold:end:install' - echo 'travis_fold:start:testinstall' echo 'Testing installation...' mkdir build_cmake_install_test