mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
Use cmake configs to find USD
Also renamed `USD::` namespace to `pxr::` to match packaage name.
This commit is contained in:
@@ -224,7 +224,7 @@ endif()
|
||||
set(USD_LIBRARIES "")
|
||||
if(USD_SUPPORT)
|
||||
find_package(USD REQUIRED)
|
||||
set(USD_LIBRARIES USD::USD)
|
||||
set(USD_LIBRARIES pxr::USD)
|
||||
endif(USD_SUPPORT)
|
||||
|
||||
if (WITH_ROCKSDB)
|
||||
|
||||
+21
-9
@@ -5,17 +5,29 @@
|
||||
# - `TBB_INCLUDE_DIR`
|
||||
# - `TBB_LIBRARY_DIR`
|
||||
# Input variables could also be provided as environment variables.
|
||||
# TODO: Try to find USD config if varibales are not provided.
|
||||
# TODO: does usd have a config file?
|
||||
# If `USD_INCLUDE_DIR` and `USD_LIBRARY_DIR` are not provided,
|
||||
# try to find USD by locating its config file.
|
||||
#
|
||||
# Output targets:
|
||||
# - `USD::USD`
|
||||
# - `pxr::USD`
|
||||
|
||||
UNIFY_ENVVARS_AND_CACHE(USD_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(USD_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(TBB_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(TBB_LIBRARY_DIR)
|
||||
|
||||
|
||||
if(NOT USD_LIBRARY_DIR AND NOT USD_INCLUDE_DIR)
|
||||
find_package(pxr CONFIG)
|
||||
if(pxr_FOUND)
|
||||
add_library(pxr::USD INTERFACE IMPORTED)
|
||||
target_link_libraries(pxr::USD INTERFACE ${PXR_LIBRARIES})
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(USD REQUIRED_VARS pxr_DIR)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT USD_INCLUDE_DIR)
|
||||
find_path(USD_INCLUDE_DIR pxr.h
|
||||
PATHS
|
||||
@@ -65,31 +77,31 @@ else()
|
||||
message(FATAL_ERROR "Unable to find USD libraries in: ${USD_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
add_library(USD::USD INTERFACE IMPORTED)
|
||||
target_link_directories(USD::USD
|
||||
add_library(pxr::USD INTERFACE IMPORTED)
|
||||
target_link_directories(pxr::USD
|
||||
INTERFACE
|
||||
${USD_LIBRARY_DIR} ${TBB_LIBRARY_DIR}
|
||||
)
|
||||
target_include_directories(USD::USD
|
||||
target_include_directories(pxr::USD
|
||||
INTERFACE
|
||||
${USD_INCLUDE_DIR} ${TBB_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# We don't link TBB libraries - on Windows they're provided using `pragma(lib)`.
|
||||
# On Unix there's no `pragma(lib)`, so in theory it will break.
|
||||
target_link_libraries(USD::USD
|
||||
target_link_libraries(pxr::USD
|
||||
INTERFACE
|
||||
${USD_LIBRARIES}
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(USD::USD
|
||||
target_link_libraries(pxr::USD
|
||||
INTERFACE
|
||||
debug DbgHelp.lib
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(USD::USD
|
||||
target_compile_definitions(pxr::USD
|
||||
INTERFACE
|
||||
PXR_STATIC WITH_USD
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user