@@ -1473,14 +1473,19 @@ def InstallMaterialX(context, force, buildArgs):
14731473
14741474############################################################
14751475# Embree
1476- # For MacOS we use version 3.13.3 to include a fix from Intel
1477- # to build on Apple Silicon.
1478- if MacOS ():
1479- EMBREE_URL = "https://github.com/embree/embree/archive/v3.13.3.zip"
1480- else :
1481- EMBREE_URL = "https://github.com/embree/embree/archive/v3.2.2.zip"
1476+
1477+ EMBREE_DEFAULT_MAJOR_VERSION = 3
14821478
14831479def InstallEmbree (context , force , buildArgs ):
1480+ if context .embreeMajorVersion >= 4 :
1481+ EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v4.3.1.zip"
1482+ elif MacOS ():
1483+ # For MacOS we use version 3.13.3 to include a fix from Intel
1484+ # to build on Apple Silicon.
1485+ EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.13.3.zip"
1486+ else :
1487+ EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.2.2.zip"
1488+
14841489 with CurrentWorkingDirectory (DownloadURL (EMBREE_URL , context , force )):
14851490 extraArgs = [
14861491 '-DTBB_ROOT="{instDir}"' .format (instDir = context .instDir ),
@@ -1497,7 +1502,9 @@ def InstallEmbree(context, force, buildArgs):
14971502
14981503 RunCMake (context , force , extraArgs )
14991504
1500- EMBREE = Dependency ("Embree" , InstallEmbree , "include/embree3/rtcore.h" )
1505+ EMBREE = Dependency ("Embree" , InstallEmbree ,
1506+ "include/embree3/rtcore.h" ,
1507+ "include/embree4/rtcore.h" )
15011508
15021509############################################################
15031510# AnimX
@@ -1979,6 +1986,12 @@ def InstallUSD(context, force, buildArgs):
19791986 help = "Build Embree sample imaging plugin" )
19801987subgroup .add_argument ("--no-embree" , dest = "build_embree" , action = "store_false" ,
19811988 help = "Do not build Embree sample imaging plugin (default)" )
1989+ group .add_argument ("--embree-major-version" ,
1990+ default = EMBREE_DEFAULT_MAJOR_VERSION , type = int ,
1991+ choices = [3 , 4 ],
1992+ help = (
1993+ "The major version of Embree to build "
1994+ "(default: {})" ).format (EMBREE_DEFAULT_MAJOR_VERSION ))
19821995subgroup = group .add_mutually_exclusive_group ()
19831996subgroup .add_argument ("--prman" , dest = "build_prman" , action = "store_true" ,
19841997 default = False ,
@@ -2180,6 +2193,7 @@ def __init__(self, args):
21802193
21812194 # - Imaging plugins
21822195 self .buildEmbree = self .buildImaging and args .build_embree
2196+ self .embreeMajorVersion = args .embree_major_version
21832197 self .buildPrman = self .buildImaging and args .build_prman
21842198 self .prmanLocation = (os .path .abspath (args .prman_location )
21852199 if args .prman_location else None )
@@ -2450,6 +2464,7 @@ def _JoinVersion(v):
24502464 OpenImageIO support: {buildOIIO}
24512465 OpenColorIO support: {buildOCIO}
24522466 Embree support: {buildEmbree}
2467+ Embree major version: {embreeMajorVersion}
24532468 PRMan support: {buildPrman}
24542469 UsdImaging {buildUsdImaging}
24552470 usdview: {buildUsdview}
@@ -2514,6 +2529,8 @@ def FormatBuildArguments(buildArgs):
25142529 buildOIIO = ("On" if context .buildOIIO else "Off" ),
25152530 buildOCIO = ("On" if context .buildOCIO else "Off" ),
25162531 buildEmbree = ("On" if context .buildEmbree else "Off" ),
2532+ embreeMajorVersion = (context .embreeMajorVersion if context .buildEmbree
2533+ else "N/A" ),
25172534 buildPrman = ("On" if context .buildPrman else "Off" ),
25182535 buildUsdImaging = ("On" if context .buildUsdImaging else "Off" ),
25192536 buildUsdview = ("On" if context .buildUsdview else "Off" ),
0 commit comments