[Bf-blender-cvs] [56c8f8ffa5b] temp-sybren-usd-patch-01: USD: Build improvements

Sybren A. Stüvel noreply at git.blender.org
Tue Nov 26 18:21:32 CET 2019


Commit: 56c8f8ffa5b4fa3a3ce394b593159ae9031f75b5
Author: Sybren A. Stüvel
Date:   Fri Nov 22 12:44:42 2019 +0100
Branches: temp-sybren-usd-patch-01
https://developer.blender.org/rB56c8f8ffa5b4fa3a3ce394b593159ae9031f75b5

USD: Build improvements

- Removed the `USD_PATH` variable, expose `USD_ROOT_DIR` from `FindUSD.cmake`
  instead.
- Properly call `find_package_wrapper(USD)` from `platform_unix.cmake`.
- Added USD files to `harvest.cmake`.
- Removed `external_python` from USD dependencies, as we don't use USD's
  Python interface.
- Removed Fink and DarwinPorts support.
- Enable USD in `blender_full.cmake`

===================================================================

M	CMakeLists.txt
M	build_files/build_environment/cmake/harvest.cmake
M	build_files/build_environment/cmake/usd.cmake
M	build_files/cmake/Modules/FindUSD.cmake
M	build_files/cmake/config/blender_full.cmake
M	build_files/cmake/platform/platform_unix.cmake
M	source/blender/usd/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b3dbb44297b..844b7329ec1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -337,7 +337,6 @@ option(WITH_ALEMBIC_HDF5        "Enable Legacy Alembic Support (not officially s
 
 # Universal Scene Description support
 option(WITH_USD                 "Enable Universal Scene Description (USD) Support" OFF)
-set(USD_PATH "/opt/usd" CACHE STRING "Universal Scene Description (USD) installation path")
 
 # 3D format support
 # Disable opencollada when we don't have precompiled libs
diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake
index 89eec7cf72f..0482f83d197 100644
--- a/build_files/build_environment/cmake/harvest.cmake
+++ b/build_files/build_environment/cmake/harvest.cmake
@@ -197,6 +197,11 @@ harvest(x264/lib ffmpeg/lib "*.a")
 harvest(xvidcore/lib ffmpeg/lib "*.a")
 harvest(embree/include embree/include "*.h")
 harvest(embree/lib embree/lib "*.a")
+harvest(usd/include usd/include "*.h")
+harvest(usd/lib usd/lib "*")
+harvest(usd/plugin usd/plugin "*")
+harvest(usd/pxrConfig.cmake usd/pxrConfig.cmake)
+harvest(usd/cmake/pxrTargets.cmake usd/cmake/pxrTargets.cmake)
 
 if(UNIX AND NOT APPLE)
   harvest(libglu/lib mesa/lib "*.so*")
diff --git a/build_files/build_environment/cmake/usd.cmake b/build_files/build_environment/cmake/usd.cmake
index 2f409fb9a84..29893f3ce9c 100644
--- a/build_files/build_environment/cmake/usd.cmake
+++ b/build_files/build_environment/cmake/usd.cmake
@@ -47,7 +47,6 @@ add_dependencies(
   external_usd
   external_tbb
   external_boost
-  external_python
 )
 
 if(WIN32)
diff --git a/build_files/cmake/Modules/FindUSD.cmake b/build_files/cmake/Modules/FindUSD.cmake
index 65716e97c66..88fb982eb00 100644
--- a/build_files/cmake/Modules/FindUSD.cmake
+++ b/build_files/cmake/Modules/FindUSD.cmake
@@ -28,12 +28,17 @@ ENDIF()
 SET(_usd_SEARCH_DIRS
   ${USD_ROOT_DIR}
   /usr/local
-  /sw # Fink
-  /opt/local # DarwinPorts
   /opt/lib/usd
   /opt/usd
 )
 
+FIND_PATH(USD_ROOT_DIR
+  NAMES
+    pxrConfig.cmake
+  HINTS
+    ${_usd_SEARCH_DIRS}
+)
+
 FIND_PATH(USD_INCLUDE_DIR
   NAMES
     pxr/usd/usd/api.h
@@ -55,16 +60,18 @@ FIND_LIBRARY(USD_LIBRARY
 # handle the QUIETLY and REQUIRED arguments and set USD_FOUND to TRUE if
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(USD DEFAULT_MSG USD_LIBRARY USD_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(USD DEFAULT_MSG USD_ROOT_DIR USD_LIBRARY USD_INCLUDE_DIR)
 
 IF(USD_FOUND)
   SET(USD_LIBRARIES ${USD_LIBRARY})
   SET(USD_INCLUDE_DIRS ${USD_INCLUDE_DIR})
+  SET(USD_ROOT_DIR ${USD_ROOT_DIR})
 ENDIF(USD_FOUND)
 
 MARK_AS_ADVANCED(
   USD_INCLUDE_DIR
   USD_LIBRARY
+  USD_ROOT_DIR
 )
 
 UNSET(_usd_SEARCH_DIRS)
diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake
index 56b970c349d..c942da2a9a6 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -49,6 +49,7 @@ set(WITH_PYTHON_INSTALL      ON  CACHE BOOL "" FORCE)
 set(WITH_QUADRIFLOW          ON  CACHE BOOL "" FORCE)
 set(WITH_SDL                 ON  CACHE BOOL "" FORCE)
 set(WITH_TBB                 ON  CACHE BOOL "" FORCE)
+set(WITH_USD                 ON  CACHE BOOL "" FORCE)
 set(WITH_X11_XINPUT          ON  CACHE BOOL "" FORCE)
 set(WITH_X11_XF86VMODE       ON  CACHE BOOL "" FORCE)
 
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index c48780ebd6a..d4a75e5e5c0 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -285,6 +285,14 @@ if(WITH_ALEMBIC)
   endif()
 endif()
 
+if(WITH_USD)
+  find_package_wrapper(USD)
+
+  if(NOT USD_FOUND)
+    set(WITH_USD OFF)
+  endif()
+endif()
+
 if(WITH_BOOST)
   # uses in build instructions to override include and library variables
   if(NOT BOOST_CUSTOM)
diff --git a/source/blender/usd/CMakeLists.txt b/source/blender/usd/CMakeLists.txt
index 4db95df83ed..b235146e6f5 100644
--- a/source/blender/usd/CMakeLists.txt
+++ b/source/blender/usd/CMakeLists.txt
@@ -18,7 +18,7 @@
 # All rights reserved.
 # ***** END GPL LICENSE BLOCK *****
 
-include(${USD_PATH}/pxrConfig.cmake)
+include(${USD_ROOT_DIR}/pxrConfig.cmake)
 
 # This suppresses the warning "This file includes at least one deprecated or antiquated header which
 # may be removed without further notice at a future date", which is caused by the USD library



More information about the Bf-blender-cvs mailing list