mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 16:43:02 +08:00
Modify shaderc so that it uses spirv-tools lib.
This commit is contained in:
parent
869071a34e
commit
8d9c8a6269
14
ports/shaderc/CMakeLists_spirv.txt
Normal file
14
ports/shaderc/CMakeLists_spirv.txt
Normal file
@ -0,0 +1,14 @@
|
||||
option(SUFFIX_D "Add d Suffix to lib" ${SUFFIX_D})
|
||||
if(NOT ${SUFFIX_D})
|
||||
find_library(SPIRVTOOLSOPT spirv-tools-opt)
|
||||
find_library(SPIRVTOOLS spirv-tools)
|
||||
ELSE()
|
||||
find_library(SPIRVTOOLSOPT spirv-tools-opt)
|
||||
find_library(SPIRVTOOLS spirv-tools)
|
||||
ENDIF()
|
||||
|
||||
add_library(SPIRV-Tools-opt STATIC IMPORTED GLOBAL)
|
||||
set_property(TARGET SPIRV-Tools-opt PROPERTY IMPORTED_LOCATION "${SPIRVTOOLSOPT}")
|
||||
|
||||
add_library(SPIRV-Tools STATIC IMPORTED GLOBAL)
|
||||
set_property(TARGET SPIRV-Tools PROPERTY IMPORTED_LOCATION "${SPIRVTOOLS}")
|
@ -1,4 +1,4 @@
|
||||
Source: shaderc
|
||||
Version: 2df47b51d83ad83cbc2e7f8ff2b56776293e8958
|
||||
Description: A collection of tools, libraries and tests for shader compilation.
|
||||
Build-Depends: glslang
|
||||
Build-Depends: glslang, spirv-tools
|
||||
|
@ -37,48 +37,9 @@ if(NOT EXISTS "${SOURCE_PATH}/.git")
|
||||
)
|
||||
endif()
|
||||
|
||||
set(SPIRVTOOLS_GIT_URL "https://github.com/KhronosGroup/SPIRV-Tools.git")
|
||||
set(SPIRVTOOLS_GIT_REF "f72189c249ba143c6a89a4cf1e7d53337b2ddd40")
|
||||
set(SPIRVHEADERS_GIT_URL "https://github.com/KhronosGroup/SPIRV-Headers.git")
|
||||
set(SPIRVHEADERS_GIT_REF "bd47a9abaefac00be692eae677daed1b977e625c")
|
||||
|
||||
if(NOT EXISTS "${DOWNLOADS}/SPIRV-Tools.git")
|
||||
message(STATUS "Cloning")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${GIT} clone --bare ${SPIRVTOOLS_GIT_URL} ${DOWNLOADS}/SPIRV-Tools.git
|
||||
WORKING_DIRECTORY ${DOWNLOADS}
|
||||
LOGNAME clone
|
||||
)
|
||||
endif()
|
||||
if(NOT EXISTS "${DOWNLOADS}/SPIRV-Headers.git")
|
||||
message(STATUS "Cloning")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${GIT} clone --bare ${SPIRVHEADERS_GIT_URL} ${DOWNLOADS}/SPIRV-Headers.git
|
||||
WORKING_DIRECTORY ${DOWNLOADS}
|
||||
LOGNAME clone
|
||||
)
|
||||
endif()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/third_party/glslang)
|
||||
if(NOT EXISTS "${SOURCE_PATH}/third_party/spirv-tools/.git")
|
||||
message(STATUS "Adding worktree and patching")
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${GIT} worktree add -f --detach ${SOURCE_PATH}/third_party/spirv-tools ${SPIRVTOOLS_GIT_REF}
|
||||
WORKING_DIRECTORY ${DOWNLOADS}/SPIRV-Tools.git
|
||||
LOGNAME worktree
|
||||
)
|
||||
endif()
|
||||
if(NOT EXISTS "${SOURCE_PATH}/third_party/spirv-tools/external/spirv-headers/.git")
|
||||
message(STATUS "Adding worktree and patching")
|
||||
file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR})
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${GIT} worktree add -f --detach ${SOURCE_PATH}/third_party/spirv-tools/external/spirv-headers ${SPIRVHEADERS_GIT_REF}
|
||||
WORKING_DIRECTORY ${DOWNLOADS}/SPIRV-Headers.git
|
||||
LOGNAME worktree
|
||||
)
|
||||
endif()
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_spirv.txt DESTINATION ${SOURCE_PATH}/third_party/spirv-tools)
|
||||
file(RENAME ${SOURCE_PATH}/third_party/spirv-tools/CMakeLists_spirv.txt ${SOURCE_PATH}/third_party/spirv-tools/CMakeLists.txt)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/build-version.inc DESTINATION ${SOURCE_PATH}/glslc/src)
|
||||
|
||||
#Note: glslang and spir tools doesn't export symbol and need to be build as static lib for cmake to work
|
||||
@ -102,13 +63,16 @@ vcpkg_configure_cmake(
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(GLOB EXES "${CURRENT_PACKAGES_DIR}/bin/*.exe")
|
||||
file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
|
||||
|
||||
#Safe to remove as libs are static
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
|
||||
|
||||
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/include/shaderc.txt)
|
||||
|
||||
# Handle copyright
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/shaderc)
|
||||
|
Loading…
Reference in New Issue
Block a user