Skip to content

Commit e6e707f

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 b4bcaeb commit e6e707f

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

15971597
############################################################
15981598
# Embree
1599-
# For MacOS we use version 3.13.3 to include a fix from Intel
1600-
# to build on Apple Silicon.
1601-
if MacOS():
1602-
EMBREE_URL = "https://github.com/embree/embree/archive/v3.13.3.zip"
1603-
else:
1604-
EMBREE_URL = "https://github.com/embree/embree/archive/v3.2.2.zip"
1599+
1600+
EMBREE_DEFAULT_MAJOR_VERSION = 3
16051601

16061602
def InstallEmbree(context, force, buildArgs):
1603+
if context.embreeMajorVersion >= 4:
1604+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v4.0.1.zip"
1605+
elif MacOS():
1606+
# For MacOS we use version 3.13.3 to include a fix from Intel
1607+
# to build on Apple Silicon.
1608+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.13.3.zip"
1609+
else:
1610+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.2.2.zip"
1611+
16071612
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
16081613
extraArgs = [
16091614
'-DTBB_ROOT="{instDir}"'.format(instDir=context.instDir),
@@ -1620,7 +1625,9 @@ def InstallEmbree(context, force, buildArgs):
16201625

16211626
RunCMake(context, force, extraArgs)
16221627

1623-
EMBREE = Dependency("Embree", InstallEmbree, "include/embree3/rtcore.h")
1628+
EMBREE = Dependency("Embree", InstallEmbree,
1629+
"include/embree3/rtcore.h",
1630+
"include/embree4/rtcore.h")
16241631

16251632
############################################################
16261633
# USD
@@ -2050,6 +2057,12 @@ def InstallUSD(context, force, buildArgs):
20502057
help="Build Embree sample imaging plugin")
20512058
subgroup.add_argument("--no-embree", dest="build_embree", action="store_false",
20522059
help="Do not build Embree sample imaging plugin (default)")
2060+
group.add_argument("--embree-major-version",
2061+
default=EMBREE_DEFAULT_MAJOR_VERSION, type=int,
2062+
choices=[3, 4],
2063+
help=(
2064+
"The major version of Embree to build "
2065+
"(default: {})").format(EMBREE_DEFAULT_MAJOR_VERSION))
20532066
subgroup = group.add_mutually_exclusive_group()
20542067
subgroup.add_argument("--prman", dest="build_prman", action="store_true",
20552068
default=False,
@@ -2223,6 +2236,7 @@ def __init__(self, args):
22232236

22242237
# - Imaging plugins
22252238
self.buildEmbree = self.buildImaging and args.build_embree
2239+
self.embreeMajorVersion = args.embree_major_version
22262240
self.buildPrman = self.buildImaging and args.build_prman
22272241
self.prmanLocation = (os.path.abspath(args.prman_location)
22282242
if args.prman_location else None)
@@ -2475,6 +2489,7 @@ def _JoinVersion(v):
24752489
OpenImageIO support: {buildOIIO}
24762490
OpenColorIO support: {buildOCIO}
24772491
Embree support: {buildEmbree}
2492+
Embree major version: {embreeMajorVersion}
24782493
PRMan support: {buildPrman}
24792494
UsdImaging {buildUsdImaging}
24802495
usdview: {buildUsdview}
@@ -2538,6 +2553,8 @@ def FormatBuildArguments(buildArgs):
25382553
buildOIIO=("On" if context.buildOIIO else "Off"),
25392554
buildOCIO=("On" if context.buildOCIO else "Off"),
25402555
buildEmbree=("On" if context.buildEmbree else "Off"),
2556+
embreeMajorVersion=(context.embreeMajorVersion if context.buildEmbree
2557+
else "N/A"),
25412558
buildPrman=("On" if context.buildPrman else "Off"),
25422559
buildUsdImaging=("On" if context.buildUsdImaging else "Off"),
25432560
buildUsdview=("On" if context.buildUsdview else "Off"),

0 commit comments

Comments
 (0)