From ffb9152991ff418a992e40f9acd4250113044123 Mon Sep 17 00:00:00 2001 From: Mark Callow <2244683+MarkCallow@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:44:21 +0900 Subject: [PATCH] Fix: ensure ktxdiff runs on macOS and enable CTS in Linux arm64 CI. (#946) Set INSTALL_RPATH in `ktxdiff`. Its absence meant macOS could not find libktx, if not installed on the system. Tests were succeeding on macOS x86_64 because all the outputs are exact matches for the golden files so `ktxdiff` was never invoked. Enable FEATURE_TOOLS_CTS for Linux arm64 build as https://github.com/KhronosGroup/KTX-Software-CTS/pull/30 fixes the previous failure. Fix syntax errors in Linux INSTALL_RPATH values. --- .travis.yml | 4 ++-- tests/CMakeLists.txt | 2 +- tests/cts | 2 +- tests/ktxdiff/CMakeLists.txt | 2 ++ tests/loadtests/glloadtests.cmake | 13 ++++--------- tests/loadtests/vkloadtests.cmake | 18 ++++++++++++++---- tools/CMakeLists.txt | 15 ++++++++++++++- 7 files changed, 38 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 23e898a1f1..85f1f5b8b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -113,7 +113,7 @@ jobs: - VULKAN_SDK_VER: "1.3.290" - CMAKE_GEN: Ninja - CONFIGURATION=Release - FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON + FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL+Vulkan FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=ON SUPPORT_SSE=ON SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES - os: linux arch: arm64 @@ -134,7 +134,7 @@ jobs: - CMAKE_GEN: Ninja - CONFIGURATION=Release FEATURE_DOC=ON FEATURE_JNI=ON FEATURE_PY=ON FEATURE_LOADTESTS=OpenGL - FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=OFF + FEATURE_TOOLS=ON FEATURE_TOOLS_CTS=ON SUPPORT_SSE=OFF SUPPORT_OPENCL=OFF WERROR=ON PACKAGE=YES - os: linux dist: jammy diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1d4c2d690e..ae48f2e8d7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -9,7 +9,7 @@ function(set_test_properties test_target) ) elseif(LINUX) set_target_properties(${test_target} PROPERTIES - INSTALL_RPATH "$ORIGIN;$ORIGIN/../lib" + INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../lib" ) endif() endfunction() diff --git a/tests/cts b/tests/cts index a99bad8b49..96bdfcd073 160000 --- a/tests/cts +++ b/tests/cts @@ -1 +1 @@ -Subproject commit a99bad8b49f952becf948c9c6440b1a9ff75e583 +Subproject commit 96bdfcd073c9c8712eb483991da4e7fbf9e5dff4 diff --git a/tests/ktxdiff/CMakeLists.txt b/tests/ktxdiff/CMakeLists.txt index 7aebeff4b1..a594132af3 100644 --- a/tests/ktxdiff/CMakeLists.txt +++ b/tests/ktxdiff/CMakeLists.txt @@ -44,3 +44,5 @@ target_compile_definitions( PRIVATE $ ) + +set_test_properties(ktxdiff) diff --git a/tests/loadtests/glloadtests.cmake b/tests/loadtests/glloadtests.cmake index b2d826360e..2a005aa414 100644 --- a/tests/loadtests/glloadtests.cmake +++ b/tests/loadtests/glloadtests.cmake @@ -263,17 +263,12 @@ 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}" + INSTALL_RPATH "\$ORIGIN;${CMAKE_INSTALL_FULL_LIBDIR}" ) ######### IMPORTANT ###### diff --git a/tests/loadtests/vkloadtests.cmake b/tests/loadtests/vkloadtests.cmake index c0fdac8066..3ebf51ee1b 100644 --- a/tests/loadtests/vkloadtests.cmake +++ b/tests/loadtests/vkloadtests.cmake @@ -368,11 +368,21 @@ 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 consider putting the executables 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 "${CMAKE_INSTALL_FULL_LIBDIR}" + INSTALL_RPATH "\$ORIGIN;${CMAKE_INSTALL_FULL_LIBDIR}" ) ######### IMPORTANT ###### diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index ffc1e365dd..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;$ORIGIN/../lib" + INSTALL_RPATH "\$ORIGIN;\$ORIGIN/../lib" ) endif() endfunction()