PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
6.17k stars 1.23k forks source link

pxrTargets.cmake requiring OpenGL when GL support disabled at build #3435

Open rishflab opened 1 day ago

rishflab commented 1 day ago

Description of Issue

The pxrTargets.cmake defines OpenGL as a dependency when GL support is disabled when running the build script.

//pxrTargets.cmake
# Create imported target garch
add_library(garch SHARED IMPORTED)

set_target_properties(garch PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "arch;tf;-framework Foundation;-framework AppKit;OpenGL::GL"
)

Removing OpenGL::GL fixes the error

CMake Error at /$HOME/OpenUSDInstall/cmake/pxrTargets.cmake:329 (set_target_properties): The link interface of target "garch" contains:

OpenGL::GL

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

Call Stack (most recent call first): /Users/rishflab/OpenUSDInstall/pxrConfig.cmake:77 (include) CMakeLists.txt:8 (find_package)

Steps to Reproduce

  1. Build using to disable OpenGL dependency
    
    python OpenUSD/build_scripts/build_usd.py OpenUSDInstall --build-args USD,"DPXR_ENABLE_GL_SUPPORT=FALSE" --no-python
2. create a project with OpenUSD as a dependency

find_package(pxr REQUIRED PATHS $HOME/OpenUSDInstall)

target_link_libraries(view METAL_CPP ${PXR_LIBRARIES})

target_include_directories(view PRIVATE ${PXR_INCLUDE_DIRS})


3. build the project 

cmake -D CMAKE_BUILD_TYPE=Debug -S . -B build cmake --build build --target view


### System Information (OS, Hardware)
Mac OS, M3 Max

### Package Versions
OpenUSD 24.11

### Build Flags

python OpenUSD/build_scripts/build_usd.py OpenUSDInstall --build-args USD,"DPXR_ENABLE_GL_SUPPORT=FALSE" --no-python

jesschimein commented 9 hours ago

Filed as internal issue #USD-10459