loader: Fix setting `libdir` in generated vulkan.pc on Windows
authorRalf Habacker <ralf.habacker@freenet.de>
Tue, 7 Sep 2021 11:12:10 +0000 (13:12 +0200)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 29 Sep 2021 20:59:11 +0000 (14:59 -0600)
Fixes #668

loader/CMakeLists.txt
loader/vulkan.pc.in

index 56ff014d24a550d368e3de34c9890d199edf3278..c266f6bf0f258a6790ef688d894d2d929bcfe556 100644 (file)
@@ -377,6 +377,15 @@ if(PKG_CONFIG_FOUND)
     endforeach()
     if(WIN32)
         set(VULKAN_LIB_SUFFIX "-1")
+        # Set libdir path as in cmake's FindVulkan.cmake
+        # https://github.com/KhronosGroup/Vulkan-Loader/issues/668
+        if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+            string(REPLACE "lib" "Lib" CMAKE_INSTALL_FULL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR})
+        else()
+            string(REPLACE "lib" "Lib32" CMAKE_INSTALL_FULL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR})
+        endif()
+    else()
+        set(CMAKE_INSTALL_FULL_LIBDIR_PC ${CMAKE_INSTALL_FULL_LIBDIR})
     endif ()
     configure_file("vulkan.pc.in" "vulkan.pc" @ONLY)
     install(FILES "${CMAKE_CURRENT_BINARY_DIR}/vulkan.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
index 44049ee34e12fedf5dcd41d2b51c48f8ca5858f8..648caf061b0a6e3fcacd8d6a1dd733dc77042b0b 100644 (file)
@@ -1,6 +1,6 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@
+libdir=@CMAKE_INSTALL_FULL_LIBDIR_PC@
 includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
 
 Name: @CMAKE_PROJECT_NAME@