-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spirv-tools port form latest vcpkg release.
- Loading branch information
Showing
9 changed files
with
192 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO KhronosGroup/SPIRV-Headers | ||
REF "vulkan-sdk-${VERSION}" | ||
SHA512 6c20022df343e900793370cb30ccea6f4e64f42f4f7c495a0fbb9d3c5fcf3c15a173b93fe883e407d40f8c6dd9d0a6853d8a6907e3df5aa61ad48ae8485019e8 | ||
HEAD_REF master | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
) | ||
vcpkg_cmake_install() | ||
vcpkg_copy_pdbs() | ||
|
||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") | ||
|
||
vcpkg_fixup_pkgconfig() | ||
|
||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "spirv-headers", | ||
"version": "1.3.280.0", | ||
"description": "Machine-readable files for the SPIR-V Registry", | ||
"homepage": "https://github.com/KhronosGroup/SPIRV-Headers", | ||
"dependencies": [ | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
}, | ||
{ | ||
"name": "vcpkg-cmake-config", | ||
"host": true | ||
} | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 75830b44..367fe889 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -270,7 +270,7 @@ else() | ||
endif() | ||
|
||
if(ENABLE_SPIRV_TOOLS_INSTALL) | ||
- if(WIN32 AND NOT MINGW) | ||
+ if(0) | ||
macro(spvtools_config_package_dir TARGET PATH) | ||
set(${PATH} ${TARGET}/cmake) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 75830b44..9c9e7ba8 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -281,8 +281,13 @@ if(ENABLE_SPIRV_TOOLS_INSTALL) | ||
endif() | ||
|
||
macro(spvtools_generate_config_file TARGET) | ||
+ set(sgcf_find_extra "") | ||
+ if(NOT "${TARGET}" STREQUAL "SPIRV-Tools-opt") | ||
+ set(sgcf_find_extra "find_dependency(SPIRV-Tools-opt)\n") | ||
+ endif() | ||
file(WRITE ${CMAKE_BINARY_DIR}/${TARGET}Config.cmake | ||
"include(CMakeFindDependencyMacro)\n" | ||
+ ${sgcf_find_extra} | ||
"find_dependency(${SPIRV_TOOLS})\n" | ||
"include(\${CMAKE_CURRENT_LIST_DIR}/${TARGET}Targets.cmake)\n" | ||
"set(${TARGET}_LIBRARIES ${TARGET})\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,59 @@ | ||
include(vcpkg_common_functions) | ||
|
||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO KhronosGroup/SPIRV-Tools | ||
REF v2023.2 | ||
SHA512 988f5e31508e3f19c1dd9d9a013c8e9ff89eba86207a769d7d804f9ee0201c794f412a874c860167b2c040b2c5e1fb1c835ae3684c70feaac86e47f90c1a5010 | ||
HEAD_REF master | ||
) | ||
|
||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SPIRV_HEADERS_PATH | ||
REPO KhronosGroup/SPIRV-Headers | ||
REF 801cca8104245c07e8cc53292da87ee1b76946fe | ||
SHA512 2bfc37beec1f6afb565fa7dad08eb838c8fe4bacda7f80a3a6c75d80c7eb1caea7e7716dc1da11b337b723a0870700d524c6617c5b7cab8b28048fa8c0785ba9 | ||
HEAD_REF master | ||
REF "vulkan-sdk-${VERSION}" | ||
SHA512 3ccab3118e0a1d6f20d031cd1f90f2546b618370b90aacc468fc598d523463452f65ed2c89c1de4e2bb8933b9757eb8123363483bcd853e92d41c95ea419e79f | ||
PATCHES | ||
cmake-config-dir.diff | ||
spirv-tools-shared.diff | ||
fix-tool-deps.diff | ||
) | ||
|
||
vcpkg_find_acquire_program(PYTHON3) | ||
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) | ||
vcpkg_add_to_path("${PYTHON3_DIR}") | ||
|
||
vcpkg_configure_cmake( | ||
SOURCE_PATH ${SOURCE_PATH} | ||
PREFER_NINJA | ||
vcpkg_check_features( | ||
OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
INVERTED_FEATURES | ||
tools SPIRV_SKIP_EXECUTABLES | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}" | ||
OPTIONS | ||
-DSPIRV-Headers_SOURCE_DIR=${SPIRV_HEADERS_PATH} | ||
${FEATURE_OPTIONS} | ||
"-DSPIRV-Headers_SOURCE_DIR=${CURRENT_INSTALLED_DIR}" | ||
-DSPIRV_SKIP_TESTS=ON | ||
-DSPIRV_TOOLS_BUILD_STATIC=ON | ||
-DSPIRV_WERROR=OFF | ||
OPTIONS_DEBUG | ||
-DSPIRV_SKIP_EXECUTABLES=ON | ||
) | ||
|
||
vcpkg_install_cmake() | ||
|
||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) | ||
file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*") | ||
file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools) | ||
file(REMOVE ${EXES}) | ||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) | ||
vcpkg_cmake_install() | ||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools PACKAGE_NAME spirv-tools DO_NOT_DELETE_PARENT_CONFIG_PATH) | ||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-link PACKAGE_NAME spirv-tools-link DO_NOT_DELETE_PARENT_CONFIG_PATH) | ||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-lint PACKAGE_NAME spirv-tools-lint DO_NOT_DELETE_PARENT_CONFIG_PATH) | ||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-opt PACKAGE_NAME spirv-tools-opt DO_NOT_DELETE_PARENT_CONFIG_PATH) | ||
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/SPIRV-Tools-reduce PACKAGE_NAME spirv-tools-reduce) # now delete | ||
vcpkg_fixup_pkgconfig() | ||
|
||
if("tools" IN_LIST FEATURES) | ||
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}") | ||
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/spirv-lesspipe.sh" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/spirv-lesspipe.sh") | ||
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/spirv-lesspipe.sh") | ||
set(tools spirv-as spirv-cfg spirv-dis spirv-link spirv-lint spirv-opt spirv-val) | ||
if(NOT VCPKG_TARGET_IS_IOS) | ||
list(APPEND tools spirv-reduce) | ||
endif() | ||
vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN) | ||
endif() | ||
|
||
file(REMOVE_RECURSE | ||
"${CURRENT_PACKAGES_DIR}/debug/include" | ||
"${CURRENT_PACKAGES_DIR}/debug/share" | ||
) | ||
|
||
# Handle copyright | ||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/spirv-tools) | ||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/spirv-tools/LICENSE ${CURRENT_PACKAGES_DIR}/share/spirv-tools/copyright) | ||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 75830b44..39cc039e 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -390,10 +390,14 @@ add_custom_target(spirv-tools-shared-pkg-config ALL | ||
|
||
# Install pkg-config file | ||
if (ENABLE_SPIRV_TOOLS_INSTALL) | ||
+ set(shared_pc "") | ||
+ if(BUILD_SHARED_LIBS) | ||
+ set(shared_pc "${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc") | ||
+ endif() | ||
install( | ||
FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools.pc | ||
- ${CMAKE_CURRENT_BINARY_DIR}/SPIRV-Tools-shared.pc | ||
+ ${shared_pc} | ||
DESTINATION | ||
${CMAKE_INSTALL_LIBDIR}/pkgconfig) | ||
endif() | ||
diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt | ||
index acfa0c12..b3286db3 100644 | ||
--- a/source/CMakeLists.txt | ||
+++ b/source/CMakeLists.txt | ||
@@ -425,6 +425,10 @@ if (ANDROID) | ||
endif() | ||
|
||
if(ENABLE_SPIRV_TOOLS_INSTALL) | ||
+ if(NOT BUILD_SHARED_LIBS) | ||
+ set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES EXCLUDE_FROM_ALL 1) | ||
+ list(REMOVE_ITEM SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-shared) | ||
+ endif() | ||
install(TARGETS ${SPIRV_TOOLS_TARGETS} EXPORT ${SPIRV_TOOLS}Targets) | ||
export(EXPORT ${SPIRV_TOOLS}Targets FILE ${SPIRV_TOOLS}Target.cmake) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
spirv-tools provides CMake targets: | ||
|
||
find_package(SPIRV-Tools CONFIG REQUIRED) | ||
# The static libary is always available. | ||
# It offers full public symbol visibility. | ||
target_link_libraries(main PRIVATE SPIRV-Tools-static) | ||
# In triplets with dynamic library linkage, there is also a shared libary. | ||
target_link_libraries(main PRIVATE SPIRV-Tools-shared) | ||
|
||
# The following libraries are static and depend on SPIRV-Tools-static. | ||
|
||
find_package(SPIRV-Tools-link CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE SPIRV-Tools-link) | ||
|
||
find_package(SPIRV-Tools-lint CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE SPIRV-Tools-lint) | ||
|
||
find_package(SPIRV-Tools-opt CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE SPIRV-Tools-opt) | ||
|
||
find_package(SPIRV-Tools-reduce CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE SPIRV-Tools-reduce) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "spirv-tools", | ||
"version": "1.3.280.0", | ||
"description": "API and commands for processing SPIR-V modules", | ||
"homepage": "https://github.com/KhronosGroup/SPIRV-Tools", | ||
"license": "Apache-2.0", | ||
"dependencies": [ | ||
"spirv-headers", | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
}, | ||
{ | ||
"name": "vcpkg-cmake-config", | ||
"host": true | ||
} | ||
], | ||
"features": { | ||
"tools": { | ||
"description": "Build tools." | ||
} | ||
} | ||
} |