Merge pull request #358 from vlj/shaderc

Add shaderc.
This commit is contained in:
Robert Schumacher 2016-12-06 01:05:13 -08:00
commit d661c174c7
7 changed files with 191 additions and 10 deletions

View File

@ -1,3 +1,3 @@
Source: glslang
Version: 1c573fbcfba6b3d631008b1babc838501ca925d3
Version: 1c573fbcfba6b3d631008b1babc838501ca925d3-1
Description: Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator

View File

@ -30,14 +30,9 @@ if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git")
LOGNAME worktree
)
message(STATUS "Patching")
vcpkg_execute_required_process(
COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-export-symbol-for-Windows.patch --ignore-whitespace --whitespace=fix
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/src
LOGNAME patch
)
endif()
set(VCPKG_LIBRARY_LINKAGE "static")
vcpkg_configure_cmake(
SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src"
@ -45,7 +40,12 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/Public/ShaderLang.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang)
file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/Public" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang)
file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/Include" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang)
file(COPY "${CURRENT_BUILDTREES_DIR}/src/glslang/MachineIndependent/Versions.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang/MachineIndependent)
file(COPY "${CURRENT_BUILDTREES_DIR}/src/SPIRV/Logger.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV)
file(COPY "${CURRENT_BUILDTREES_DIR}/src/SPIRV/spirv.hpp" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV)
file(COPY "${CURRENT_BUILDTREES_DIR}/src/SPIRV/GlslangToSpv.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV)
file(COPY "${CURRENT_PACKAGES_DIR}/bin/glslangValidator.exe" DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(REMOVE "${CURRENT_PACKAGES_DIR}/bin/glslangValidator.exe")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/glslangValidator.exe")
@ -56,12 +56,12 @@ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/spirv-remap.exe")
file(GLOB BIN_DIR "${CURRENT_PACKAGES_DIR}/bin/*")
list(LENGTH BIN_DIR BIN_DIR_SIZE)
if(${BIN_DIR_SIZE} EQUAL 0)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
endif()
file(GLOB DEBUG_BIN_DIR "${CURRENT_PACKAGES_DIR}/debug/bin/*")
list(LENGTH DEBUG_BIN_DIR DEBUG_BIN_DIR_SIZE)
if(${DEBUG_BIN_DIR_SIZE} EQUAL 0)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
# Handle copyright

View File

@ -0,0 +1,30 @@
From e8e12e856cbc41f9bdcc83bc87eb5013df199ee1 Mon Sep 17 00:00:00 2001
From: vlj <vljn.ovi@gmail.com>
Date: Fri, 2 Dec 2016 16:36:25 +0100
Subject: [PATCH] Do not generate build-version.inc
---
CMakeLists.txt | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4c2fac..5544a2d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,8 +53,8 @@ add_subdirectory(libshaderc)
add_subdirectory(glslc)
add_subdirectory(examples)
-add_custom_target(build-version
- ${PYTHON_EXE}
- ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
- ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR}
- COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
+#add_custom_target(build-version
+# ${PYTHON_EXE}
+# ${CMAKE_CURRENT_SOURCE_DIR}/utils/update_build_version.py
+# ${shaderc_SOURCE_DIR} ${spirv-tools_SOURCE_DIR} ${glslang_SOURCE_DIR}
+# COMMENT "Update build-version.inc in the Shaderc build directory (if necessary).")
--
2.10.2.windows.1

View File

@ -0,0 +1,29 @@
option(SUFFIX_D "Add d Suffix to lib" ${SUFFIX_D})
if(NOT ${SUFFIX_D})
find_library(GLSLANG glslang)
find_library(OSDEPENDENT OSDependent)
find_library(OGLCOMPILER OGLCompiler)
find_library(HLSLLIB HLSL)
find_library(SPIRVLIB SPIRV)
ELSE()
find_library(GLSLANG glslangd)
find_library(OSDEPENDENT OSDependentd)
find_library(OGLCOMPILER OGLCompilerd)
find_library(HLSLLIB HLSLd)
find_library(SPIRVLIB SPIRVd)
ENDIF()
add_library(glslang STATIC IMPORTED GLOBAL)
set_property(TARGET glslang PROPERTY IMPORTED_LOCATION "${GLSLANG}")
add_library(OSDependent STATIC IMPORTED GLOBAL)
set_property(TARGET OSDependent PROPERTY IMPORTED_LOCATION "${OSDEPENDENT}")
add_library(OGLCompiler STATIC IMPORTED GLOBAL)
set_property(TARGET OGLCompiler PROPERTY IMPORTED_LOCATION "${OGLCOMPILER}")
add_library(HLSL STATIC IMPORTED GLOBAL)
set_property(TARGET HLSL PROPERTY IMPORTED_LOCATION "${HLSLLIB}")
add_library(SPIRV STATIC IMPORTED GLOBAL)
set_property(TARGET SPIRV PROPERTY IMPORTED_LOCATION "${SPIRVLIB}")

4
ports/shaderc/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: shaderc
Version: 2df47b51d83ad83cbc2e7f8ff2b56776293e8958
Description: A collection of tools, libraries and tests for shader compilation.
Build-Depends: glslang

View File

@ -0,0 +1,3 @@
"shaderc v2016.2-dev unknown hash, 2016-12-02\n"
"spirv-tools v2016.6-dev unknown hash, 2016-12-02\n"
"glslang unknown hash, 2016-12-02\n"

View File

@ -0,0 +1,115 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
include(vcpkg_common_functions)
find_program(GIT git)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
set(SHADERC_GIT_URL "https://github.com/google/shaderc.git")
set(SHADERC_GIT_REF "2df47b51d83ad83cbc2e7f8ff2b56776293e8958")
if(NOT EXISTS "${DOWNLOADS}/shaderc.git")
message(STATUS "Cloning")
vcpkg_execute_required_process(
COMMAND ${GIT} clone --bare ${SHADERC_GIT_URL} ${DOWNLOADS}/shaderc.git
WORKING_DIRECTORY ${DOWNLOADS}
LOGNAME clone
)
endif()
if(NOT EXISTS "${SOURCE_PATH}/.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} ${SHADERC_GIT_REF}
WORKING_DIRECTORY ${DOWNLOADS}/shaderc.git
LOGNAME worktree
)
message(STATUS "Patching")
vcpkg_execute_required_process(
COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/0001-Do-not-generate-build-version.inc.patch --ignore-whitespace --whitespace=fix
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME patch
)
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}/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
set(VCPKG_LIBRARY_LINKAGE "static")
set(OPTIONS)
if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
list(APPEND OPTIONS -DSHADERC_ENABLE_SHARED_CRT=ON)
endif()
# shaderc uses python to manipulate copyright information
vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_EXE_PATH ${PYTHON3} DIRECTORY)
set(ENV{PATH} "${PYTHON3_EXE_PATH};$ENV{PATH}")
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DSHADERC_SKIP_TESTS=true ${OPTIONS}
OPTIONS_DEBUG -DSUFFIX_D=true
OPTIONS_RELEASE -DSUFFIX_D=false
)
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)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/shaderc)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/shaderc/LICENSE ${CURRENT_PACKAGES_DIR}/share/shaderc/copyright)