Prebuilt USD cmake files have nonportable paths

I downloaded the prebuilt USD SDK from https://developer.nvidia.com/usd, 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?

Hi @dwarwick. Thanks for reporting this. I was able to verify this myself. I’ll check with the team to see what can be done to smooth this process. I also want to mention that the USD repo has good build instructions in case you need to build USD for yourself: GitHub - PixarAnimationStudios/USD: Universal Scene Description

We’ve logged OM-51247 for this issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.