From 4cede5edcff96134baf35953d58595c4aa5f1fc5 Mon Sep 17 00:00:00 2001
From: Jose Quaresma <quaresma.jose@gmail.com>
Date: Sun, 7 Feb 2021 01:30:39 +0000
Subject: [PATCH] generate glslang pkg-config

Based on https://src.fedoraproject.org/rpms/glslang/blob/main/f/0001-pkg-config-compatibility.patch

Upstream-Status: Inappropriate [independently developed patch submitted at https://github.com/KhronosGroup/glslang/pull/3371]

Signed-off-by: Jose Quaresma <quaresma.jose@gmail.com>
---
 glslang/CMakeLists.txt      |  2 ++
 glslang/glslang.pc.cmake.in | 11 +++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 glslang/glslang.pc.cmake.in

diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt
index 37eecaad..6974935c 100644
--- a/glslang/CMakeLists.txt
+++ b/glslang/CMakeLists.txt
@@ -251,6 +251,8 @@ if(PROJECT_IS_TOP_LEVEL)
         ")
         install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
     endif()
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/glslang.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/glslang.pc @ONLY)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/glslang.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 
     set(PUBLIC_HEADERS
         Public/ResourceLimits.h
diff --git a/glslang/glslang.pc.cmake.in b/glslang/glslang.pc.cmake.in
new file mode 100644
index 00000000..43104e68
--- /dev/null
+++ b/glslang/glslang.pc.cmake.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
+
+Name: @PROJECT_NAME@
+Description: OpenGL and OpenGL ES shader front end and validator
+Requires:
+Version: @GLSLANG_VERSION@
+Libs: -L${libdir} -lglslang -lHLSL -lSPVRemapper
+Cflags: -I${includedir}
