yuzu/externals/vcpkg/ports/shaderc/fix-export-cmakefiles.patch
2022-07-23 03:01:36 +02:00

94 lines
3.8 KiB
Diff
Executable File

diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt
index f3277f0..5fd58ef 100644
--- a/libshaderc/CMakeLists.txt
+++ b/libshaderc/CMakeLists.txt
@@ -28,7 +28,9 @@ if (NOT BUILD_SHARED_LIBS)
add_library(shaderc STATIC ${SHADERC_SOURCES})
shaderc_default_compile_options(shaderc)
target_include_directories(shaderc
- PUBLIC include
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
+ $<INSTALL_INTERFACE:include/>
PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include)
set(shaderc_install_target shaderc)
@@ -37,7 +39,9 @@ else()
add_library(shaderc_shared SHARED ${SHADERC_SOURCES})
shaderc_default_compile_options(shaderc_shared)
target_include_directories(shaderc_shared
- PUBLIC include
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
+ $<INSTALL_INTERFACE:include/>
PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include)
target_compile_definitions(shaderc_shared
@@ -59,10 +63,14 @@ if(SHADERC_ENABLE_INSTALL)
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/shaderc)
- install(TARGETS ${shaderc_install_target}
+ install(TARGETS ${shaderc_install_target} EXPORT unofficial-shadercTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(EXPORT unofficial-shadercTargets
+ NAMESPACE unofficial::shaderc::
+ DESTINATION share/unofficial-shaderc
+ )
endif(SHADERC_ENABLE_INSTALL)
find_package(Threads)
@@ -79,6 +87,11 @@ else()
target_link_libraries(shaderc_shared PRIVATE ${SHADERC_LIBS})
endif()
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc-config.cmake.in"
+[[include("${CMAKE_CURRENT_LIST_DIR}/unofficial-shadercTargets.cmake")]])
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc-config.cmake" @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc-config.cmake DESTINATION share/unofficial-shaderc)
+
shaderc_add_tests(
TEST_PREFIX shaderc
LINK_LIBS shaderc
diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt
index 4926203..b152d7b 100644
--- a/libshaderc_util/CMakeLists.txt
+++ b/libshaderc_util/CMakeLists.txt
@@ -39,7 +39,10 @@ add_library(shaderc_util STATIC
shaderc_default_compile_options(shaderc_util)
target_include_directories(shaderc_util
- PUBLIC include PRIVATE ${glslang_SOURCE_DIR})
+ PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
+ $<INSTALL_INTERFACE:include/>
+ PRIVATE ${glslang_SOURCE_DIR})
# We use parts of Glslang's HLSL compilation interface, which
# now requires this preprocessor definition.
add_definitions(-DENABLE_HLSL)
@@ -50,12 +53,21 @@ target_link_libraries(shaderc_util PRIVATE
SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT})
if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS)
- install(TARGETS shaderc_util
+ install(TARGETS shaderc_util EXPORT unofficial-shaderc_utilTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ install(EXPORT unofficial-shaderc_utilTargets
+ NAMESPACE unofficial::shaderc_util::
+ DESTINATION share/unofficial-shaderc_util
+ )
endif(SHADERC_ENABLE_INSTALL)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc_util-config.cmake.in"
+[[include("${CMAKE_CURRENT_LIST_DIR}/unofficial-shaderc_utilTargets.cmake")]])
+configure_file("${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc_util-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc_util-config.cmake" @ONLY)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-shaderc_util-config.cmake DESTINATION share/unofficial-shaderc_util)
+
shaderc_add_tests(
TEST_PREFIX shaderc_util
LINK_LIBS shaderc_util