diff options
Diffstat (limited to 'source/blender/io/usd/CMakeLists.txt')
-rw-r--r-- | source/blender/io/usd/CMakeLists.txt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt index 2b5ea39617e..e2e959814fa 100644 --- a/source/blender/io/usd/CMakeLists.txt +++ b/source/blender/io/usd/CMakeLists.txt @@ -16,6 +16,24 @@ add_definitions(-DPXR_STATIC) # USD headers use deprecated TBB headers, silence warning. add_definitions(-DTBB_SUPPRESS_DEPRECATED_MESSAGES=1) +# Check if USD has the imaging headers available, if they are +# add a USD_HAS_IMAGING define so code can dynamically detect this. +# Cleanup of this variable is done at the end of the file since +# test code further down uses it to add imaging tests. +FIND_FILE(USD_IMAGING_HEADERS + NAMES + capsuleAdapter.h + PATHS + ${USD_INCLUDE_DIRS} + PATH_SUFFIXES + pxr/usdImaging/usdImaging/ + NO_DEFAULT_PATH +) + +if(USD_IMAGING_HEADERS) + add_definitions(-DUSD_HAS_IMAGING) +endif() + set(INC . ../common @@ -129,7 +147,13 @@ target_link_libraries(bf_usd INTERFACE ${TBB_LIBRARIES}) if(WITH_GTESTS) set(TEST_SRC tests/usd_stage_creation_test.cc + tests/usd_tests_common.cc + tests/usd_tests_common.h ) + if(USD_IMAGING_HEADERS) + LIST(APPEND TEST_SRC tests/usd_imaging_test.cc) + endif() + set(TEST_INC ) set(TEST_LIB @@ -137,3 +161,7 @@ if(WITH_GTESTS) include(GTestTesting) blender_add_test_lib(bf_io_usd_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") endif() + +# In cmake version 3.21 and up, we can instead use the NO_CACHE option for +# find_file so we don't need to clear it from the cache here. +unset(USD_IMAGING_HEADERS CACHE) |