mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +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 "")
|
set(USD_LIBRARIES "")
|
||||||
if(USD_SUPPORT)
|
if(USD_SUPPORT)
|
||||||
find_package(USD REQUIRED)
|
find_package(USD REQUIRED)
|
||||||
set(USD_LIBRARIES USD::USD)
|
set(USD_LIBRARIES pxr::USD)
|
||||||
endif(USD_SUPPORT)
|
endif(USD_SUPPORT)
|
||||||
|
|
||||||
if (WITH_ROCKSDB)
|
if (WITH_ROCKSDB)
|
||||||
|
|||||||
+21
-9
@@ -5,17 +5,29 @@
|
|||||||
# - `TBB_INCLUDE_DIR`
|
# - `TBB_INCLUDE_DIR`
|
||||||
# - `TBB_LIBRARY_DIR`
|
# - `TBB_LIBRARY_DIR`
|
||||||
# Input variables could also be provided as environment variables.
|
# Input variables could also be provided as environment variables.
|
||||||
# TODO: Try to find USD config if varibales are not provided.
|
# If `USD_INCLUDE_DIR` and `USD_LIBRARY_DIR` are not provided,
|
||||||
# TODO: does usd have a config file?
|
# try to find USD by locating its config file.
|
||||||
#
|
#
|
||||||
# Output targets:
|
# Output targets:
|
||||||
# - `USD::USD`
|
# - `pxr::USD`
|
||||||
|
|
||||||
UNIFY_ENVVARS_AND_CACHE(USD_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(USD_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(USD_LIBRARY_DIR)
|
UNIFY_ENVVARS_AND_CACHE(USD_LIBRARY_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(TBB_INCLUDE_DIR)
|
UNIFY_ENVVARS_AND_CACHE(TBB_INCLUDE_DIR)
|
||||||
UNIFY_ENVVARS_AND_CACHE(TBB_LIBRARY_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)
|
if(NOT USD_INCLUDE_DIR)
|
||||||
find_path(USD_INCLUDE_DIR pxr.h
|
find_path(USD_INCLUDE_DIR pxr.h
|
||||||
PATHS
|
PATHS
|
||||||
@@ -65,31 +77,31 @@ else()
|
|||||||
message(FATAL_ERROR "Unable to find USD libraries in: ${USD_LIBRARY_DIR}")
|
message(FATAL_ERROR "Unable to find USD libraries in: ${USD_LIBRARY_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(USD::USD INTERFACE IMPORTED)
|
add_library(pxr::USD INTERFACE IMPORTED)
|
||||||
target_link_directories(USD::USD
|
target_link_directories(pxr::USD
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${USD_LIBRARY_DIR} ${TBB_LIBRARY_DIR}
|
${USD_LIBRARY_DIR} ${TBB_LIBRARY_DIR}
|
||||||
)
|
)
|
||||||
target_include_directories(USD::USD
|
target_include_directories(pxr::USD
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${USD_INCLUDE_DIR} ${TBB_INCLUDE_DIR}
|
${USD_INCLUDE_DIR} ${TBB_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# We don't link TBB libraries - on Windows they're provided using `pragma(lib)`.
|
# 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.
|
# On Unix there's no `pragma(lib)`, so in theory it will break.
|
||||||
target_link_libraries(USD::USD
|
target_link_libraries(pxr::USD
|
||||||
INTERFACE
|
INTERFACE
|
||||||
${USD_LIBRARIES}
|
${USD_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_link_libraries(USD::USD
|
target_link_libraries(pxr::USD
|
||||||
INTERFACE
|
INTERFACE
|
||||||
debug DbgHelp.lib
|
debug DbgHelp.lib
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(USD::USD
|
target_compile_definitions(pxr::USD
|
||||||
INTERFACE
|
INTERFACE
|
||||||
PXR_STATIC WITH_USD
|
PXR_STATIC WITH_USD
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-4
@@ -1407,11 +1407,11 @@ else:
|
|||||||
cmake_args.append("-DHDF5_SUPPORT=Off")
|
cmake_args.append("-DHDF5_SUPPORT=Off")
|
||||||
|
|
||||||
if "usd" in targets:
|
if "usd" in targets:
|
||||||
cmake_args.extend(
|
cmake_args.append("-DUSD_SUPPORT=ON")
|
||||||
|
cmake_args_prefix_path.extend(
|
||||||
[
|
[
|
||||||
f"-DUSD_SUPPORT=" "On",
|
f"{DEPS_DIR}/install/tbb-{TBB_VERSION}",
|
||||||
f"-DUSD_INCLUDE_DIR={DEPS_DIR}/install/usd-{USD_VERSION}/include",
|
f"{DEPS_DIR}/install/usd-{USD_VERSION}",
|
||||||
f"-DUSD_LIBRARY_DIR={DEPS_DIR}/install/usd-{USD_VERSION}/lib",
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -118,10 +118,8 @@ set MPFR_LIBRARY_DIR=%INSTALL_DIR%\mpfr
|
|||||||
:: We don't install Eigen currently,
|
:: We don't install Eigen currently,
|
||||||
:: so there's no Eigen3config.cmake and therefore we provide path explicitly.
|
:: so there's no Eigen3config.cmake and therefore we provide path explicitly.
|
||||||
set EIGEN_DIR=%INSTALL_DIR%\Eigen
|
set EIGEN_DIR=%INSTALL_DIR%\Eigen
|
||||||
set USD_INCLUDE_DIR=%INSTALL_DIR%\usd\include
|
set TBB_INSTALL_DIR=%INSTALL_DIR%\tbb
|
||||||
set USD_LIBRARY_DIR=%INSTALL_DIR%\usd\lib
|
set USD_INSTALL_DIR=%INSTALL_DIR%\usd
|
||||||
set TBB_INCLUDE_DIR=%INSTALL_DIR%\tbb\include
|
|
||||||
set TBB_LIBRARY_DIR=%INSTALL_DIR%\tbb\lib
|
|
||||||
set ROCKSDB_INSTALL_DIR=%INSTALL_DIR%\rocksdb
|
set ROCKSDB_INSTALL_DIR=%INSTALL_DIR%\rocksdb
|
||||||
set ZSTD_INSTALL_DIR=%INSTALL_DIR%\zstd
|
set ZSTD_INSTALL_DIR=%INSTALL_DIR%\zstd
|
||||||
|
|
||||||
@@ -155,10 +153,8 @@ echo GMP_LIBRARY_DIR = %GMP_LIBRARY_DIR%
|
|||||||
echo MPFR_INCLUDE_DIR = %MPFR_INCLUDE_DIR%
|
echo MPFR_INCLUDE_DIR = %MPFR_INCLUDE_DIR%
|
||||||
echo MPFR_LIBRARY_DIR = %MPFR_LIBRARY_DIR%
|
echo MPFR_LIBRARY_DIR = %MPFR_LIBRARY_DIR%
|
||||||
echo EIGEN_DIR = %EIGEN_DIR%
|
echo EIGEN_DIR = %EIGEN_DIR%
|
||||||
echo USD_INCLUDE_DIR = %USD_INCLUDE_DIR%
|
echo TBB_INSTALL_DIR = %TBB_INSTALL_DIR%
|
||||||
echo USD_LIBRARY_DIR = %USD_LIBRARY_DIR%
|
echo USD_INSTALL_DIR = %USD_INSTALL_DIR%
|
||||||
echo TBB_INCLUDE_DIR = %TBB_INCLUDE_DIR%
|
|
||||||
echo TBB_LIBRARY_DIR = %TBB_LIBRARY_DIR%
|
|
||||||
echo ROCKSDB_INSTALL_DIR = %ROCKSDB_INSTALL_DIR%
|
echo ROCKSDB_INSTALL_DIR = %ROCKSDB_INSTALL_DIR%
|
||||||
echo ZSTD_INSTALL_DIR = %ZSTD_INSTALL_DIR%
|
echo ZSTD_INSTALL_DIR = %ZSTD_INSTALL_DIR%
|
||||||
echo CCACHE_INSTALL_DIR = %CCACHE_INSTALL_DIR%
|
echo CCACHE_INSTALL_DIR = %CCACHE_INSTALL_DIR%
|
||||||
@@ -174,6 +170,7 @@ echo "Running CMake for %PROJECT_NAME%."
|
|||||||
set CMAKE_PREFIX_PATH=%HDF5_INSTALL_DIR%;%OPENCOLLADA_INSTALL_DIR%;%SWIG_INSTALL_DIR%
|
set CMAKE_PREFIX_PATH=%HDF5_INSTALL_DIR%;%OPENCOLLADA_INSTALL_DIR%;%SWIG_INSTALL_DIR%
|
||||||
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROCKSDB_INSTALL_DIR%;%ZSTD_INSTALL_DIR%
|
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROCKSDB_INSTALL_DIR%;%ZSTD_INSTALL_DIR%
|
||||||
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_INSTALL_DIR%;%CCACHE_INSTALL_DIR%
|
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_INSTALL_DIR%;%CCACHE_INSTALL_DIR%
|
||||||
|
set CMake_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%USD_INSTALL_DIR%;%TBB_INSTALL_DIR%
|
||||||
|
|
||||||
:: Not fully supported - not available from install-ifcopenshell
|
:: Not fully supported - not available from install-ifcopenshell
|
||||||
:: and some logs are still showing Visual Studio generators.
|
:: and some logs are still showing Visual Studio generators.
|
||||||
|
|||||||
Reference in New Issue
Block a user