diff options
author | Patrick Mours <pmours@nvidia.com> | 2022-03-31 20:27:32 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2022-04-05 18:23:52 +0300 |
commit | f60cffad38d12bdfefe503924e93c33a7c89f671 (patch) | |
tree | e741cf808bd41be36f5e5dde6bdd2aa96fcb8eae /intern/cycles/CMakeLists.txt | |
parent | 190334b47df46f0e912c873077163e6129e4cbae (diff) |
Cycles: Use USD dependencies when building Hydra render delegate
Adds support for linking with some of the dependencies of a USD
build instead of the precompiled libraries from Blender, specifically
OpenSubdiv, OpenVDB and TBB. Other dependencies keep using the
precompiled libraries from Blender, since they are linked statically
anyway so it does't matter as much. Plus they have interdependencies
that are difficult to resolve when only using selected libraries from
the USD build and can't simply assume that USD was built with all
of them.
This patch also makes building the Hydra render delegate via the
standalone repository work and fixes various small issues I ran into
in general on Windows (e.g. the use of both fixed paths and
`find_package` did not seem to work correctly). Building both the
standalone Cycles application and the Hydra render delegate at the
same time is supported now as well (the paths in the USD plugin JSON
file are updated accordingly).
All that needs to be done now to build is to specify a `PXR_ROOT`
or `USD_ROOT` CMake variable pointing to the USD installation,
everything else is taken care of automatically (CMake targets are
loaded from the `pxrTargets.cmake` of USD and linked into the
render delegate and OpenSubdiv, OpenVDB and TBB are replaced
with those from USD when they exist).
Differential Revision: https://developer.blender.org/D14523
Diffstat (limited to 'intern/cycles/CMakeLists.txt')
-rw-r--r-- | intern/cycles/CMakeLists.txt | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index 1cc3dccf426..911e1cf214c 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -3,11 +3,7 @@ # Standalone or with Blender if(NOT WITH_BLENDER) - if(WITH_CYCLES_STANDALONE OR NOT WITH_CYCLES_HYDRA_RENDER_DELEGATE) - set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) - else() - set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/hdCycles/resources) - endif() + set(CYCLES_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) else() set(WITH_CYCLES_BLENDER ON) # WINDOWS_PYTHON_DEBUG needs to write into the user addons folder since it will @@ -219,6 +215,15 @@ add_definitions( -DCCL_NAMESPACE_END=} ) +include_directories( + SYSTEM + ${BOOST_INCLUDE_DIR} + ${OPENIMAGEIO_INCLUDE_DIRS} + ${OPENEXR_INCLUDE_DIRS} + ${PUGIXML_INCLUDE_DIR} + ${TBB_INCLUDE_DIRS} +) + if(WITH_CYCLES_DEBUG) add_definitions(-DWITH_CYCLES_DEBUG) endif() @@ -259,7 +264,6 @@ endif() if(WITH_CYCLES_EMBREE) add_definitions(-DWITH_EMBREE) - add_definitions(-DEMBREE_STATIC_LIB) include_directories( SYSTEM ${EMBREE_INCLUDE_DIRS} @@ -284,7 +288,6 @@ endif() if(WITH_OPENIMAGEDENOISE) add_definitions(-DWITH_OPENIMAGEDENOISE) - add_definitions(-DOIDN_STATIC_LIB) include_directories( SYSTEM ${OPENIMAGEDENOISE_INCLUDE_DIRS} @@ -312,17 +315,6 @@ if(NOT OPENIMAGEIO_PUGIXML_FOUND) add_definitions(-DWITH_SYSTEM_PUGIXML) endif() -include_directories( - SYSTEM - ${BOOST_INCLUDE_DIR} - ${OPENIMAGEIO_INCLUDE_DIRS} - ${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO - ${OPENEXR_INCLUDE_DIR} - ${OPENEXR_INCLUDE_DIRS} - ${PUGIXML_INCLUDE_DIR} - ${TBB_INCLUDE_DIRS} -) - if(CYCLES_STANDALONE_REPOSITORY) include_directories(../third_party/atomic) else() @@ -339,10 +331,13 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang") unset(_has_no_error_unused_macros) endif() -if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND NOT WITH_USD) +if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND (NOT WITH_USD)) message(STATUS "USD not found, disabling WITH_CYCLES_HYDRA_RENDER_DELEGATE") set(WITH_CYCLES_HYDRA_RENDER_DELEGATE OFF) endif() +if(WITH_CYCLES_HYDRA_RENDER_DELEGATE AND (NOT WITH_BLENDER) AND (NOT WITH_CYCLES_STANDALONE)) + set(CYCLES_INSTALL_PATH ${CYCLES_INSTALL_PATH}/hdCycles/resources) +endif() if(WITH_CYCLES_CUDA_BINARIES AND (NOT WITH_CYCLES_CUBIN_COMPILER)) if(MSVC) |