Skip to content

Commit 0729140

Browse files
committed
Allow building as Apple Frameworks and XCFrameworks, including Simulator support
1 parent f7127e3 commit 0729140

File tree

14 files changed

+621
-83
lines changed

14 files changed

+621
-83
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,37 @@ Or for visionOS:
171171
```
172172
> python OpenUSD/build_scripts/build_usd.py --build-target visionOS --build-monolithic /path/to/my_usd_install_dir
173173
```
174+
###### Framework Builds (Experimental)
175+
176+
Builds for Apple platforms may optionally build as a framework using the `--build-apple-framework` flag.
177+
178+
**NOTE:** This feature is experimental and may change how it functions in future USD builds.
179+
180+
- Framework builds are enabled by default for iOS and visionOS build targets. It can optionally be enabled for macOS.
181+
- Framework builds require monolithic builds.
182+
- Building a universal macOS framework is currently not supported. Please generate the arches separately and `lipo`
183+
them together after.
184+
185+
To add the Framework to your application, simply add `OpenUSD.framework` to your Xcode project.
186+
It is recommended to set it to `Embed and Sign`.
187+
188+
When including sources from the Framework, you must prefix the include with the framework name.
189+
However, you should note that these includes are not portable to non-framework builds.
190+
e.g `#include <OpenUSD/pxr/pxr.h>`
191+
192+
Optionally, if you want to avoid prefixed includes for your cross platform code, you can manually add the search path
193+
by setting `SYSTEM_HEADER_SEARCH_PATHS` in your Xcode target to the Headers directory within the framework.
194+
For example, if your Framework folder is in your project, under a folder with the same name as your target, you would
195+
set it as `$(SRCROOT)/$(TARGET_NAME)/OpenUSD.framework/Headers`.
196+
197+
OpenUSD also supports building a combined XCFramework as well of multiple targets.
198+
This command takes an optional list of targets to build, but will otherwise build all supported platforms.
199+
200+
```
201+
> python OpenUSD/build_scripts/apple_utils.py xcframework /path/to/my_usd_install_dir
202+
```
203+
204+
Note that currently, Simulator builds do not render with Imaging as Simulator targets have reduced Metal support.
174205

175206
##### Windows:
176207

0 commit comments

Comments
 (0)