-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apple: Enable building as an Apple Framework #2969
base: dev
Are you sure you want to change the base?
Conversation
bc56f55
to
5f321b9
Compare
Filed as internal issue #USD-9360 |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
1664609
to
4a0f035
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
@dgovil Could I ask you to pop in a note that reports when you are building a framework here?
|
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Apologies @dgovil I was meaning to merge locally and got the <- -> icons backwards in the interface. Please force push to overwrite my inadvertent commit when you are ready to update. |
e07ce73
to
352d4d6
Compare
@meshula I rebased the latest on top of dev+ios_core PR. I overwrote your changes to my branch. |
Thanks for fixing the mishap and adding the Mx bits! |
352d4d6
to
947efa1
Compare
/AzurePipelines run |
Pull request contains merge conflicts. |
390e3af
to
8d23ab3
Compare
/AzurePipelines run |
Pull request contains merge conflicts. |
Currently refactoring this on top of the iOS imaging branch and the latest dev, so in flux for the moment. |
/AzurePipelines run |
Pull request contains merge conflicts. |
/AzurePipelines run |
Pull request contains merge conflicts. |
Rebased this PR on the imaging branch. It is still possible to build as a non-monolithic build, but I am not focusing on that setup because frameworks expect a single dylib per framework and we'd have something like ~70 frameworks going that route. Instead, long term, we can work with each dependency to add monolithic+framework builds to them as well, and then tease things apart here. It also allows for building for simulator (but isn't super well tested) My todos before I think this is ready is: [] Make sure the USD build can load all the plugins that are part of it. Specifically HD etc... Potentially, I want to see if its possible to modify the headers to avoid needing to add the header search path manually. |
Looking promising!
If you can solve that one, that would be fantastic! Could I ask you to drop a link in to point us at
Given the evolution of the ios + imaging work, it would be helpful to have a link to the branch out here in the main thread. |
Yep, added a link to the main body above but also adding it here #3215 |
This PR makes a few changes that have been derived from a corresponding PR to USD PixarAnimationStudios/OpenUSD#2969 The changes are: 1. Deprecates `MATERIALX_BUILD_IOS` in favor of using `CMAKE_SYSTEM_NAME`. This allows for better support for iPhone derived targets like visionOS. Earlier this would force it to iOS which can cause subtle issues when compiled against other SDKs. See https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-visionos-or-watchos 2. Changes `TARGET_OS_IOS` define to `TARGET_OS_IPHONE` which is more correct to support iPhone derivatives. See https://chaosinmotion.com/2021/08/02/things-to-remember-compiler-conditionals-for-macos-ios-etc/ . But the gist is `TARGET_OS_IOS` refers specifically to the modern iOS/iPadOS SDK, whereas `TARGET_OS_IPHONE` refers to all Apple SDKs that derived from the original iPhone. 3. Add support for building as a Framework. This creates a special directory structure that streamlines embedding of MaterialX within Apps on Apple platforms to just dragging the project into the app in Xcode. No other linker and compiler configuration is necessary. See Framework notes below.
fa4dc07
to
84a3c21
Compare
Rebased on top of latest dev now that #3215 is merged. This reduces the diff to just what's needed for framework builds |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
@meshula I added some code to the I put this in the With an XCFramework, its easier to share code between multiple platform targets, and you don't need to setup separate simulator and device targets. |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
4f54b2a
to
47da75e
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
12c2357
to
0729140
Compare
d1bf209
to
50f2977
Compare
/AzurePipelines run |
Azure Pipelines successfully started running 1 pipeline(s). |
Description of Change(s)
This PR enables building of USD as a Framework.
A framework build puts the output files into a directory structure which allows them to be included easily in apps on macOS, iOS and visionOS. The steps to use it are included in the README but are repeated here in brief:
Frameworks are enabled automatically for Apple embedded platforms (iOS, visionOS).
Framework builds default to Monolithic because a framework may only include one dylib within it. Shared builds can still be enabled for some dev purposes, but aren't officially supported.
Experimental Feature
I request that the feature be marked as Experimental in the README, because I anticipate changes might be needed in the future to streamline how this works, such as not requiring the dependencies to be statically built. I think the current state of the PR will unblock the majority of people asking for this feature however and the changes I anticipate might be quite long term.
This incorporates some work by Maddy Adams and @meshula . The changes are largely non-invasive and are listed below:
Core Code Changes
Build Script Changes
--build-apple-framework
and--no-build-apple-framework
--prefix-framework-headers
to opt-in to prefixing the headersapple_utils.py
to orchestrate anXCFramework
build, that combines multiple targets into one framework.Header Notes
Framework headers are automatically discovered when prefixed by the framework name.
This requires the user to build with
--prefix-framework-headers
E.g instead of
#include <pxr/pxr.h>
you would do#include <OpenUSD/pxr/pxr.h>
If someone wants to avoid the prefixed behavior, they have to manually add the Header directory to their targets
SYSTEM_HEADER_SEARCH_PATHS
.