diff --git a/tests/loadtests/glloadtests.cmake b/tests/loadtests/glloadtests.cmake index 4040bf61cf..2a005aa414 100644 --- a/tests/loadtests/glloadtests.cmake +++ b/tests/loadtests/glloadtests.cmake @@ -263,14 +263,9 @@ function( create_gl_target target version sources common_resources test_images $/../resources ) - # To keep the resources (test images and models) close to the - # executable and to be compliant with the Filesystem Hierarchy - # Standard https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html - # we have chosen to install the apps and data in /opt/. - # Each target has a `bin` directory with the executable and a - # `resources` directory with the resources. We install a symbolic - # link to the executable in ${CMAKE_INSTALL_LIBDIR}, usually - # /usr/local/bin. + # See important comment and TODO:s starting at line 365 + # in ./vkloadtests.cmake regarding installation of these + # targets. Search for "keep the resources". set_target_properties( ${target} PROPERTIES INSTALL_RPATH "\$ORIGIN;${CMAKE_INSTALL_FULL_LIBDIR}" diff --git a/tests/loadtests/vkloadtests.cmake b/tests/loadtests/vkloadtests.cmake index 86615b7288..75ee25678b 100644 --- a/tests/loadtests/vkloadtests.cmake +++ b/tests/loadtests/vkloadtests.cmake @@ -368,9 +368,19 @@ else() # we have chosen to install the apps and data in /opt/. # Each target has a `bin` directory with the executable and a # `resources` directory with the resources. We install a symbolic - # link to the executable in ${CMAKE_INSTALL_LIBDIR}, usually - # /usr/local/bin. - + # link to the executable in ${CMAKE_INSTALL_BINDIR}, usually + # /usr/local/bin, instead of adding /opt//bin to $PATH. + # + # TODO: Figure out how to handle libktx so installs of tools only, + # tools + loadtests and loadtests only are supported. Only put + # library in /usr/local/lib? Duplicate it in /opt//lib + # from where it is shared by gl3loadtests and vkloadtests? Only + # put it in /opt//lib with link from + # ${CMAKE_INSTALL_LIBDIR}? NOTE: if we put lib in /opt/ + # then the executables must be in /opt/provider/. + + # TODO: Before adding this target to the release packages, ensure + # this RPATH will work for alternate install root. set_target_properties( vkloadtests PROPERTIES INSTALL_RPATH "\$ORIGIN;${CMAKE_INSTALL_FULL_LIBDIR}" ) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index c2387bbd61..934c928993 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -13,6 +13,10 @@ endif() function(set_tool_properties tool_target) if(APPLE) + # The first RPATH entry is so executables run in the build + # directories will work and will find the just built libraries + # instead of whatever may be installed on the system. The + # second RPATH entry is for finding the installed library. set_target_properties(${tool_target} PROPERTIES XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME "YES" # Creates an LC_RPATH entry in the Mac-O binary for each @@ -39,10 +43,19 @@ function(set_tool_properties tool_target) # - Default path: /lib;/usr/lib. # $ORIGIN is equivalent to @executable_path. # + # Use relative path to installed lib so users can change + # installation location. Using CMAKE_INSTALL_FULL_LIBDIR + # would not work when changing the location during package + # install only when changing the installation location + # during `cmake --build` or `cmake --install`. The second + # entry may not be necessary as users installing to an + # alternate location will likely have it set in their + # LD_LIBRARY_PATH or /etc/ld.so.conf. + # # Check DT_RUNPATH with one of # - readelf -d | head -20 # - objdump -x | grep 'R.*PATH' - INSTALL_RPATH "\$ORIGIN;${CMAKE_INSTALL_FULL_LIBDIR}" + INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../lib" ) endif() endfunction()