Skip to content

Commit 019fd0a

Browse files
committed
travis: Add builds for iOS device and simulator.
1 parent b741ff1 commit 019fd0a

File tree

2 files changed

+59
-27
lines changed

2 files changed

+59
-27
lines changed

.travis.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
11
language: cpp
2+
osx_image: xcode10.2
23

3-
os:
4-
- linux
5-
- osx
4+
matrix:
5+
include:
6+
- os: linux
7+
env: CMAKE_OPTIONS=""
8+
- os: osx
9+
env: CMAKE_OPTIONS=""
10+
- os: osx
11+
env: >-
12+
CMAKE_OPTIONS="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64"
13+
CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer
14+
CROSS_SDK=iPhoneOS.sdk
15+
- os: osx
16+
env: >-
17+
CMAKE_OPTIONS="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64"
18+
CROSS_TOP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer
19+
CROSS_SDK=iPhoneSimulator.sdk
20+
21+
install: if [[ $TRAVIS_OS_NAME == osx ]]; then brew upgrade cmake; fi
622

723
before_script:
824
- wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
@@ -13,5 +29,5 @@ before_script:
1329

1430
script:
1531
- mkdir build && cd build
16-
- cmake -DCMAKE_BUILD_TYPE=Release ..
32+
- cmake -DCMAKE_BUILD_TYPE=Release $CMAKE_OPTIONS ..
1733
- cmake --build . --config Release

CMakeLists.txt

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ elseif(BUILD_OPENSSL AND APPLE)
685685
endif()
686686

687687
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
688-
set(platform ios64-xcrun)
688+
set(platform ios64-cross)
689689
if(CMAKE_OSX_ARCHITECTURES STREQUAL x86_64)
690690

691691
set(platform iossimulator-xcrun)
@@ -695,8 +695,9 @@ elseif(BUILD_OPENSSL AND APPLE)
695695
URL https://www.openssl.org/source/openssl-1.1.1c.tar.gz
696696
URL_HASH SHA256=f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90
697697

698-
CONFIGURE_COMMAND /usr/bin/perl ./Configure ${platform} ${ssl_flags}
698+
CONFIGURE_COMMAND ./Configure ${platform} ${ssl_flags}
699699
--prefix=<INSTALL_DIR> --openssldir=<INSTALL_DIR>
700+
-Wno-nullability-completeness -Wno-expansion-to-defined
700701

701702
BUILD_COMMAND make build_libs
702703
BUILD_IN_SOURCE 1
@@ -850,27 +851,42 @@ endif()
850851

851852
if(BUILD_PYTHON)
852853
if(CMAKE_CROSSCOMPILING)
853-
ExternalProject_Add(
854-
python-x86
855-
GIT_REPOSITORY https://github.com/treamology/ppython-cmake-scripts
856-
857-
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target _freeze_importlib
858-
INSTALL_COMMAND cp <BINARY_DIR>/CMakeBuild/libpython/NativeExports.cmake ${THIRDPARTY_DIR}/python/NativeExports.cmake
859-
860-
)
861-
ExternalProject_Add(
862-
python
863-
DEPENDS python-x86
864-
GIT_REPOSITORY https://github.com/treamology/ppython-cmake-scripts
865-
866-
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
867-
-DPYTHON_VERSION=3.6.6 -DWITH_STATIC_DEPENDENCIES=ON
868-
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
869-
-DINSTALL_MANUAL=OFF -DINSTALL_TESTS=OFF
870-
-DIMPORT_NATIVE_EXECUTABLES=${THIRDPARTY_DIR}/python/NativeExports.cmake
871-
872-
INSTALL_DIR ${THIRDPARTY_DIR}/python
873-
)
854+
if(CMAKE_SYSTEM_NAME STREQUAL iOS)
855+
ExternalProject_Add(
856+
python
857+
GIT_REPOSITORY https://github.com/treamology/ppython-cmake-scripts
858+
859+
CONFIGURE_COMMAND ""
860+
BUILD_COMMAND <SOURCE_DIR>/build-ios.py --arch=${CMAKE_OSX_ARCHITECTURES}
861+
--install-dir=<INSTALL_DIR> --suppress-stdout
862+
INSTALL_COMMAND ""
863+
864+
BUILD_IN_SOURCE 1
865+
INSTALL_DIR ${THIRDPARTY_DIR}/python
866+
)
867+
else()
868+
ExternalProject_Add(
869+
python-x86
870+
GIT_REPOSITORY https://github.com/treamology/ppython-cmake-scripts
871+
872+
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target _freeze_importlib
873+
INSTALL_COMMAND cp <BINARY_DIR>/CMakeBuild/libpython/NativeExports.cmake ${THIRDPARTY_DIR}/python/NativeExports.cmake
874+
875+
)
876+
ExternalProject_Add(
877+
python
878+
DEPENDS python-x86
879+
GIT_REPOSITORY https://github.com/treamology/ppython-cmake-scripts
880+
881+
CMAKE_ARGS ${COMMON_CMAKE_ARGS}
882+
-DPYTHON_VERSION=3.6.6 -DWITH_STATIC_DEPENDENCIES=ON
883+
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
884+
-DINSTALL_MANUAL=OFF -DINSTALL_TESTS=OFF
885+
-DIMPORT_NATIVE_EXECUTABLES=${THIRDPARTY_DIR}/python/NativeExports.cmake
886+
887+
INSTALL_DIR ${THIRDPARTY_DIR}/python
888+
)
889+
endif()
874890
else()
875891
ExternalProject_Add(
876892
python

0 commit comments

Comments
 (0)