Skip to content

Commit 8d56cde

Browse files
davidgyupixar-oss
authored andcommitted
[cmake/defaults] Updated for iOS cross-compilation
Makes use of CMake's builtin support for cross compilation for Apple embedded platforms (available since CMake 3.14). Sets PXR_APPLE_EMBEDDED=ON when cross compiling to iOS, tvOS, visionOS, watchOS. Disables PXR_BUILD_USD_TOOLS and PXR_BUILD_IMAGING when building for one of these embedded systems since these are not currently supported on Apple embedded platforms. Contribution: Dhruv Govil Fixes #2949 (Internal change: 2322007)
1 parent c735937 commit 8d56cde

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

cmake/defaults/Options.cmake

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,29 @@ option(PXR_PREFER_SAFETY_OVER_SPEED
5454
"Enable certain checks designed to avoid crashes or out-of-bounds memory reads with malformed input files. These checks may negatively impact performance."
5555
ON)
5656

57+
if(APPLE)
58+
# Cross Compilation detection as defined in CMake docs
59+
# Required to be handled here so it can configure options later on
60+
# https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-visionos-or-watchos
61+
# Note: All these SDKs may not be supported by OpenUSD, but are all listed here for future proofing
62+
set(PXR_APPLE_EMBEDDED OFF)
63+
if (CMAKE_SYSTEM_NAME MATCHES "iOS"
64+
OR CMAKE_SYSTEM_NAME MATCHES "tvOS"
65+
OR CMAKE_SYSTEM_NAME MATCHES "visionOS"
66+
OR CMAKE_SYSTEM_NAME MATCHES "watchOS")
67+
set(PXR_APPLE_EMBEDDED ON)
68+
if(${PXR_BUILD_USD_TOOLS})
69+
MESSAGE(STATUS "Setting PXR_BUILD_USD_TOOLS=OFF because they are not supported on Apple embedded platforms")
70+
set(PXR_BUILD_USD_TOOLS OFF)
71+
endif()
72+
if (${PXR_BUILD_IMAGING})
73+
MESSAGE(STATUS "Setting PXR_BUILD_USD_IMAGING=OFF because it is not supported on Apple embedded platforms")
74+
set(PXR_BUILD_IMAGING OFF)
75+
endif ()
76+
endif ()
77+
endif()
78+
79+
5780
# Determine GFX api
5881
# Metal only valid on Apple platforms
5982
set(pxr_enable_metal "OFF")

0 commit comments

Comments
 (0)