Skip to content

Commit

Permalink
cmake: Fix vulkan.pc regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-lunarg committed Oct 9, 2023
1 parent 6d4f07c commit 520eaa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,14 @@ if (PKG_CONFIG_FOUND)

# BUG: The following code will NOT work well with `cmake --install ... --prefix <dir>`
# due to this code relying on CMAKE_INSTALL_PREFIX being defined at configure time.
#
# NOTE: vulkan.pc essentially cover both Vulkan-Loader and Vulkan-Headers for legacy reasons.
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
set(CMAKE_INSTALL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR})
set(CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_FULL_INCLUDEDIR})
else()
file(RELATIVE_PATH CMAKE_INSTALL_LIBDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_LIBDIR})
file(RELATIVE_PATH CMAKE_INSTALL_INCLUDEDIR_PC ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_FULL_INCLUDEDIR})
endif()
configure_file("vulkan.pc.in" "vulkan.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
Expand Down
8 changes: 7 additions & 1 deletion loader/vulkan.pc.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR_PC@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR_PC@

Name: Vulkan-Loader
Description: Vulkan Loader
Version: @VULKAN_LOADER_VERSION@
Libs: -L@CMAKE_INSTALL_LIBDIR_PC@ -lvulkan@VULKAN_LIB_SUFFIX@
Libs: -L${libdir} -lvulkan@VULKAN_LIB_SUFFIX@
Cflags: -I${includedir}

0 comments on commit 520eaa5

Please sign in to comment.