Skip to content

Commit fbbb200

Browse files
authored
Merge branch 'master' into find-root-path-mode
2 parents 9542309 + a177e3c commit fbbb200

File tree

7 files changed

+442
-180
lines changed

7 files changed

+442
-180
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Project specific
2-
build/
32
.DS_Store
43

54
# Xcode
@@ -25,6 +24,7 @@ xcuserdata/
2524
*.moved-aside
2625
*.xccheckout
2726
*.xcscmblueprint
27+
.idea/
2828

2929
## Obj-C/Swift specific
3030
*.hmap

.travis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,61 @@ matrix:
44
fast_finish: true
55
include:
66
- os: osx
7+
osx_image: xcode10.2
78
compiler: clang
89
env:
910
- IOS_PLATFORM=SIMULATOR
1011
- BUILD_SHARED=0
12+
- USE_XCODE=0
1113
- os: osx
14+
osx_image: xcode10.2
1215
compiler: clang
1316
env:
1417
- IOS_PLATFORM=SIMULATOR64
1518
- BUILD_SHARED=0
19+
- USE_XCODE=0
1620
- os: osx
21+
osx_image: xcode10.2
1722
compiler: clang
1823
env:
1924
- IOS_PLATFORM=OS
2025
- BUILD_SHARED=0
26+
- USE_XCODE=0
2127
- os: osx
28+
osx_image: xcode10.2
29+
compiler: clang
30+
env:
31+
- IOS_PLATFORM=OS64
32+
- BUILD_SHARED=0
33+
- USE_XCODE=0
34+
- os: osx
35+
osx_image: xcode10.2
2236
compiler: clang
2337
env:
2438
- IOS_PLATFORM=OS
2539
- BUILD_SHARED=1
40+
- USE_XCODE=0
41+
- os: osx
42+
osx_image: xcode10.2
43+
compiler: clang
44+
env:
45+
- IOS_PLATFORM=TVOS
46+
- BUILD_SHARED=0
47+
- USE_XCODE=0
48+
- os: osx
49+
osx_image: xcode10.2
50+
compiler: clang
51+
env:
52+
- IOS_PLATFORM=WATCHOS
53+
- BUILD_SHARED=0
54+
- USE_XCODE=0
55+
- os: osx
56+
osx_image: xcode10.2
57+
compiler: clang
58+
env:
59+
- IOS_PLATFORM=OS64COMBINED
60+
- BUILD_SHARED=0
61+
- USE_XCODE=1
2662

2763
install: true
2864

.travis/build.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ if [[ $BUILD_SHARED -eq 1 ]]; then
88
SHARED_EXT="-DBUILD_SHARED=1 -DENABLE_VISIBILITY=1"
99
fi
1010

11+
GENERATOR_EXT=""
12+
if [[ $USE_XCODE -eq 1 ]]; then
13+
GENERATOR_EXT="-G Xcode"
14+
fi
15+
1116
cmake .. \
12-
-DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake \
13-
-DIOS_PLATFORM=$IOS_PLATFORM $SHARED_EXT\
17+
$GENERATOR_EXT -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake \
18+
-DPLATFORM=$IOS_PLATFORM $SHARED_EXT\
1419
|| exit 1
15-
make -j2 || exit 1
16-
make install || exit 1
20+
cmake --build . --config Release --target install || exit 1

README.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
A CMake toolchain file for iOS and tvOS development
1+
A CMake toolchain file for iOS, watchOS and tvOS development with full simulator support and toggable options!
2+
3+
### NEW!
4+
* The toolchain now supports the new features introduced in CMake 3.14 that allows combined (FAT libraries) to be built.
5+
* Please see below for the "COMBINED" options that will build a static, combined FAT library by default.
6+
* The `IOS_PLATFORM` argument have been renamed to `PLATFORM` to better align with how the toolchain will be used.
7+
* `IOS_PLATFORM` argument still exists, but is deprecated.
8+
* MUCH better support for Xcode generated project on CMake 3.14+
29

310
ios-cmake
411
=========
@@ -10,28 +17,41 @@ Tested with the following combinations:
1017
* XCode 6.1.x, iOS SDK 8.1
1118
* XCode 8.2.x, iOS SDK 10.2
1219
* XCode 9.4.x, iOS SDK 11.4
20+
* XCode 10.2.x, iOS SDK 12.2
1321

1422
# Example usage
15-
**NOTE: The below commands will build for 64-bit simulator only. Change the `-DIOS_PLATFORM` to the applicable value if targeting another platform.**
23+
**NOTE: The below commands will build for 64-bit simulator only. Change the `-DPLATFORM` to the applicable value if targeting another platform.**
1624

1725
```bash
1826
cd example/example-lib
1927
mkdir build
2028
cd build
21-
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DIOS_PLATFORM=SIMULATOR64
22-
make
23-
make install
29+
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=OS64COMBINED
30+
cmake --build . --config Release --target install
2431
```
2532

2633
This will build and install the library for the given IOS_PLATFORM.
2734

2835
## Options
2936

30-
* Set `-DIOS_PLATFORM` to "SIMULATOR" to build for iOS simulator 32 bit (i386)
31-
* Set `-DIOS_PLATFORM` to "SIMULATOR64" (example above) to build for iOS simulator 64 bit (x86_64)
32-
* Set `-DIOS_PLATFORM` to "OS" to build for Device (armv7, armv7s, arm64)
33-
* Set `-DIOS_PLATFORM` to "TVOS" to build for tvOS (arm64)
34-
* Set `-DIOS_PLATFORM` to "SIMULATOR_TVOS" to build for tvOS Simulator (x86_64)
37+
* Set `-DPLATFORM` to "SIMULATOR" to build for iOS simulator 32 bit (i386) **DEPRECATED**
38+
* Set `-DPLATFORM` to "SIMULATOR64" (example above) to build for iOS simulator 64 bit (x86_64)
39+
* Set `-DPLATFORM` to "OS" to build for Device (armv7, armv7s, arm64)
40+
* Set `-DPLATFORM` to "OS64" to build for Device (arm64)
41+
* Set `-DPLATFORM` to "OS64COMBINED" to build for Device & Simulator (FAT lib) (arm64, x86_64)
42+
* Set `-DPLATFORM` to "TVOS" to build for tvOS (arm64)
43+
* Set `-DPLATFORM` to "TVOSCOMBINED" to build for tvOS & Simulator (arm64, x86_64)
44+
* Set `-DPLATFORM` to "SIMULATOR_TVOS" to build for tvOS Simulator (x86_64)
45+
* Set `-DPLATFORM` to "WATCHOS" to build for watchOS (armv7k, arm64_32)
46+
* Set `-DPLATFORM` to "WATCHOSCOMBINED" to build for watchOS & Simulator (armv7k, arm64_32, i386)
47+
* Set `-DPLATFORM` to "SIMULATOR_WATCHOS" to build for watchOS Simulator (i386)
48+
49+
### COMBINED options
50+
The options called *COMBINED (OS64COMBINED, TVOSCOMBINED and WATCHOSCOMBINED) will build complete FAT-libraries for
51+
the given platform. These FAT-libraries include slices for both device and simulator, making the distribution and
52+
usage of the library much more simple!
53+
54+
**NOTE: The COMBINED options _ONLY_ work with the Xcode generator (-G Xcode).**
3555

3656
### Additional Options
3757
`-DENABLE_BITCODE=(BOOL)` - Enabled by default, specify FALSE or 0 to disable bitcode
@@ -40,13 +60,16 @@ This will build and install the library for the given IOS_PLATFORM.
4060

4161
`-DENABLE_VISIBILITY=(BOOL)` - Disabled by default, specify TRUE or 1 to enable symbol visibility support
4262

43-
`-DIOS_ARCH=(STRING)` - Valid values are: armv7, armv7s, arm64, i386, x86_64. By default it will build for all valid architectures based on `-DIOS_PLATFORM` (see above)
63+
`-DIOS_ARCH=(STRING)` - Valid values are: armv7, armv7s, arm64, i386, x86_64, armv7k, arm64_32. By default it will build for all valid architectures based on `-DPLATFORM` (see above)
4464

45-
__*The resulting binary will consist of only one platform. To combine all platforms into the same fat-library, use the LIPO tool. More information on this is available on the net.*__
65+
__*To combine all platforms into the same FAT-library, either build any of the "*COMBINED*" platform types OR use the
66+
LIPO tool. More information on how to combine libraries with LIPO is readily available on the net.*__
4667

4768
## Thanks To
4869

4970
* [natbro](https://github.com/natbro) for adding tvOS support
71+
* [MSNexploder](https://github.com/MSNexploder) for adding OS64 and arm64e support
72+
* [garryyan](https://github.com/garryyan) for adding watchOS support
5073

5174
## Notes
5275

207 KB
Binary file not shown.

example/example-lib/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ cmake_minimum_required (VERSION 3.2)
22
project (example-ios C CXX)
33

44
# Includes
5-
include_directories (${example-ios_SOURCE_DIR})
5+
include_directories(${example-ios_SOURCE_DIR})
66

77
# Source files
8-
set (SOURCES
8+
set(SOURCES
99
HelloWorld.cpp
1010
HelloWorldIOS.mm
1111
)
1212

1313
# Headers
14-
set (HEADERS
14+
set(HEADERS
1515
HelloWorld.hpp
1616
HelloWorldIOS.h
1717
)
1818

1919
# Library
20-
if (BUILD_SHARED)
20+
if(BUILD_SHARED)
2121
add_library (example SHARED ${SOURCES} ${HEADERS})
2222
message(STATUS "Building shared version...")
2323
else()
@@ -26,15 +26,15 @@ else()
2626
endif()
2727

2828
# Executable
29-
add_executable (helloworld main.cpp)
29+
#add_executable (helloworld main.cpp)
3030

3131
# Link the library with the executable
32-
target_link_libraries(helloworld example)
32+
#target_link_libraries(helloworld example)
3333

3434
# Debug symbols set in XCode project
35-
set_xcode_property (example GCC_GENERATE_DEBUGGING_SYMBOLS YES "All")
35+
set_xcode_property(example GCC_GENERATE_DEBUGGING_SYMBOLS YES "All")
3636

3737
# Installation
38-
set (CMAKE_INSTALL_PREFIX "${example-ios_SOURCE_DIR}/../example-app/example-lib")
39-
install (TARGETS example helloworld DESTINATION lib)
38+
set(CMAKE_INSTALL_PREFIX "${example-ios_SOURCE_DIR}/../example-app/example-lib")
39+
install (TARGETS example DESTINATION lib)
4040
install (FILES ${HEADERS} DESTINATION include)

0 commit comments

Comments
 (0)