diff --git a/.github/workflows/ci-steps.yaml b/.github/workflows/ci-steps.yaml index ae7f7091..3c13d620 100644 --- a/.github/workflows/ci-steps.yaml +++ b/.github/workflows/ci-steps.yaml @@ -73,15 +73,15 @@ jobs: fi export DISPLAY=:99 - # Set library path for USD dependencies - export LD_LIBRARY_PATH="$PWD/build/${{ inputs.build_type }}/vcpkg_installed/x64-linux-hvt/lib:$LD_LIBRARY_PATH" - # Verify GPU setup echo "GPU Info:" nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv,noheader echo "OpenGL Renderer:" glxinfo | grep -E "(OpenGL version|OpenGL renderer)" + # Set LD_LIBRARY_PATH for USD plugins (not mandatory for tests to pass, but suppresses plugin loading warnings) + export LD_LIBRARY_PATH=${{ github.workspace }}/out/build/${{ inputs.build_type }}/bin:$LD_LIBRARY_PATH + # Run the tests ctest --preset ${{ inputs.build_type }} --output-on-failure diff --git a/CMakeLists.txt b/CMakeLists.txt index bf04bcb9..a4a82f07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,20 +41,33 @@ include(VcpkgSetup) # NOTE: We can't use PROJECT_IS_TOP_LEVEL here because the project is not yet defined. string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" _HVT_PROJECT_IS_TOP_LEVEL) -# Variables that need to be set prior to the project definition. +# RPATH for Linux and macOS if (_HVT_PROJECT_IS_TOP_LEVEL AND UNIX) - set_if_not_defined(CMAKE_SKIP_BUILD_RPATH TRUE "") + # Set platform-specific RPATH syntax + if (APPLE) + set(_rpath "@loader_path/;@loader_path/../lib/") + set_if_not_defined(CMAKE_MACOSX_RPATH ON "") + else() + # Linux + set(_rpath "$ORIGIN:$ORIGIN/../lib") + endif() + + # Common RPATH settings for all UNIX platforms + set_if_not_defined(CMAKE_SKIP_BUILD_RPATH FALSE "") set_if_not_defined(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE "") - set_if_not_defined(CMAKE_INSTALL_RPATH "@loader_path/" "") + set_if_not_defined(CMAKE_INSTALL_RPATH "${_rpath}" "") set_if_not_defined(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE "") +endif() - # macOS specific (ignored on other platforms) +# Apple-specific configuration +if (_HVT_PROJECT_IS_TOP_LEVEL AND APPLE) + set_if_not_defined(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" "Minimum OSX deployment version") + + # Validate architecture (universal builds not supported due to libjpeg-turbo) list(LENGTH CMAKE_OSX_ARCHITECTURES osx_arch_count) if(osx_arch_count GREATER 1) message(FATAL_ERROR "Universal builds are not supported because of libjpeg-turbo") endif() - set_if_not_defined(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" "Minimum OSX deployment version") - set_if_not_defined(CMAKE_MACOSX_RPATH ON "") endif() # Enable only the typical build types. diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 84d1be32..05e1a0b2 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -66,28 +66,8 @@ add_executable(${_TARGET} # (where the single-configuration generators do not) invalidating/changing some predefined paths. get_cmake_property(_MULTI_CONFIG GENERATOR_IS_MULTI_CONFIG) -if (UNIX) - # Do not copy the third-party libraries by updating the rpath with: - # 1. The OpenUSD library location. - # 2. The default library location. - # 3. The OpenUSD plugins location. - # Note: Handle the multi-generator cases. - - if(_MULTI_CONFIG) - set(openusd_path_gen "$,${OPENUSD_INSTALL_PATH_DEBUG},${OPENUSD_INSTALL_PATH}>") - list(APPEND _RPATH "${openusd_path_gen}/lib") - list(APPEND _RPATH "${openusd_path_gen}/plugin") - list(APPEND _RPATH "${_HVT_OUTPUT_DIR}/lib/$") - else() - list(APPEND _RPATH "${OPENUSD_INSTALL_PATH}/lib") - list(APPEND _RPATH "${OPENUSD_INSTALL_PATH}/plugin") - list(APPEND _RPATH "${_HVT_OUTPUT_DIR}/lib") - endif() - - set_target_properties(${_TARGET} PROPERTIES INSTALL_RPATH "${_RPATH}") -elseif (WIN32) - # On the Windows platform, the safest approach is to copy libraries where are the executables. - +# On Windows, copy USD DLLs and plugins to the test executable directory +if (WIN32) if(_MULTI_CONFIG) set(_CONFIGS ${CMAKE_CONFIGURATION_TYPES}) else() @@ -144,8 +124,6 @@ elseif (WIN32) endif() endforeach() -else() - message(FATAL_ERROR "Platform not supported") endif() target_link_libraries(${_TARGET}