Skip to content

USD and MaterialX update #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import zlib
import os
import re
import site
from urllib.request import urlopen

OS = platform.system()
Expand All @@ -43,6 +42,7 @@
jobs = 0
clean = False
git_apply = True
viewer = False

build_var = 'release'

Expand Down Expand Up @@ -157,13 +157,9 @@ def cmake(src_dir, bin_dir, args):

def materialx():
print_start("Building MaterialX")

libdir = bl_libs_dir.as_posix()

cmake(deps_dir / "MaterialX", bin_dir / "materialx", [
args = [
'-DMATERIALX_BUILD_PYTHON=ON',
'-DMATERIALX_BUILD_RENDER=ON',
# '-DMATERIALX_BUILD_VIEWER=ON',
'-DMATERIALX_INSTALL_PYTHON=OFF',
f'-DMATERIALX_PYTHON_EXECUTABLE={py_exe}',
f'-DMATERIALX_PYTHON_VERSION=3.10',
Expand All @@ -172,8 +168,14 @@ def materialx():
'-DCMAKE_DEBUG_POSTFIX=_d',
f'-Dpybind11_ROOT=',
f'-DPython_EXECUTABLE={py_exe}',
])
]
if viewer:
args += [
'-DMATERIALX_BUILD_VIEWER=ON',
'-DMATERIALX_BUILD_GRAPH_EDITOR=ON',
]

cmake(deps_dir / "MaterialX", bin_dir / "materialx", args)

def usd():
print_start("Building USD")
Expand Down Expand Up @@ -233,7 +235,6 @@ def usd():
"-DPXR_BUILD_TESTS=OFF",
"-DPXR_BUILD_EXAMPLES=OFF",
"-DPXR_BUILD_TUTORIALS=OFF",
"-DPXR_BUILD_USDVIEW=OFF",
"-DPXR_ENABLE_HDF5_SUPPORT=OFF",
"-DPXR_ENABLE_MATERIALX_SUPPORT=ON",
"-DPXR_ENABLE_OPENVDB_SUPPORT=ON",
Expand Down Expand Up @@ -266,6 +267,10 @@ def usd():
# Otherwise it will error out during the cmake configure phase.
f"-DTBB_LIBRARIES_DEBUG={libdir}/tbb/lib/{LIBPREFIX}tbb{LIBEXT}",
]
if viewer:
args += [
"-DPXR_BUILD_USDVIEW=ON",
]

cur_dir = os.getcwd()
os.chdir(str(usd_dir))
Expand All @@ -274,9 +279,6 @@ def usd():
if git_apply:
check_call('git', 'apply', '--whitespace=nowarn', str(diff_dir / "usd.diff"))

# Remove patch after merging https://github.com/PixarAnimationStudios/OpenUSD/pull/2550
check_call('git', 'apply', '--whitespace=nowarn', str(diff_dir / "usd_opengl_errors_fix.diff"))

try:
cmake(usd_dir, bin_dir / "USD", args)
finally:
Expand Down Expand Up @@ -343,6 +345,8 @@ def boost():
' ;\n'
]))

toolset = {"Visual Studio 16 2019": "msvc-14.2",
"Visual Studio 17 2022": "msvc-14.3"}[compiler]
args = [
"b2",
f"--prefix={install_dir}",
Expand All @@ -357,7 +361,7 @@ def boost():
"--with-python",
f"--user-config={project_path}",
"-sNO_BZIP2=1",
"toolset=msvc-14.2",
f"toolset={toolset}",
"install"
]

Expand Down Expand Up @@ -593,6 +597,7 @@ def render_studio():
f'-DUSD_LOCATION={usd_dir}',
f'-DUSD_LIBRARY_DIR={usd_dir / "lib"}',
f'-DUSD_MONOLITHIC_LIBRARY={usd_dir / "lib" / f"{LIBPREFIX}usd_ms{POSTFIX}{LIBEXT}"}',
"--compile-no-warning-as-error",
]

cur_dir = os.getcwd()
Expand Down Expand Up @@ -786,11 +791,13 @@ def main():
ap.add_argument("-clean", required=False, action="store_true",
help="Clean build dirs before start USD or HdRPR build")
ap.add_argument("-no-git-apply", required=False, action="store_true",
help="Do not use `git apply usd.diff for USD repo`")
help="Do not use 'git apply usd.diff' for USD repo")
ap.add_argument("-viewer", required=False, action="store_true",
help="Build viewer programs")

args = ap.parse_args()

global bl_libs_dir, bin_dir, py_exe, compiler, jobs, clean, git_apply, build_var, POSTFIX
global bl_libs_dir, bin_dir, py_exe, compiler, jobs, clean, git_apply, build_var, viewer, POSTFIX

bl_libs_dir = Path(args.bl_libs_dir).absolute().resolve()

Expand All @@ -804,9 +811,10 @@ def main():
jobs = args.j
clean = args.clean
git_apply = not args.no_git_apply
viewer = args.viewer

build_var = args.build_var
if args.build_var == "debug":
if build_var == "debug":
POSTFIX = "_d"

bin_dir.mkdir(parents=True, exist_ok=True)
Expand Down
2 changes: 1 addition & 1 deletion deps/MaterialX
Submodule MaterialX updated 1026 files
2 changes: 1 addition & 1 deletion deps/USD
Submodule USD updated from b53573 to 0b18ad
Loading