# (c) 2025 by Stephan Menzel # Licensed under the Apache License, Version 2.0. # See attached file LICENSE for full details from pathlib import Path from build_functions.build_utils import print_banner from common.azure import write_package_version_batch from common.cmake import cmake_build_install import common.settings from common.git_helpers import clone_git_tag from package.package_info import get_package_info def build_opensubdiv(prefix: Path | str, sbom: dict): print_banner("Building OpenSubdiv") package_info = get_package_info("opensubdiv") package_info.add_to_sbom(sbom) onetbb_install_path = package_info.dependency_path("onetbb") zlib_install_path = package_info.dependency_path("zlib") # This library is quite a beast. It has a lot of additional acceleration dependencies # such as OpenCL, CUDA, you name it. This is meant to provide a mininmal build to get OpenUSD # to work. Once it does, we may look into accelerating things cmake_args = [ ("NO_EXAMPLES:BOOL", "ON"), ("NO_TUTORIALS:BOOL", "ON"), ("NO_REGRESSION:BOOL", "ON"), ("NO_CUDA:BOOL", "ON"), ("NO_OPENCL:BOOL", "ON"), ("TBB_DIR:PATH", str(onetbb_install_path / "lib" / "cmake" / "TBB")), ("ZLIB_ROOT:PATH", str(zlib_install_path)), ("ZLIB_USE_STATIC_LIBS:BOOL", "ON"), # doesn't appear to do its job ("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