Skip to content

Commit 953d4de

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 b2167c0 commit 953d4de

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
@@ -1562,14 +1562,19 @@ def InstallMaterialX(context, force, buildArgs):
15621562

15631563
############################################################
15641564
# Embree
1565-
# For MacOS we use version 3.13.3 to include a fix from Intel
1566-
# to build on Apple Silicon.
1567-
if MacOS():
1568-
EMBREE_URL = "https://github.com/RenderKit/embree/archive/v3.13.3.zip"
1569-
else:
1570-
EMBREE_URL = "https://github.com/RenderKit/embree/archive/v3.2.2.zip"
1565+
1566+
EMBREE_DEFAULT_MAJOR_VERSION = 3
15711567

15721568
def InstallEmbree(context, force, buildArgs):
1569+
if context.embreeMajorVersion >= 4:
1570+
EMBREE_URL = "https://github.com/RenderKit/embree/archive/refs/tags/v4.3.3.zip"
1571+
elif MacOS():
1572+
# For MacOS we use version 3.13.3 to include a fix from Intel
1573+
# to build on Apple Silicon.
1574+
EMBREE_URL = "https://github.com/RenderKit/embree/archive/refs/tags/v3.13.3.zip"
1575+
else:
1576+
EMBREE_URL = "https://github.com/RenderKit/embree/archive/refs/tags/v3.2.2.zip"
1577+
15731578
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
15741579
extraArgs = [
15751580
'-DTBB_ROOT="{instDir}"'.format(instDir=context.instDir),
@@ -1586,7 +1591,9 @@ def InstallEmbree(context, force, buildArgs):
15861591

15871592
RunCMake(context, force, extraArgs)
15881593

1589-
EMBREE = Dependency("Embree", InstallEmbree, "include/embree3/rtcore.h")
1594+
EMBREE = Dependency("Embree", InstallEmbree,
1595+
"include/embree3/rtcore.h",
1596+
"include/embree4/rtcore.h")
15901597

15911598
############################################################
15921599
# AnimX
@@ -2108,6 +2115,12 @@ def InstallUSD(context, force, buildArgs):
21082115
help="Build Embree sample imaging plugin")
21092116
subgroup.add_argument("--no-embree", dest="build_embree", action="store_false",
21102117
help="Do not build Embree sample imaging plugin (default)")
2118+
group.add_argument("--embree-major-version",
2119+
default=EMBREE_DEFAULT_MAJOR_VERSION, type=int,
2120+
choices=[3, 4],
2121+
help=(
2122+
"The major version of Embree to build "
2123+
"(default: {})").format(EMBREE_DEFAULT_MAJOR_VERSION))
21112124
subgroup = group.add_mutually_exclusive_group()
21122125
subgroup.add_argument("--prman", dest="build_prman", action="store_true",
21132126
default=False,
@@ -2327,6 +2340,7 @@ def __init__(self, args):
23272340

23282341
# - Imaging plugins
23292342
self.buildEmbree = self.buildImaging and args.build_embree
2343+
self.embreeMajorVersion = args.embree_major_version
23302344
self.buildPrman = self.buildImaging and args.build_prman
23312345
self.prmanLocation = (os.path.abspath(args.prman_location)
23322346
if args.prman_location else None)
@@ -2646,6 +2660,7 @@ def _JoinVersion(v):
26462660
OpenImageIO support: {buildOIIO}
26472661
OpenColorIO support: {buildOCIO}
26482662
Embree support: {buildEmbree}
2663+
Embree major version: {embreeMajorVersion}
26492664
PRMan support: {buildPrman}
26502665
UsdImaging {buildUsdImaging}
26512666
usdview: {buildUsdview}
@@ -2710,6 +2725,8 @@ def FormatBuildArguments(buildArgs):
27102725
buildOIIO=("On" if context.buildOIIO else "Off"),
27112726
buildOCIO=("On" if context.buildOCIO else "Off"),
27122727
buildEmbree=("On" if context.buildEmbree else "Off"),
2728+
embreeMajorVersion=(context.embreeMajorVersion if context.buildEmbree
2729+
else "N/A"),
27132730
buildPrman=("On" if context.buildPrman else "Off"),
27142731
buildUsdImaging=("On" if context.buildUsdImaging else "Off"),
27152732
buildUsdview=("On" if context.buildUsdview else "Off"),

0 commit comments

Comments
 (0)