@@ -1808,6 +1808,11 @@ def InstallUSD(context, force, buildArgs):
18081808 '-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH' ,
18091809 '-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH' ])
18101810
1811+ if MacOS ():
1812+ extraArgs .append (f"-DPXR_BUILD_APPLE_FRAMEWORK={ 'ON' if context .buildAppleFramework else 'OFF' } " )
1813+ if context .macOSCodesign :
1814+ extraArgs .append (f"-DPXR_APPLE_CODESIGN_IDENTITY={ context .macOSCodesign } " )
1815+
18111816 # Make sure to use boost installed by the build script and not any
18121817 # system installed boost
18131818 extraArgs .append ('-DBoost_NO_BOOST_CMAKE=On' )
@@ -1922,6 +1927,12 @@ def InstallUSD(context, force, buildArgs):
19221927 help = ("Build target for macOS cross compilation. "
19231928 "(default: {})" .format (
19241929 apple_utils .GetBuildTargetDefault ())))
1930+ subgroup = group .add_mutually_exclusive_group ()
1931+ subgroup .add_argument ("--build-apple-framework" , dest = "build_apple_framework" , action = "store_true" ,
1932+ help = "Build USD as an Apple Framework (Default if using build)" )
1933+ subgroup .add_argument ("--no-build-apple-framework" , dest = "no_build_apple_framework" , action = "store_true" ,
1934+ help = "Do not build USD as an Apple Framework (Default if macOS)" )
1935+
19251936 if apple_utils .IsHostArm ():
19261937 # Intel Homebrew stores packages in /usr/local which unfortunately can
19271938 # be where a lot of other things are too. So we only add this flag on arm macs.
@@ -1957,6 +1968,7 @@ def InstallUSD(context, force, buildArgs):
19571968 default = codesignDefault , action = "store_true" ,
19581969 help = ("Enable code signing for macOS builds "
19591970 "(defaults to enabled on Apple Silicon)" ))
1971+ group .add_argument ("--codesign-id" , dest = "macos_codesign_id" , type = str )
19601972
19611973if Linux ():
19621974 group .add_argument ("--use-cxx11-abi" , type = int , choices = [0 , 1 ],
@@ -2235,17 +2247,22 @@ def __init__(self, args):
22352247 self .ignorePaths = args .ignore_paths or []
22362248 self .buildTarget = None
22372249 self .macOSCodesign = ""
2250+ self .buildAppleFramework = False
22382251 # Build target and code signing
22392252 if MacOS ():
22402253 self .buildTarget = args .build_target
22412254 apple_utils .SetTarget (self , self .buildTarget )
22422255
2243- self .macOSCodesign = \
2244- (args .macos_codesign if hasattr (args , "macos_codesign" )
2245- else False )
2256+ if args .macos_codesign :
2257+ self .macOSCodesign = args .macos_codesign_id or apple_utils .GetCodeSignID ()
22462258 if apple_utils .IsHostArm () and args .ignore_homebrew :
22472259 self .ignorePaths .append ("/opt/homebrew" )
22482260
2261+ self .buildAppleFramework = ((args .build_apple_framework
2262+ or self .buildTarget in apple_utils .EMBEDDED_PLATFORMS )
2263+ and not args .no_build_apple_framework )
2264+
2265+
22492266 coreOnly = self .buildTarget in apple_utils .EMBEDDED_PLATFORMS
22502267
22512268 self .useCXX11ABI = \
@@ -2258,10 +2275,10 @@ def __init__(self, args):
22582275
22592276 # Optional components
22602277 self .buildTests = args .build_tests
2261- self .buildPython = args .build_python and not coreOnly
2278+ self .buildPython = args .build_python and not coreOnly and not self . buildAppleFramework
22622279 self .buildExamples = args .build_examples
22632280 self .buildTutorials = args .build_tutorials
2264- self .buildTools = args .build_tools and not coreOnly
2281+ self .buildTools = args .build_tools and not coreOnly and not self . buildAppleFramework
22652282
22662283 # - Documentation
22672284 self .buildDocs = args .build_docs or args .build_python_docs
@@ -2694,8 +2711,9 @@ def FormatBuildArguments(buildArgs):
26942711 ])
26952712
26962713if MacOS ():
2697- if context .macOSCodesign :
2698- apple_utils .Codesign (context .usdInstDir , verbosity > 1 )
2714+ # We don't need to codesign when building a framework because it's handled during framework creation
2715+ if context .macOSCodesign and not context .buildAppleFramework :
2716+ apple_utils .Codesign (context , verbosity > 1 )
26992717
27002718printInstructions = any ([context .buildPython , context .buildTools , context .buildPrman ])
27012719if printInstructions :
@@ -2718,3 +2736,12 @@ def FormatBuildArguments(buildArgs):
27182736if context .buildPrman :
27192737 Print ("See documentation at http://openusd.org/docs/RenderMan-USD-Imaging-Plugin.html "
27202738 "for setting up the RenderMan plugin.\n " )
2739+
2740+ if context .buildAppleFramework :
2741+ Print ("""
2742+ Added the following framework to your Xcode Project, (recommended as Embed Without Signing):
2743+ OpenUSD.framework
2744+
2745+ Set the following compiler argument, to find the headers:
2746+ SYSTEM_HEADER_SEARCH_PATHS=$(SRCROOT)/$(TARGET_NAME)/OpenUSD.framework/Headers
2747+ """ )
0 commit comments