mirror of
https://github.com/microsoft/vcpkg.git
synced 2026-01-18 01:11:23 +01:00
[shaderc] Fix pkgconfig file generation (#48996)
Co-authored-by: Kai Pastor <dg0yt@darc.de>
This commit is contained in:
@@ -2,14 +2,24 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index b2e92ef..cf0832b 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -152,6 +152,8 @@ function(define_pkg_config_file NAME LIBS)
|
||||
@@ -152,6 +152,17 @@ function(define_pkg_config_file NAME LIBS)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
define_pkg_config_file(shaderc -lshaderc_shared)
|
||||
+else()
|
||||
define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
|
||||
+foreach(lib IN LISTS CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
|
||||
+ if(lib IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES)
|
||||
+ continue()
|
||||
+ elseif(EXISTS "${lib}")
|
||||
+ string(APPEND EXTRA_STATIC_PKGCONFIG_LIBS " ${lib}")
|
||||
+ else()
|
||||
+ string(APPEND EXTRA_STATIC_PKGCONFIG_LIBS " -l${lib}")
|
||||
+ endif()
|
||||
+endforeach()
|
||||
+define_pkg_config_file(shaderc "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
|
||||
-define_pkg_config_file(shaderc_static "-lshaderc ${EXTRA_STATIC_PKGCONFIG_LIBS} -lshaderc_util")
|
||||
-define_pkg_config_file(shaderc_combined -lshaderc_combined)
|
||||
+endif()
|
||||
diff --git a/libshaderc/CMakeLists.txt b/libshaderc/CMakeLists.txt
|
||||
|
||||
@@ -25,6 +25,8 @@ vcpkg_find_acquire_program(PYTHON3)
|
||||
get_filename_component(PYTHON3_EXE_PATH "${PYTHON3}" DIRECTORY)
|
||||
vcpkg_add_to_path(PREPEND "${PYTHON3_EXE_PATH}")
|
||||
|
||||
# Add these libraries to the pkgconfig file since we patch the build to link against these
|
||||
set(EXTRA_STATIC_PKGCONFIG_LIBS "-lglslang -lSPIRV-Tools-opt -lSPIRV-Tools")
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
@@ -32,9 +34,16 @@ vcpkg_cmake_configure(
|
||||
"-DCMAKE_PROJECT_INCLUDE=${CMAKE_CURRENT_LIST_DIR}/cmake-project-include.cmake"
|
||||
-DSHADERC_ENABLE_EXAMPLES=OFF
|
||||
-DSHADERC_SKIP_TESTS=true
|
||||
"-DEXTRA_STATIC_PKGCONFIG_LIBS=${EXTRA_STATIC_PKGCONFIG_LIBS}"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
if(NOT VCPKG_BUILD_TYPE)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_replace_string("${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/shaderc.pc" "-lglslang" "-lglslangd")
|
||||
endif()
|
||||
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/shaderc.pc" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
|
||||
endif()
|
||||
|
||||
vcpkg_fixup_pkgconfig()
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-shaderc CONFIG_PATH share/unofficial-shaderc)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "shaderc",
|
||||
"version": "2025.2",
|
||||
"port-version": 1,
|
||||
"description": "A collection of tools, libraries and tests for shader compilation.",
|
||||
"homepage": "https://github.com/google/shaderc",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -8982,7 +8982,7 @@
|
||||
},
|
||||
"shaderc": {
|
||||
"baseline": "2025.2",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"shaderwriter": {
|
||||
"baseline": "2.9.0",
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f80716ef5416dbfd00c192c967b74555c7872a01",
|
||||
"version": "2025.2",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "1f5d61fa5ce03d0f578908c8a7a8bb22c3aa298c",
|
||||
"version": "2025.2",
|
||||
|
||||
Reference in New Issue
Block a user