glslang/0001-pkg-config-compatibility.patch

180 lines
7.6 KiB
Diff
Raw Normal View History

2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/CMakeLists.txt.dma glslang-sdk-1.3.224.0/CMakeLists.txt
--- glslang-sdk-1.3.224.0/CMakeLists.txt.dma 2022-08-13 01:32:10.000000000 +1000
+++ glslang-sdk-1.3.224.0/CMakeLists.txt 2022-08-24 11:02:14.557865460 +1000
@@ -129,6 +129,13 @@ if(USE_CCACHE)
2021-11-23 07:38:43 +00:00
endif()
2020-08-05 01:16:16 +00:00
endif()
2019-11-13 05:16:50 +00:00
+# using pkg-config to configure include paths and link libraries
+include(FindPkgConfig)
+pkg_check_modules(SPIRV_TOOLS REQUIRED SPIRV-Tools>=2019.2.1)
+if(BUILD_SHARED_LIBS)
+ pkg_check_modules(SPIRV_TOOLS_SHARED REQUIRED SPIRV-Tools-shared>=2019.2.1)
+endif(BUILD_SHARED_LIBS)
2019-11-13 05:16:50 +00:00
+
if(ENABLE_CTEST)
include(CTest)
endif()
2022-08-24 01:09:58 +00:00
@@ -319,11 +326,7 @@ if(BUILD_EXTERNAL AND IS_DIRECTORY ${CMA
2020-08-05 01:16:16 +00:00
add_subdirectory(External)
2019-11-13 05:16:50 +00:00
endif()
-if(NOT TARGET SPIRV-Tools-opt)
- set(ENABLE_OPT OFF)
-endif()
-
-if(ENABLE_OPT)
+if(${SPIRV_TOOLS_FOUND} EQUAL 1)
message(STATUS "optimizer enabled")
add_definitions(-DENABLE_OPT=1)
else()
2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/External/CMakeLists.txt.dma glslang-sdk-1.3.224.0/External/CMakeLists.txt
--- glslang-sdk-1.3.224.0/External/CMakeLists.txt.dma 2022-08-13 01:32:10.000000000 +1000
+++ glslang-sdk-1.3.224.0/External/CMakeLists.txt 2022-08-24 11:02:14.564865557 +1000
2020-08-05 01:16:16 +00:00
@@ -68,10 +68,3 @@ if(BUILD_TESTING)
2019-11-13 05:16:50 +00:00
endif()
endif()
-if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt)
- if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools)
- set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests")
- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools)
- endif()
-endif()
-
2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/glslang/CMakeLists.txt.dma glslang-sdk-1.3.224.0/glslang/CMakeLists.txt
--- glslang-sdk-1.3.224.0/glslang/CMakeLists.txt.dma 2022-08-24 11:02:14.566865585 +1000
+++ glslang-sdk-1.3.224.0/glslang/CMakeLists.txt 2022-08-24 11:02:32.673116232 +1000
@@ -220,6 +220,8 @@ if(ENABLE_GLSLANG_INSTALL)
add_library(GenericCodeGen ALIAS glslang::GenericCodeGen)
endif()
")
2020-04-22 01:15:06 +00:00
+ 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)
2022-08-24 01:09:58 +00:00
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/glslangTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
2020-08-05 01:16:16 +00:00
2022-08-24 01:09:58 +00:00
set(ALL_HEADERS
diff -up glslang-sdk-1.3.224.0/glslang/glslang.pc.cmake.in.dma glslang-sdk-1.3.224.0/glslang/glslang.pc.cmake.in
--- glslang-sdk-1.3.224.0/glslang/glslang.pc.cmake.in.dma 2022-08-24 11:02:14.567865599 +1000
+++ glslang-sdk-1.3.224.0/glslang/glslang.pc.cmake.in 2022-08-24 11:02:14.567865599 +1000
2019-11-13 05:16:50 +00:00
@@ -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: @VERSION@
+ Libs: -L${libdir} -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper
+ Cflags: -I${includedir}
\ No newline at end of file
2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/SPIRV/CMakeLists.txt.dma glslang-sdk-1.3.224.0/SPIRV/CMakeLists.txt
--- glslang-sdk-1.3.224.0/SPIRV/CMakeLists.txt.dma 2022-08-13 01:32:10.000000000 +1000
+++ glslang-sdk-1.3.224.0/SPIRV/CMakeLists.txt 2022-08-24 11:02:39.022204124 +1000
2020-08-05 01:16:16 +00:00
@@ -77,6 +77,10 @@ target_include_directories(SPIRV PUBLIC
glslang_add_build_info_dependency(SPIRV)
+
+set(SPIRV_NAME spirv)
+set(SPIRV_VERSION 1.3)
+
if (ENABLE_SPVREMAPPER)
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
2020-08-05 01:16:16 +00:00
@@ -90,15 +94,21 @@ if(WIN32 AND BUILD_SHARED_LIBS)
endif()
endif()
+target_include_directories(SPIRV PUBLIC ${SPIRV_TOOLS_INCLUDE_DIRS})
+target_compile_options(SPIRV PUBLIC ${SPIRV_TOOLS_CFLAGS_OTHER})
+target_link_libraries(SPIRV ${SPIRV_TOOLS_LIBRARIES})
+if(BUILD_SHARED_LIBS)
+ target_include_directories(SPIRV PUBLIC ${SPIRV_TOOLS_SHARED_INCLUDE_DIRS})
+ target_compile_options(SPIRV PUBLIC ${SPIRV_TOOLS_SHARED_CFLAGS_OTHER})
+ target_link_libraries(SPIRV ${SPIRV_TOOLS_SHARED_LIBRARIES})
+endif(BUILD_SHARED_LIBS)
2020-08-05 01:16:16 +00:00
+
if(ENABLE_OPT)
target_include_directories(SPIRV
PRIVATE ${spirv-tools_SOURCE_DIR}/include
PRIVATE ${spirv-tools_SOURCE_DIR}/source
)
2020-08-05 01:16:16 +00:00
- target_link_libraries(SPIRV PRIVATE MachineIndependent SPIRV-Tools-opt)
2019-11-13 05:16:50 +00:00
- target_include_directories(SPIRV PUBLIC
2020-08-05 01:16:16 +00:00
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
+ target_link_libraries(SPIRV glslang)
else()
2020-08-05 01:16:16 +00:00
target_link_libraries(SPIRV PRIVATE MachineIndependent)
2021-11-23 07:38:43 +00:00
endif()
2022-08-24 01:09:58 +00:00
@@ -139,6 +149,9 @@ if(ENABLE_GLSLANG_INSTALL)
add_library(SPIRV ALIAS glslang::SPIRV)
")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/SPIRVTargets.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake)
-
+ # spirv.pc Configuration
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/spirv.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/spirv.pc @ONLY)
2020-01-29 00:30:50 +00:00
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/spirv.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
2022-08-24 01:09:58 +00:00
+
2019-11-13 05:16:50 +00:00
install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/glslang/SPIRV/)
2021-11-23 07:38:43 +00:00
endif()
2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/SPIRV/spirv.pc.cmake.in.dma glslang-sdk-1.3.224.0/SPIRV/spirv.pc.cmake.in
--- glslang-sdk-1.3.224.0/SPIRV/spirv.pc.cmake.in.dma 2022-08-24 11:02:14.569865626 +1000
+++ glslang-sdk-1.3.224.0/SPIRV/spirv.pc.cmake.in 2022-08-24 11:02:14.569865626 +1000
@@ -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: @SPIRV_NAME@
+ Description: SPIR-V is a binary intermediate language for representing graphical-shader stages and compute kernels for multiple Khronos APIs, including OpenCL, OpenGL, and Vulkan
+ Requires:
+ Version: @SPIRV_VERSION@
+ Libs: -L${libdir} -lSPIRV
+ Cflags: -I${includedir}
\ No newline at end of file
2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/SPIRV/SpvTools.cpp.dma glslang-sdk-1.3.224.0/SPIRV/SpvTools.cpp
--- glslang-sdk-1.3.224.0/SPIRV/SpvTools.cpp.dma 2022-08-13 01:32:10.000000000 +1000
+++ glslang-sdk-1.3.224.0/SPIRV/SpvTools.cpp 2022-08-24 11:02:14.570865640 +1000
2020-11-03 20:36:35 +00:00
@@ -43,7 +43,7 @@
2019-11-13 05:16:50 +00:00
#include <iostream>
#include "SpvTools.h"
-#include "spirv-tools/optimizer.hpp"
+#include <spirv-tools/optimizer.hpp>
namespace glslang {
2022-08-24 01:09:58 +00:00
diff -up glslang-sdk-1.3.224.0/StandAlone/CMakeLists.txt.dma glslang-sdk-1.3.224.0/StandAlone/CMakeLists.txt
--- glslang-sdk-1.3.224.0/StandAlone/CMakeLists.txt.dma 2022-08-24 11:01:28.064221842 +1000
+++ glslang-sdk-1.3.224.0/StandAlone/CMakeLists.txt 2022-08-24 11:02:14.571865654 +1000
2021-11-23 07:38:43 +00:00
@@ -72,6 +72,14 @@ if(ENABLE_SPVREMAPPER)
2020-01-29 00:30:50 +00:00
set(LIBRARIES ${LIBRARIES} SPVRemapper)
endif()
+if(BUILD_SHARED_LIBS)
+ set(LIBRARIES ${LIBRARIES} ${SPIRV_TOOLS_SHARED_LIBRARIES})
+ target_include_directories(glslangValidator PUBLIC ${SPIRV_TOOLS_SHARED_INCLUDE_DIRS})
+else()
+ set(LIBRARIES ${LIBRARIES} ${SPIRV_TOOLS_LIBRARIES})
+ target_include_directories(glslangValidator PUBLIC ${SPIRV_TOOLS_INCLUDE_DIRS})
+endif(BUILD_SHARED_LIBS)
+
if(WIN32)
set(LIBRARIES ${LIBRARIES} psapi)
elseif(UNIX)
2021-11-23 07:38:43 +00:00
@@ -81,9 +89,6 @@ elseif(UNIX)
endif()
target_link_libraries(glslangValidator ${LIBRARIES})
2020-01-29 00:30:50 +00:00
-target_include_directories(glslangValidator PUBLIC
- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>
- $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/External>)
2020-11-03 20:36:35 +00:00
if(ENABLE_OPT)
target_include_directories(glslangValidator