Modify shaderc so that it uses spirv-tools lib.

This commit is contained in:
vlj 2016-12-17 11:42:30 +01:00
parent 869071a34e
commit 8d9c8a6269
3 changed files with 21 additions and 43 deletions

View 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}")

View File

@ -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

View File

@ -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)