OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

Apple: Core iOS support

Open dgovil opened this issue 1 year ago • 16 comments

Description of Change(s)

This PR adds Core iOS support to the OpenUSD project. This does not include Imaging, and any Imaging related components at this time. Imaging will be added in a follow up PR. As requested, MaterialX support was also removed and will be uploaded in a separate PR.

While the build_usd.py script only supports iPhone, this change also does make it possible for the main CMake build to target other Apple platforms as long as the developer can build the dependencies themselves.

It is a minimal version of Thor's work in https://github.com/PixarAnimationStudios/OpenUSD/pull/2455 against the latest dev branch. Changes include:

  • Using latest dev branch
  • No imaging support. Will be added in a follow up PR.
  • Makes use of CMake's inbuilt iOS support, negating the need for toolchain support
  • Structures the code in such a way that we can add support for other iOS derived platforms+simulator in future PRs
  • Swaps ARCH_OS_IOS with ARCH_OS_IPHONE to align with compiler directives. IPHONE refers to all derivative platforms, whereas iOS refers to only iPhone/iPad (Confusing but the case for historical reasons as documented here or in TargetConditionals.h within any Apple SDK)
  • Upgrades MaterialX to 1.38.8 (from 1.38.7) as that adds support for iOS derivative platforms as well.
  • I've moved import apple_utils out from under a platform check, because the module import shouldn't be platform specific, and it removes the need for unnecessary platform checks all over the place
  • TBB requires SDKROOT be passed in to workaround a bug where it may find a random other toolchain and fail. (Valentin Roussellet figured out this edge case)
  • Added APPLE_EMBEDDED cmake parameter in Options.cmake so that it can be used to configure options further down the build setup
  • [X] I have verified that all unit tests pass with the proposed changes
  • [X] I have submitted a signed Contributor License Agreement

dgovil avatar Feb 14 '24 19:02 dgovil

Filed as internal issue #USD-9301

jesschimein avatar Feb 15 '24 17:02 jesschimein

/AzurePipelines run

jesschimein avatar Feb 29 '24 18:02 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Feb 29 '24 18:02 azure-pipelines[bot]

@jesschimein or @meshula for whenever y'all are back, I just wanted to make a note so I can check in on the build_usd.py and apple_utils.py changes in this PR that didn't make it into 24.5.

Should I split it out into a separate PR? I think I'd missed that 24.5 was targeting just the CMake + C++ side of things. I'm just not sure how y'all want to handle the remainder of this PR.

dgovil avatar Apr 08 '24 21:04 dgovil

@dgovil There are some additional notes from internal code review that we want to address before merging the build script changes, but I think we can keep those associated with this PR for now.

davidgyu avatar Apr 12 '24 17:04 davidgyu

Sounds good. Thanks!

dgovil avatar Apr 12 '24 17:04 dgovil

Reopened, as the noted commit only partially addressed the PR.

meshula avatar Apr 20 '24 04:04 meshula

@davidgyu and @meshula This PR has been rebased against the latest in dev. It only contains the build script changes which mostly amount to:

  • Adding the new build target flag
  • Setting the build target and sdkroot for TBB. The SDKRoot is required because TBB has a tendency to try and discover the wrong SDK.

dgovil avatar Apr 22 '24 22:04 dgovil

/AzurePipelines run

jesschimein avatar Apr 23 '24 17:04 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Apr 23 '24 17:04 azure-pipelines[bot]

I'm just fixing up a few other oddities I'm finding.

  1. Currently tbb seems to want to only respect the iOS build target for Debug and not release. Looking into that now.
  2. I found an intermittent bug in cmake where setting the CMAKE_SYSTEM_NAME causes the cmake find logic to change. I found this thread with a fix and it involves setting the CMAKE_FIND_ROOT_PATH_MODE variables to BOTH to work. I've updated the PR with that.

I'll report back when I fix the TBB thing. But right now it works if you set the build mode to debug.

dgovil avatar Apr 23 '24 17:04 dgovil

Okay, should be good now. TBB needs an extra arg called extra_inc=big_iron.inc that I had missed in the rebase. Essentially it makes TBB become statically compiled, which is better for iOS anyway.

With the two changes above, USD for iOS should build as easily as

build_usd.py ~/usd --build-target iOS

dgovil avatar Apr 23 '24 17:04 dgovil

@davidgyu I just added https://github.com/PixarAnimationStudios/OpenUSD/pull/2949/commits/3cc8aa4b88b551a70c3a464920d90731a8ebf7eewhich adds the CMake code signing attributes to the CMake arguments so that even dependencies get code signed during their build if code signing is enabled.

In theory it isn't strictly related to this PR (as it should have been happening for macOS as well) but this brings it inline here

dgovil avatar May 21 '24 19:05 dgovil

Rebased on top of latest from dev

dgovil avatar Jun 18 '24 16:06 dgovil

/AzurePipelines run

jesschimein avatar Jun 18 '24 17:06 jesschimein

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Jun 18 '24 17:06 azure-pipelines[bot]