Skip to content

Commit 46d970e

Browse files
committedOct 9, 2018
add watchOS(armv7k;arm64_32) and watchOS Simulator(i386) support
1 parent 80cc159 commit 46d970e

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed
 

‎README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ This will build and install the library for the given IOS_PLATFORM.
3434
* Set `-DIOS_PLATFORM` to "OS64" to build for Device (arm64 only)
3535
* Set `-DIOS_PLATFORM` to "TVOS" to build for tvOS (arm64)
3636
* Set `-DIOS_PLATFORM` to "SIMULATOR_TVOS" to build for tvOS Simulator (x86_64)
37+
* Set `-DIOS_PLATFORM` to "WATCHOS" to build for watchOS (armv7k)
38+
* Set `-DIOS_PLATFORM` to "SIMULATOR_WATCHOS" to build for watchOS Simulator (i386)
3739

3840
### Additional Options
3941
`-DENABLE_BITCODE=(BOOL)` - Enabled by default, specify FALSE or 0 to disable bitcode
@@ -42,7 +44,7 @@ This will build and install the library for the given IOS_PLATFORM.
4244

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

45-
`-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)
47+
`-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 `-DIOS_PLATFORM` (see above)
4648

4749
__*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.*__
4850

‎ios.toolchain.cmake

+23-1
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@
5151
#
5252
# The following variables control the behaviour of this toolchain:
5353
#
54-
# IOS_PLATFORM: OS (default) or SIMULATOR or SIMULATOR64 or TVOS or SIMULATOR_TVOS
54+
# IOS_PLATFORM: OS (default) or SIMULATOR or SIMULATOR64 or TVOS or SIMULATOR_TVOS or WATCHOS
5555
# OS = Build for iPhoneOS.
5656
# SIMULATOR = Build for x86 i386 iPhone Simulator.
5757
# SIMULATOR64 = Build for x86_64 iPhone Simulator.
5858
# TVOS = Build for AppleTVOS.
5959
# SIMULATOR_TVOS = Build for x86_64 AppleTV Simulator.
60+
# WATCHOS = Build for armv7k for WatchOS.
61+
# SIMULATOR_WATCHOS = Build for i386 for Watch Simulator.
6062
# CMAKE_OSX_SYSROOT: Path to the iOS SDK to use. By default this is
6163
# automatically determined from IOS_PLATFORM and xcodebuild, but
6264
# can also be manually specified (although this should not be required).
@@ -73,6 +75,8 @@
7375
# SIMULATOR64 = x86_64
7476
# TVOS = arm64
7577
# SIMULATOR_TVOS = x86_64
78+
# WATCHOS = armv7k
79+
# SIMULATOR_WATCHOS = i386
7680
#
7781
# This toolchain defines the following variables for use externally:
7882
#
@@ -120,6 +124,8 @@ if (NOT DEFINED IOS_PLATFORM)
120124
set(IOS_PLATFORM "SIMULATOR")
121125
elseif (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
122126
set(IOS_PLATFORM "SIMULATOR64")
127+
elseif (CMAKE_OSX_ARCHITECTURES MATCHES "armv7k")
128+
set(IOS_PLATFORM "WATCHOS")
123129
endif()
124130
endif()
125131
if (NOT IOS_PLATFORM)
@@ -160,6 +166,16 @@ elseif (IOS_PLATFORM STREQUAL "SIMULATOR_TVOS")
160166
if(NOT IOS_ARCH)
161167
set(IOS_ARCH x86_64)
162168
endif()
169+
elseif (IOS_PLATFORM STREQUAL "WATCHOS")
170+
set(XCODE_IOS_PLATFORM watchos)
171+
if(NOT IOS_ARCH)
172+
set(IOS_ARCH armv7k)
173+
endif()
174+
elseif (IOS_PLATFORM STREQUAL "SIMULATOR_WATCHOS")
175+
set(XCODE_IOS_PLATFORM watchsimulator)
176+
if(NOT IOS_ARCH)
177+
set(IOS_ARCH i386)
178+
endif()
163179
else()
164180
message(FATAL_ERROR "Invalid IOS_PLATFORM: ${IOS_PLATFORM}")
165181
endif()
@@ -326,6 +342,12 @@ elseif (IOS_PLATFORM STREQUAL "TVOS")
326342
elseif (IOS_PLATFORM STREQUAL "SIMULATOR_TVOS")
327343
set(XCODE_IOS_PLATFORM_VERSION_FLAGS
328344
"-mtvos-simulator-version-min=${IOS_DEPLOYMENT_TARGET}")
345+
elseif (IOS_PLATFORM STREQUAL "WATCHOS")
346+
set(XCODE_IOS_PLATFORM_VERSION_FLAGS
347+
"-mwatchos-version-min=${IOS_DEPLOYMENT_TARGET}")
348+
elseif (IOS_PLATFORM STREQUAL "SIMULATOR_WATCHOS")
349+
set(XCODE_IOS_PLATFORM_VERSION_FLAGS
350+
"-mwatchos-simulator-version-min=${IOS_DEPLOYMENT_TARGET}")
329351
else()
330352
# SIMULATOR or SIMULATOR64 both use -mios-simulator-version-min.
331353
set(XCODE_IOS_PLATFORM_VERSION_FLAGS

0 commit comments

Comments
 (0)
Please sign in to comment.