Skip to content

Commit 6a0360a

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 bfdcfd9 commit 6a0360a

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

14911491
############################################################
14921492
# Embree
1493-
# For MacOS we use version 3.13.3 to include a fix from Intel
1494-
# to build on Apple Silicon.
1495-
if MacOS():
1496-
EMBREE_URL = "https://github.com/embree/embree/archive/v3.13.3.zip"
1497-
else:
1498-
EMBREE_URL = "https://github.com/embree/embree/archive/v3.2.2.zip"
1493+
1494+
EMBREE_DEFAULT_MAJOR_VERSION = 3
14991495

15001496
def InstallEmbree(context, force, buildArgs):
1497+
if context.embreeMajorVersion >= 4:
1498+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v4.3.1.zip"
1499+
elif MacOS():
1500+
# For MacOS we use version 3.13.3 to include a fix from Intel
1501+
# to build on Apple Silicon.
1502+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.13.3.zip"
1503+
else:
1504+
EMBREE_URL = "https://github.com/embree/embree/archive/refs/tags/v3.2.2.zip"
1505+
15011506
with CurrentWorkingDirectory(DownloadURL(EMBREE_URL, context, force)):
15021507
extraArgs = [
15031508
'-DTBB_ROOT="{instDir}"'.format(instDir=context.instDir),
@@ -1514,7 +1519,9 @@ def InstallEmbree(context, force, buildArgs):
15141519

15151520
RunCMake(context, force, extraArgs)
15161521

1517-
EMBREE = Dependency("Embree", InstallEmbree, "include/embree3/rtcore.h")
1522+
EMBREE = Dependency("Embree", InstallEmbree,
1523+
"include/embree3/rtcore.h",
1524+
"include/embree4/rtcore.h")
15181525

15191526
############################################################
15201527
# AnimX
@@ -1996,6 +2003,12 @@ def InstallUSD(context, force, buildArgs):
19962003
help="Build Embree sample imaging plugin")
19972004
subgroup.add_argument("--no-embree", dest="build_embree", action="store_false",
19982005
help="Do not build Embree sample imaging plugin (default)")
2006+
group.add_argument("--embree-major-version",
2007+
default=EMBREE_DEFAULT_MAJOR_VERSION, type=int,
2008+
choices=[3, 4],
2009+
help=(
2010+
"The major version of Embree to build "
2011+
"(default: {})").format(EMBREE_DEFAULT_MAJOR_VERSION))
19992012
subgroup = group.add_mutually_exclusive_group()
20002013
subgroup.add_argument("--prman", dest="build_prman", action="store_true",
20012014
default=False,
@@ -2197,6 +2210,7 @@ def __init__(self, args):
21972210

21982211
# - Imaging plugins
21992212
self.buildEmbree = self.buildImaging and args.build_embree
2213+
self.embreeMajorVersion = args.embree_major_version
22002214
self.buildPrman = self.buildImaging and args.build_prman
22012215
self.prmanLocation = (os.path.abspath(args.prman_location)
22022216
if args.prman_location else None)
@@ -2467,6 +2481,7 @@ def _JoinVersion(v):
24672481
OpenImageIO support: {buildOIIO}
24682482
OpenColorIO support: {buildOCIO}
24692483
Embree support: {buildEmbree}
2484+
Embree major version: {embreeMajorVersion}
24702485
PRMan support: {buildPrman}
24712486
UsdImaging {buildUsdImaging}
24722487
usdview: {buildUsdview}
@@ -2531,6 +2546,8 @@ def FormatBuildArguments(buildArgs):
25312546
buildOIIO=("On" if context.buildOIIO else "Off"),
25322547
buildOCIO=("On" if context.buildOCIO else "Off"),
25332548
buildEmbree=("On" if context.buildEmbree else "Off"),
2549+
embreeMajorVersion=(context.embreeMajorVersion if context.buildEmbree
2550+
else "N/A"),
25342551
buildPrman=("On" if context.buildPrman else "Off"),
25352552
buildUsdImaging=("On" if context.buildUsdImaging else "Off"),
25362553
buildUsdview=("On" if context.buildUsdview else "Off"),

0 commit comments

Comments
 (0)