diff mbox series

[v2,1/3] spirv-tools: Correctly set the prefix in exported cmake packages

Message ID 20221111214714.9939-2-jorcrous@amazon.com
State Accepted, archived
Commit ca2d6d9164fba91d86357e56617b58eeeeb76d72
Headers show
Series Add vulkan validation and improvements for headless devices | expand

Commit Message

Jordan Crouse Nov. 11, 2022, 9:47 p.m. UTC
spirv-tools exports Cmake packages.  When they are installed the
INTERFACE_LINK_LIBRARIES variable is not correctly updated to use
_IMPORT_PREFIX like the other variables. This may have something to do with
the path to the sysroot being different than the source path.

The existing recipe recognizes that the sysroot path made it through to the
install and tries to get rid of it, but this just ends up with dependent
tools looking in vain for /usr/lib/librt.so.

Replace the INTERFACE_LINK_LIBRARIES value in SPIRV-ToolsTarget.cmake with
"${IMPORT_PREFIX}/lib".

Signed-off-by: Jordan Crouse <jorcrous@amazon.com>
---

Changes in v2:
- Don't change PR per Khem Raj

 meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
index ea47796543..e175cde145 100644
--- a/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
+++ b/meta/recipes-graphics/spir/spirv-tools_1.3.231.1.bb
@@ -25,9 +25,10 @@  EXTRA_OECMAKE += "\
 "
 
 do_install:append:class-target() {
-    # reproducibility: remove build host path
+    # Properly set _IMPORT_PREFIX in INTERFACE_LINK_LIBRARIES so that dependent
+    # tools can find the right library
     sed -i ${D}${libdir}/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake \
-        -e 's:${STAGING_DIR_HOST}::g'
+        -e 's:INTERFACE_LINK_LIBRARIES.*$:INTERFACE_LINK_LIBRARIES "\$\{_IMPORT_PREFIX\}/lib":'
 }
 
 # all the libraries are unversioned, so don't pack it on PN-dev