OpenUSD requires some pyhon dep packages during build. So, after all this, sadly, we now need to have a venv for this.

main
Stephan Menzel 2025-06-23 18:21:10 +02:00
parent d62319e14b
commit 62747bab18
5 changed files with 36 additions and 29 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
build.log build.log
.idea/ .idea/
*.pyc *.pyc
.venv/

View File

@ -5,14 +5,7 @@
import os import os
import zipfile import zipfile
from pathlib import Path from pathlib import Path
import requests
# we need requests to download perl package but I don't want to install a venv just for that
# with this trick we can use requests that comes bundled with pip
try:
import requests
except ImportError:
import pip._vendor.requests as requests
from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log from build_functions.build_utils import run_in_shell, print_banner, file_and_console_log
from common.azure import write_package_version_batch from common.azure import write_package_version_batch
from common.directory_helpers import pushd, get_local_prefix from common.directory_helpers import pushd, get_local_prefix

View File

@ -9,6 +9,7 @@ from common.azure import write_package_version_batch
from common.cmake import cmake_build_install from common.cmake import cmake_build_install
import common.settings import common.settings
from common.git_helpers import clone_git_tag from common.git_helpers import clone_git_tag
from common.settings import temporarily_set_shared
from package.package_info import get_package_info from package.package_info import get_package_info
def build_openusd(prefix: Path | str, sbom: dict): def build_openusd(prefix: Path | str, sbom: dict):
@ -18,29 +19,36 @@ def build_openusd(prefix: Path | str, sbom: dict):
package_info = get_package_info("openusd") package_info = get_package_info("openusd")
package_info.add_to_sbom(sbom) package_info.add_to_sbom(sbom)
# I mistook boost for a direct dependency but it turned out to be an indirect one.
# Various other, optional, dependencies such as OpenImageIO use it.
# We don't have them in here yet but I keep boost to prepare for that
boost_install_path = package_info.dependency_path("boost")
hdf5_install_path = package_info.dependency_path("hdf5")
onetbb_install_path = package_info.dependency_path("onetbb") onetbb_install_path = package_info.dependency_path("onetbb")
opensubdiv_install_path = package_info.dependency_path("opensubdiv") opensubdiv_install_path = package_info.dependency_path("opensubdiv")
zlib_install_path = package_info.dependency_path("zlib") zlib_install_path = package_info.dependency_path("zlib")
# OpenUSD definately doesn't want to be build static. Only errors. DLL it is then.
with temporarily_set_shared():
cmake_args = [
("PXR_ENABLE_PYTHON_SUPPORT:BOOL", "ON"),
("PXR_ENABLE_HDF5_SUPPORT:BOOL", "ON"),
("PXR_BUILD_EXAMPLES:BOOL", "ON"),
("PXR_BUILD_TESTS:BOOL", "OFF"),
("PXR_BUILD_TUTORIALS:BOOL", "ON"),
("PXR_BUILD_HTML_DOCUMENTATION:BOOL", "OFF"),
cmake_args = [ ("hdf5_DIR:PATH", str(hdf5_install_path / "cmake")),
# We're gonna need Python but I had trouble compiling the bindings. ("Boost_ROOT:PATH", str(boost_install_path)),
# Disabled for the first tests ("Boost_DIR:PATH", str(boost_install_path / "lib" / "cmake" / "Boost-1.88.0")),
("PXR_ENABLE_PYTHON_SUPPORT:BOOL", "OFF"), ("TBB_DIR:PATH", str(onetbb_install_path / "lib" / "cmake" / "TBB")),
("OpenSubdiv_DIR:PATH", str(opensubdiv_install_path / "lib" / "cmake" / "OpenSubdiv")),
("PXR_BUILD_EXAMPLES:BOOL", "OFF"), ("ZLIB_ROOT:PATH", str(zlib_install_path)),
("PXR_BUILD_TESTS:BOOL", "OFF"), ("ZLIB_USE_STATIC_LIBS:BOOL", "ON"), # doesn't appear to do its job
("PXR_BUILD_TUTORIALS:BOOL", "ON"), ("ZLIB_LIBRARY_RELEASE:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name)),
("ZLIB_LIBRARY_DEBUG:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name))
("PXR_BUILD_HTML_DOCUMENTATION:BOOL", "OFF"), ]
("TBB_DIR:PATH", str(onetbb_install_path / "lib" / "cmake" / "TBB")), src_dir = clone_git_tag(package_info, recursive=False)
("OpenSubdiv_DIR:PATH", str(opensubdiv_install_path / "lib" / "cmake" / "OpenSubdiv")), install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
("ZLIB_ROOT:PATH", str(zlib_install_path)), write_package_version_batch(package_info.version)
("ZLIB_USE_STATIC_LIBS:BOOL", "ON"), # doesn't appear to do its job return install_dir
("ZLIB_LIBRARY_RELEASE:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name)),
("ZLIB_LIBRARY_DEBUG:FILEPATH", str(zlib_install_path / "lib" / common.settings.zlib_static_lib_name))
]
src_dir = clone_git_tag(package_info, recursive=False)
install_dir = cmake_build_install(src_dir, package_info, cmake_args=cmake_args)
write_package_version_batch(package_info.version)
return install_dir

View File

@ -201,6 +201,7 @@
"version": "25.5.1", "version": "25.5.1",
"depends": [ "depends": [
"boost", "boost",
"hdf5",
"onetbb", "onetbb",
"opensubdiv", "opensubdiv",
"zlib" "zlib"

4
requirements.txt Normal file
View File

@ -0,0 +1,4 @@
pyside6
jinja2
pyopengl
requests