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.
This commit is contained in:
Maarten Bent
2020-06-18 20:27:00 +02:00
parent 21e92cbcf1
commit e4437c4974
3 changed files with 26 additions and 12 deletions

View File

@@ -49,6 +49,10 @@ matrix:
osx_image: xcode11.4 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 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 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 - dist: bionic
compiler: gcc compiler: gcc
env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1 env: wxCONFIGURE_FLAGS="--with-x11 --enable-pch --disable-stc" wxSKIP_SAMPLES=1

View File

@@ -543,17 +543,23 @@ endif()
set(wxBUILD_PRECOMP_PREV ${wxBUILD_PRECOMP} CACHE INTERNAL "") set(wxBUILD_PRECOMP_PREV ${wxBUILD_PRECOMP} CACHE INTERNAL "")
if(wxBUILD_PRECOMP) 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) if (CLEAN_PRECOMP_TEST)
try_compile(RESULT_VAR_CLEAN try_compile(RESULT_VAR_CLEAN
"${wxBINARY_DIR}/CMakeFiles/cotire_test" "${wxBINARY_DIR}/CMakeFiles/cotire_test"
"${wxSOURCE_DIR}/build/cmake/modules/cotire_test" "${wxSOURCE_DIR}/build/cmake/modules/cotire_test"
CotireExample clean_cotire CotireExample clean_cotire
CMAKE_FLAGS ${try_flags}
) )
endif() endif()
try_compile(RESULT_VAR try_compile(RESULT_VAR
"${wxBINARY_DIR}/CMakeFiles/cotire_test" "${wxBINARY_DIR}/CMakeFiles/cotire_test"
"${wxSOURCE_DIR}/build/cmake/modules/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 # check if output has precompiled header warnings. The build can still succeed, so check the output

View File

@@ -11,6 +11,7 @@ wxBUILD_ARGS="-j$wxPROC_COUNT"
case $wxTOOLSET in case $wxTOOLSET in
cmake) cmake)
if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi if [ -z $wxCMAKE_TESTS ]; then wxCMAKE_TESTS=CONSOLE_ONLY; fi
if [ -z $wxCMAKE_SAMPLES ]; then wxCMAKE_SAMPLES=SOME; fi
if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then if [ "$wxCMAKE_GENERATOR" == "Xcode" ]; then
wxBUILD_ARGS="-jobs $wxPROC_COUNT -quiet" wxBUILD_ARGS="-jobs $wxPROC_COUNT -quiet"
fi fi
@@ -20,13 +21,22 @@ case $wxTOOLSET in
echo 'Configuring...' echo 'Configuring...'
mkdir build_cmake mkdir build_cmake
pushd 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:end:configure'
echo 'travis_fold:start:building' if [ "$wxCMAKE_GENERATOR" != "Xcode" ]; then
echo 'Building...' echo 'travis_fold:start:building'
cmake --build . -- $wxBUILD_ARGS echo 'Building...'
echo 'travis_fold:end: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 if [ "$wxCMAKE_TESTS" != "OFF" ]; then
echo 'travis_fold:start:testing' echo 'travis_fold:start:testing'
@@ -35,12 +45,6 @@ case $wxTOOLSET in
echo 'travis_fold:end:testing' echo 'travis_fold:end:testing'
fi 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 'travis_fold:start:testinstall'
echo 'Testing installation...' echo 'Testing installation...'
mkdir build_cmake_install_test mkdir build_cmake_install_test