Skip to content

Commit 9050557

Browse files
committed
build_usd.py: add an option to choose Embree 3 or Embree 4
The new --embree-major-version option can be given to build_usd.py to select between Embree 3 or Embree 4. By default, Embree 3 is still used, preserving the existing behavior.
1 parent 683fc0b commit 9050557

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

build_scripts/build_usd.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,14 +1502,19 @@ def InstallMaterialX(context, force, buildArgs):
15021502

15031503
############################################################
15041504
# Embree
1505-
# For MacOS we use version 3.13.3 to include a fix from Intel
1506-
# to build on Apple Silicon.
1507-
if MacOS():
1508-
EMBREE_URL = "https://github.com/embree/embree/archive/v3.13.3.zip"
1509-
else:
1510-
EMBREE_URL = "https://github.com/embree/embree/archive/v3.2.2.zip"
1505+
1506+
EMBREE_DEFAULT_MAJOR_VERSION = 3
15111507

15121508
def InstallEmbree(context, force, buildArgs):
1509+
if context.embreeMajorVersion >= 4:
1510+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v4.3.1.zip"
1511+
elif MacOS():
1512+
# For MacOS we use version 3.13.3 to include a fix from Intel
1513+
# to build on Apple Silicon.
1514+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.13.3.zip"
1515+
else:
1516+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.2.2.zip"
1517+
15131518
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
15141519
extraArgs = [
15151520
'-DTBB_ROOT="{instDir}"'.format(instDir=context.instDir),
@@ -1526,7 +1531,9 @@ def InstallEmbree(context, force, buildArgs):
15261531

15271532
RunCMake(context, force, extraArgs)
15281533

1529-
EMBREE = Dependency("Embree", InstallEmbree, "include/embree3/rtcore.h")
1534+
EMBREE = Dependency("Embree", InstallEmbree,
1535+
"include/embree3/rtcore.h",
1536+
"include/embree4/rtcore.h")
15301537

15311538
############################################################
15321539
# AnimX
@@ -2001,6 +2008,12 @@ def InstallUSD(context, force, buildArgs):
20012008
help="Build Embree sample imaging plugin")
20022009
subgroup.add_argument("--no-embree", dest="build_embree", action="store_false",
20032010
help="Do not build Embree sample imaging plugin (default)")
2011+
group.add_argument("--embree-major-version",
2012+
default=EMBREE_DEFAULT_MAJOR_VERSION, type=int,
2013+
choices=[3, 4],
2014+
help=(
2015+
"The major version of Embree to build "
2016+
"(default: {})").format(EMBREE_DEFAULT_MAJOR_VERSION))
20042017
subgroup = group.add_mutually_exclusive_group()
20052018
subgroup.add_argument("--prman", dest="build_prman", action="store_true",
20062019
default=False,
@@ -2199,6 +2212,7 @@ def __init__(self, args):
21992212

22002213
# - Imaging plugins
22012214
self.buildEmbree = self.buildImaging and args.build_embree
2215+
self.embreeMajorVersion = args.embree_major_version
22022216
self.buildPrman = self.buildImaging and args.build_prman
22032217
self.prmanLocation = (os.path.abspath(args.prman_location)
22042218
if args.prman_location else None)
@@ -2469,6 +2483,7 @@ def _JoinVersion(v):
24692483
OpenImageIO support: {buildOIIO}
24702484
OpenColorIO support: {buildOCIO}
24712485
Embree support: {buildEmbree}
2486+
Embree major version: {embreeMajorVersion}
24722487
PRMan support: {buildPrman}
24732488
UsdImaging {buildUsdImaging}
24742489
usdview: {buildUsdview}
@@ -2533,6 +2548,8 @@ def FormatBuildArguments(buildArgs):
25332548
buildOIIO=("On" if context.buildOIIO else "Off"),
25342549
buildOCIO=("On" if context.buildOCIO else "Off"),
25352550
buildEmbree=("On" if context.buildEmbree else "Off"),
2551+
embreeMajorVersion=(context.embreeMajorVersion if context.buildEmbree
2552+
else "N/A"),
25362553
buildPrman=("On" if context.buildPrman else "Off"),
25372554
buildUsdImaging=("On" if context.buildUsdImaging else "Off"),
25382555
buildUsdview=("On" if context.buildUsdview else "Off"),

0 commit comments

Comments
 (0)