Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'build_files/build_environment/patches/usd.diff')
-rw-r--r--build_files/build_environment/patches/usd.diff111
1 files changed, 111 insertions, 0 deletions
diff --git a/build_files/build_environment/patches/usd.diff b/build_files/build_environment/patches/usd.diff
new file mode 100644
index 00000000000..8afd9700e59
--- /dev/null
+++ b/build_files/build_environment/patches/usd.diff
@@ -0,0 +1,111 @@
+diff -x .git -ur usd.orig/cmake/defaults/Options.cmake external_usd/cmake/defaults/Options.cmake
+--- usd.orig/cmake/defaults/Options.cmake 2019-10-24 22:39:53.000000000 +0200
++++ external_usd/cmake/defaults/Options.cmake 2019-11-28 13:00:33.197957712 +0100
+@@ -25,6 +25,7 @@
+ option(PXR_VALIDATE_GENERATED_CODE "Validate script generated code" OFF)
+ option(PXR_HEADLESS_TEST_MODE "Disallow GUI based tests, useful for running under headless CI systems." OFF)
+ option(PXR_BUILD_TESTS "Build tests" ON)
++option(PXR_BUILD_USD_TOOLS "Build commandline tools" ON)
+ option(PXR_BUILD_IMAGING "Build imaging components" ON)
+ option(PXR_BUILD_EMBREE_PLUGIN "Build embree imaging plugin" OFF)
+ option(PXR_BUILD_OPENIMAGEIO_PLUGIN "Build OpenImageIO plugin" OFF)
+diff -x .git -ur usd.orig/cmake/defaults/Packages.cmake external_usd/cmake/defaults/Packages.cmake
+--- usd.orig/cmake/defaults/Packages.cmake 2019-10-24 22:39:53.000000000 +0200
++++ external_usd/cmake/defaults/Packages.cmake 2019-11-28 13:00:33.185957483 +0100
+@@ -64,7 +64,7 @@
+ endif()
+
+ # --TBB
+-find_package(TBB REQUIRED COMPONENTS tbb)
++find_package(TBB)
+ add_definitions(${TBB_DEFINITIONS})
+
+ # --math
+diff -x .git -ur usd.orig/pxr/base/lib/plug/initConfig.cpp external_usd/pxr/base/lib/plug/initConfig.cpp
+--- usd.orig/pxr/base/lib/plug/initConfig.cpp 2019-10-24 22:39:53.000000000 +0200
++++ external_usd/pxr/base/lib/plug/initConfig.cpp 2019-12-11 11:00:37.643323127 +0100
+@@ -69,8 +69,38 @@
+
+ ARCH_CONSTRUCTOR(Plug_InitConfig, 2, void)
+ {
++ /* The contents of this constructor have been moved to usd_initialise_plugin_path(...) */
++}
++
++}; // end of anonymous namespace
++
++/**
++ * The contents of this function used to be in the static constructor Plug_InitConfig.
++ * This static constructor made it impossible for Blender to pass a path to the USD
++ * library at runtime, as the constructor would run before Blender's main() function.
++ *
++ * This function is wrapped in a C function of the same name (defined below),
++ * so that it can be called from Blender's main() function.
++ *
++ * The datafiles_usd_path path is used to point to the USD plugin path when Blender
++ * has been installed. The fallback_usd_path path should point to the build-time
++ * location of the USD plugin files so that Blender can be run on a development machine
++ * without requiring an installation step.
++ */
++void
++usd_initialise_plugin_path(const char *datafiles_usd_path)
++{
+ std::vector<std::string> result;
+
++ // Add Blender-specific paths. They MUST end in a slash, or symlinks will not be treated as directory.
++ if (datafiles_usd_path != NULL && datafiles_usd_path[0] != '\0') {
++ std::string datafiles_usd_path_str(datafiles_usd_path);
++ if (datafiles_usd_path_str.back() != '/') {
++ datafiles_usd_path_str += "/";
++ }
++ result.push_back(datafiles_usd_path_str);
++ }
++
+ // Determine the absolute path to the Plug shared library.
+ // Any relative paths specified in the plugin search path will be
+ // anchored to this directory, to allow for relocatability.
+@@ -94,9 +124,24 @@
+ _AppendPathList(&result, installLocation, sharedLibPath);
+ #endif // PXR_INSTALL_LOCATION
+
+- Plug_SetPaths(result);
+-}
++ if (!TfGetenv("PXR_PATH_DEBUG").empty()) {
++ printf("USD Plugin paths: (%zu in total):\n", result.size());
++ for(const std::string &path : result) {
++ printf(" %s\n", path.c_str());
++ }
++ }
+
++ Plug_SetPaths(result);
+ }
+
+ PXR_NAMESPACE_CLOSE_SCOPE
++
++/* Workaround to make it possible to pass a path at runtime to USD. */
++extern "C" {
++void
++usd_initialise_plugin_path(
++ const char *datafiles_usd_path)
++{
++ PXR_NS::usd_initialise_plugin_path(datafiles_usd_path);
++}
++}
+diff -x .git -ur usd.orig/pxr/usd/CMakeLists.txt external_usd/pxr/usd/CMakeLists.txt
+--- usd.orig/pxr/usd/CMakeLists.txt 2019-10-24 22:39:53.000000000 +0200
++++ external_usd/pxr/usd/CMakeLists.txt 2019-11-28 13:00:33.197957712 +0100
+@@ -1,6 +1,5 @@
+ set(DIRS
+ lib
+- bin
+ plugin
+ )
+
+@@ -8,3 +7,8 @@
+ add_subdirectory(${d})
+ endforeach()
+
++if (PXR_BUILD_USD_TOOLS)
++ add_subdirectory(bin)
++else()
++ message(STATUS "Skipping commandline tools because PXR_BUILD_USD_TOOLS=OFF")
++endif()