I downloaded the prebuilt USD SDK from Pixar Universal Scene Description USD | NVIDIA Developer, set up a basic CMake project, and extracted the SDK to {projectFolder}/thirdparty/pxr:
cmake_minimum_required(VERSION 3.8)
project("my-project")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/thirdparty")
link_directories(${CMAKE_CURRENT_LIST_DIR}/thirdparty/pxr/lib)
find_package(pxr REQUIRED)
add_executable(my-project "my-project.cpp" "my-project.h")
target_link_libraries(my-project
usd
)
I’m able to find the pxr package just fine, however, I immediately hit a problem in that the paths in pxr/cmake/pxrTargets.cmake
are not portable.
set_target_properties(tf PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "PXR_PYTHON_ENABLED=1"
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;E:/w/ca6c508eae419cf8/_dependencies/python3/include;E:/w/ca6c508eae419cf8/_install/win64_py36_release/include;E:/w/ca6c508eae419cf8/_install/win64_py36_release/include"
INTERFACE_LINK_LIBRARIES "arch;Shlwapi.lib;E:/w/ca6c508eae419cf8/_dependencies/python3/libs/python36.lib;E:/w/ca6c508eae419cf8/_install/win64_py36_release/lib/boost_python36-vc141-mt-x64-1_70.lib;E:/w/ca6c508eae419cf8/_install/win64_py36_release/lib/tbb.lib"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "E:/w/ca6c508eae419cf8/_dependencies/python3/include;E:/w/ca6c508eae419cf8/_install/win64_py36_release/include;E:/w/ca6c508eae419cf8/_install/win64_py36_release/include"
)
This E:/w/ca6c508eae419cf8
directory obviously doesn’t exist on my system. The correct paths are
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/../Python36/include;${_IMPORT_PREFIX}/include/boost-1_70"
INTERFACE_LINK_LIBRARIES "arch;Shlwapi.lib;${_IMPORT_PREFIX}/../Python36/libs/python36.lib;${_IMPORT_PREFIX}/lib/boost_python36-vc141-mt-x64-1_70.lib;${_IMPORT_PREFIX}/lib/tbb.lib"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../Python36/include;${_IMPORT_PREFIX}/include/boost-1_70"
well, aside from the Python path. The rest though are all relative to _IMPORT_PREFIX, so it’s not clear to me why these are absolute paths from some build agent. Similarly, I would expect the Python path to be pulled in from a cmake variable and not hardcoded with some build agent absolute path.
If I fix the paths as shown above, then I’m able to finish configuring fine. What gives with the absolute paths in the prebuilt SDK? Am I supposed to be using something else? Or is this just an oversight?