def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" if "get-python-info" in targets: write_python_info() return is_debug = lib.is_debug_build() # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source dont_extract = ["*/doc/*", "*/libs/*/doc/*"] source_root = lib.open_archive(archive, dont_extract=dont_extract) # Config libraries libraries = with_libraries() # Fresh user config jam jam_path = config_jam_path() if os.path.isfile(jam_path): os.remove(jam_path) # setup current python info write_python_info() # Bootstrap with lib.working_dir(source_root): bootstrap = "bootstrap.bat" if IS_WIN else "./bootstrap.sh" subprocess.check_call([bootstrap, "--prefix=%s" % install_path]) # Run B2 b2_exec = "b2" if IS_WIN else "./b2" b2_settings = [ b2_exec, "--prefix=%s" % install_path, "--build-dir=%s" % build_path + "/build", # avoid 'path too long' fail on Windows "--hash", "-j%s" % os.environ["REZ_BUILD_THREAD_COUNT"], "address-model=64", "link=shared", "runtime-link=shared", "threading=multi", "--user-config=%s" % jam_path, "install", "variant=%s" % ("debug" if is_debug else "release"), ] set_toolset(b2_settings) # Build with lib.working_dir(source_root): subprocess.check_call(b2_settings + libraries)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_opencolorio"): extra_args = [ "-DOCIO_BUILD_TRUELIGHT=OFF", "-DOCIO_BUILD_APPS=OFF", "-DOCIO_BUILD_NUKE=OFF", "-DOCIO_BUILD_DOCS=OFF", "-DOCIO_BUILD_TESTS=OFF", "-DOCIO_BUILD_PYGLUE=OFF", "-DOCIO_BUILD_JNIGLUE=OFF", "-DOCIO_STATIC_JNIGLUE=OFF", ] lib.run_cmake(source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_opensubdiv"): extra_args = [ "-DNO_EXAMPLES=ON", "-DNO_TUTORIALS=ON", "-DNO_REGRESSION=ON", "-DNO_DOC=ON", "-DNO_OMP=ON", "-DNO_CUDA=ON", "-DNO_OPENCL=ON", "-DNO_DX=ON", "-DNO_TESTS=ON", "-DNO_GLEW=ON", "-DNO_GLFW=ON", ] lib.run_cmake(source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_hdf5"): extra_args = [ "-DBUILD_TESTING=OFF", "-DHDF5_BUILD_TOOLS=OFF", "-DHDF5_BUILD_EXAMPLES=OFF", ] lib.run_cmake(source_root, install_path, extra_args=extra_args, build_type="Debug") lib.run_cmake(source_root, install_path, extra_args=extra_args, build_type="Release")
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build libjpeg with lib.working_dir(source_root): args = [ "./configure", "--prefix=" + install_path, "--disable-static", "--enable-shared", ] subprocess.check_call(args) args = [ "make", "-j%s" % os.environ["REZ_BUILD_THREAD_COUNT"], "install", ] subprocess.check_call(args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # libTIFF has a build issue on Windows where tools/tiffgt.c # unconditionally includes unistd.h, which does not exist. # To avoid this, we patch the CMakeLists.txt to skip building # the tools entirely. We do this on Linux and MacOS as well # to avoid requiring some GL and X dependencies. # # We also need to skip building tests, since they rely on # the tools we've just elided. lib.patch_file(source_root + "/CMakeLists.txt", [("add_subdirectory(tools)", "# add_subdirectory(tools)"), ("add_subdirectory(test)", "# add_subdirectory(test)")]) # Build with lib.working_dir(build_path + "/_libtiff"): lib.run_cmake(source_root, install_path, build_type="Debug") lib.run_cmake(source_root, install_path, build_type="Release")
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" is_debug = lib.is_debug_build() # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_openimageio"): extra_args = [ "-DOIIO_BUILD_TOOLS=OFF", "-DOIIO_BUILD_TESTS=OFF", "-DUSE_PYTHON=OFF", "-DSTOP_ON_WARNING=OFF", # Need to specify TBB use debug or not, or release build will fail "-DTBB_USE_DEBUG_BUILD=%s" % ("ON" if is_debug else "OFF"), # boost "-DBoost_NO_BOOST_CMAKE=On", "-DBoost_NO_SYSTEM_PATHS=True", "-DHDF5_ROOT=\"%s\"" % os.environ["REZ_HDF5_ROOT"], "-DOpenColorIO_ROOT=\"%s\"" % os.environ["REZ_OPENCOLORIO_ROOT"], ] lib.run_cmake(source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_blosc"): lib.run_cmake(source_root, install_path)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) ilm_source_root = os.path.join(source_root, "IlmBase") exr_source_root = os.path.join(source_root, "OpenEXR") # Build ilmbase with lib.working_dir(build_path + "/_ilmbase"): lib.run_cmake(ilm_source_root, install_path) # Build openexr with lib.working_dir(build_path + "/_openexr"): os.environ["PATH"] += ";" + install_path + "/lib" # find ilmbase extra_args = ["-DILMBASE_PACKAGE_PREFIX=\"%s\"" % install_path] lib.run_cmake(exr_source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" is_debug = lib.is_debug_build() # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_openimageio"): extra_args = [ "-DOIIO_BUILD_TOOLS=OFF", "-DOIIO_BUILD_TESTS=OFF", "-DUSE_PYTHON=OFF", "-DSTOP_ON_WARNING=OFF", # Need to specify TBB use debug or not, or release build will fail "-DTBB_USE_DEBUG_BUILD=%s" % ("ON" if is_debug else "OFF"), # OIIO's FindOpenEXR module circumvents CMake's normal library # search order, which causes versions of OpenEXR installed in # /usr/local or other hard-coded locations in the module to # take precedence over the version we've built, which would # normally be picked up when we specify CMAKE_PREFIX_PATH. # This may lead to undefined symbol errors at build or runtime. # So, we explicitly specify the OpenEXR we want to use here. "-DOPENEXR_HOME=\"%s\"" % os.getenv("OPENEXR_ROOT", install_path), # boost "-DBoost_NO_BOOST_CMAKE=On", "-DBoost_NO_SYSTEM_PATHS=True", "-DBOOST_ROOT=\"%s\"" % os.getenv("BOOST_ROOT", install_path), "-DHDF5_ROOT=\"%s\"" % os.getenv("REZ_HDF5_ROOT", install_path), "-DOpenColorIO_ROOT=\"%s\"" % os.getenv("REZ_OPENCOLORIO_ROOT", install_path), ] lib.run_cmake(source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" is_debug = lib.is_debug_build() # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) if is_debug: lib.patch_file( source_root + "/cmake/FindTBB.cmake", [("find_library(Tbb_${COMPONENT}_LIBRARY ${COMPONENT}", "find_library(Tbb_${COMPONENT}_LIBRARY ${COMPONENT}_debug")]) # Build with lib.working_dir(build_path + "/_openvdb"): extra_args = [ "-DOPENVDB_BUILD_PYTHON_MODULE=OFF", "-DOPENVDB_BUILD_BINARIES=OFF", "-DOPENVDB_BUILD_UNITTESTS=OFF", # boost "-DBoost_NO_BOOST_CMAKE=On", "-DBoost_NO_SYSTEM_PATHS=True", "-DBOOST_ROOT=\"%s\"" % os.getenv("BOOST_ROOT", install_path), # blosc "-DBLOSC_ROOT=\"%s\"" % os.getenv("BLOSC_ROOT", install_path), # tbb "-DTBB_ROOT=\"%s\"" % os.getenv("REZ_TBB_ROOT", install_path), # OpenVDB needs Half type from IlmBase "-DILMBASE_ROOT=\"%s\"" % os.getenv("ILMBASE_ROOT", install_path), ] lib.run_cmake(source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source source_root = lib.open_archive(archive) # Build with lib.working_dir(build_path + "/_alembic"): extra_args = [ "-DUSE_BINARIES=OFF", "-DUSE_TESTS=OFF", # hdf5 "-DUSE_HDF5=ON", "-DHDF5_ROOT=\"%s\"" % os.environ["REZ_HDF5_ROOT"], "-DCMAKE_CXX_FLAGS=\"-D H5_BUILT_AS_DYNAMIC_LIB\"" ] lib.run_cmake(source_root, install_path, extra_args=extra_args)
def build(source_path, build_path, install_path, targets): # We need to shorten build path if DPXR_BUILD_EXAMPLES is ON. # This is not perfect, but it is suffice for now. build_path = shorten_variant_build_path(source_path) rebuild = True targets = targets or [] if "install" not in targets: install_path = build_path + "/install" is_debug = lib.is_debug_build() py_info = lib.python_info() # Clean build if rebuild: lib.clear_build(build_path) # Download the source archive = os.path.join(build_path, filename) if rebuild: url = "%s/%s" % (url_prefix, filename) lib.download(url, archive) # Unzip the source source_root = lib.open_archive(archive, cleanup=rebuild) # Build arnold_root = os.environ["REZ_ARNOLD_SDK_ROOT"] usd_root = os.environ["REZ_USD_ROOT"] tbb_root = os.environ["REZ_TBB_ROOT"] boost_root = os.environ["REZ_BOOST_ROOT"] # For now assume Python was installed with rez scoopz which # installs the binaries into an `app` folder inside the root. python_root = os.path.join(os.environ["REZ_PYTHON_ROOT"], "payload") # Set build parameters args = [ ("ARNOLD_PATH", arnold_root), ("USD_PATH", usd_root), # Set the build mode for USD that it generates when running # default build script, which is 'shared_libs' ("USD_BUILD_MODE", r"shared_libs"), ("USD_LIB_PREFIX", r""), # Set the BOOST_INCLUDE prefix for USD built on Windows using # Visual Studio 2017 or greater, which builds boost 1.65.1 ("BOOST_INCLUDE", boost_root + "/include/boost-1_70"), # Building USD on Windows using Pixar's build script appends # a suffix to all Boost generated files, so we need to make # sure that Arnold-USD finds it. ("BOOST_LIB_NAME", "boost_%s-vc141-mt-1_70.lib"), ("PYTHON_INCLUDE", os.path.join(python_root, "include")), ("PYTHON_LIB", os.path.join(python_root, "libs")), ("PYTHON_LIB_NAME", r"python27"), ("TBB_INCLUDE", os.path.join(tbb_root, "include")), ("TBB_LIB", os.path.join(tbb_root, "lib")), ("BUILD_SCHEMAS", "True"), # todo: Fix building the docs. It fails on: # AttributeError: 'SConsEnvironment' object has no attribute 'Doxygen': # File "D:\dev\usd\arnold-usd\SConstruct", line 392: # DOCS = env.Doxygen(source='docs/Doxyfile', target=docs_output) ("BUILD_DOCS", "False"), ("DISABLE_CXX11_ABI", "True"), ("MSVC_VERSION", "14.1"), # Install location ("PREFIX", install_path) ] # todo: handle paths with spaces? cmd_build_args = ["%s=%s" % (key, value) for key, value in args] # Run arnold-usd/abuild cmd = [os.path.join(source_root, "abuild.bat")] cmd.extend(cmd_build_args) with lib.working_dir(source_root): subprocess.check_call(cmd)
def build(source_path, build_path, install_path, targets): # We need to shorten build path if DPXR_BUILD_EXAMPLES is ON. # This is not perfect, but it is suffice for now. build_path = shorten_variant_build_path(source_path) rebuild = True targets = targets or [] if "install" not in targets: install_path = build_path + "/install" is_debug = lib.is_debug_build() py_info = lib.python_info() # Clean build if rebuild: lib.clear_build(build_path) # Download the source archive = os.path.join(build_path, filename) if rebuild: url = "%s/%s" % (url_prefix, filename) lib.download(url, archive) # Unzip the source source_root = lib.open_archive(archive, cleanup=rebuild) # Patch # Fix "openvdb\Types.h(36): # fatal error C1083: cannot open file: 'OpenEXR/half.h' ..." lib.patch_file( source_root + "/pxr/imaging/glf/CMakeLists.txt", [("list(APPEND optionalIncludeDirs ${OPENVDB_INCLUDE_DIR})", "list(APPEND optionalIncludeDirs ${OPENVDB_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR})")] ) # Fix finding usd tools exec on Windows lib.patch_file( source_root + "/pxr/usd/bin/usddiff/usddiff.py", [(_usddiff_code_a + _win_code, _usdtools_patch)], multiline_matches=True ) lib.patch_file( source_root + "/pxr/usd/bin/usdedit/usdedit.py", [(_usdedit_code_a + _win_code, _usdtools_patch)], multiline_matches=True ) # Build with lib.working_dir(build_path + "/_usd"): extra_args = [ "-DTBB_USE_DEBUG_BUILD=" + "ON" if is_debug else "OFF", "-DPXR_ENABLE_PYTHON_SUPPORT=ON", "-DPXR_USE_PYTHON_3=%s" % "ON" if PY3 else "OFF", "-DPYTHON_EXECUTABLE=\"%s\"" % py_info[0], "-DPYTHON_LIBRARY=\"%s\"" % py_info[1], "-DPYTHON_INCLUDE_DIR=\"%s\"" % py_info[2], "-DBUILD_SHARED_LIBS=ON", "-DPXR_BUILD_DOCUMENTATION=ON", "-DPXR_BUILD_EXAMPLES=ON", "-DPXR_BUILD_TESTS=ON", "-DPXR_BUILD_TUTORIALS=ON", "-DPXR_BUILD_USD_TOOLS=ON", "-DPXR_BUILD_USDVIEW=ON", # boost "-DBoost_NO_BOOST_CMAKE=On", "-DBoost_NO_SYSTEM_PATHS=True", "-DBOOST_ROOT=\"%s\"" % os.getenv("BOOST_ROOT", install_path), "-DPXR_BUILD_IMAGING=ON", "-DPXR_BUILD_USD_IMAGING=ON", "-DPXR_ENABLE_PTEX_SUPPORT=ON", "-DPXR_ENABLE_OPENVDB_SUPPORT=ON", "-DPXR_BUILD_OPENIMAGEIO_PLUGIN=ON", "-DPXR_BUILD_OPENCOLORIO_PLUGIN=ON", "-DPXR_BUILD_MATERIALX_PLUGIN=ON", "-DPXR_BUILD_ALEMBIC_PLUGIN=ON", "-DPXR_ENABLE_HDF5_SUPPORT=ON", "-DHDF5_ROOT=\"%s\"" % os.getenv("REZ_HDF5_ROOT", install_path), "-DALEMBIC_DIR=\"%s\"" % os.getenv("REZ_ALEMBIC_ROOT", install_path), "-DGLEW_LOCATION=\"%s\"" % os.getenv("REZ_GLEW_ROOT", install_path), "-DPXR_BUILD_EMBREE_PLUGIN=OFF", "-DPXR_BUILD_PRMAN_PLUGIN=OFF", "-DPXR_BUILD_DRACO_PLUGIN=OFF", # PXR_VALIDATE_GENERATED_CODE # hgiMetal # PXR_BUILD_GPU_SUPPORT # PXR_ENABLE_METAL_SUPPORT ] if IS_WIN: # Increase the precompiled header buffer limit. extra_args.append("-DCMAKE_CXX_FLAGS=\"/Zm150\"") lib.run_cmake(source_root, install_path, extra_args=extra_args) # Copy additional resources copy_additionals(source_path, install_path) # Run test (Build will pass even test failed.) env = os.environ.copy() required_path = os.pathsep.join( install_path + dirname for dirname in ["/bin", "/lib", "/plugin/usd"] ) # must be prepended. env["PATH"] = os.pathsep.join([required_path, env["PATH"]]) env["PYTHONPATH"] += ";%s" % install_path + "/lib/python" # No need to set PYTHONHOME in production, just for testing env["PYTHONHOME"] = os.environ["REZ_PYTHON_ROOT"] + "/payload" subprocess.call([ "ctest", "--output-on-failure", "--timeout", "300", "-C", "Debug" if is_debug else "Release", # "-R", "<single_test_name_here>", ], env=env)
def build(source_path, build_path, install_path, targets): targets = targets or [] if "install" not in targets: install_path = build_path + "/install" if "get-python-info" in targets: write_python_info() return # Download the source url = "%s/%s" % (url_prefix, filename) archive = lib.download(url, filename) # Unzip the source dont_extract = ["*/doc/*", "*/libs/*/doc/*"] source_root = lib.open_archive(archive, dont_extract=dont_extract) # Config libraries libraries = with_libraries() # Fresh user config jam jam_path = config_jam_path() if os.path.isfile(jam_path): os.remove(jam_path) # Bootstrap with lib.working_dir(source_root): bootstrap = "bootstrap.bat" if IS_WIN else "./bootstrap.sh" subprocess.check_call([bootstrap, "--prefix=%s" % install_path]) # Run B2 b2_exec = "b2" if IS_WIN else "./b2" b2_settings = [ b2_exec, "--prefix=%s" % install_path, "--build-dir=%s" % build_path + "/build", # avoid 'path too long' fail on Windows "--hash", "-j%s" % os.environ["REZ_BUILD_THREAD_COUNT"], "address-model=64", "link=shared", "runtime-link=shared", "threading=multi", "--user-config=%s" % jam_path, "install", ] set_toolset(b2_settings) # Look for rez python packages python_versions = python_config_jam() # Build with lib.working_dir(source_root): # specified libraries for variant in ["release", "debug"]: cmd = b2_settings + ["variant=%s" % variant] subprocess.check_call(cmd + libraries) # python # # Noted that we need to call clean build if python 2 and 3 both # being presented. # https://stackoverflow.com/a/28893295/4145300 # previous_major = None for py_ver in python_versions: major = py_ver.split(".")[0] need_clean = previous_major and previous_major != major previous_major = major py_libs = ["--with-python", "python=%s" % py_ver] # if major == "3": # py_libs.append("--buildid=3") if need_clean: subprocess.check_call(cmd + py_libs + ["--clean"]) for variant in ["release", "debug"]: cmd = b2_settings + ["variant=%s" % variant] subprocess.check_call(cmd + py_libs)