diff options
| -rw-r--r-- | ports/glslang/CONTROL | 2 | ||||
| -rw-r--r-- | ports/glslang/portfile.cmake | 18 | ||||
| -rw-r--r-- | ports/shaderc/0001-Do-not-generate-build-version.inc.patch | 30 | ||||
| -rw-r--r-- | ports/shaderc/CMakeLists.txt | 29 | ||||
| -rw-r--r-- | ports/shaderc/CONTROL | 4 | ||||
| -rw-r--r-- | ports/shaderc/build-version.inc | 3 | ||||
| -rw-r--r-- | ports/shaderc/portfile.cmake | 115 |
7 files changed, 191 insertions, 10 deletions
diff --git a/ports/glslang/CONTROL b/ports/glslang/CONTROL index 7bd0c7e40..3b81f5287 100644 --- a/ports/glslang/CONTROL +++ b/ports/glslang/CONTROL @@ -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 diff --git a/ports/glslang/portfile.cmake b/ports/glslang/portfile.cmake index bdeece78a..9fd6ae468 100644 --- a/ports/glslang/portfile.cmake +++ b/ports/glslang/portfile.cmake @@ -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 diff --git a/ports/shaderc/0001-Do-not-generate-build-version.inc.patch b/ports/shaderc/0001-Do-not-generate-build-version.inc.patch new file mode 100644 index 000000000..41cc81220 --- /dev/null +++ b/ports/shaderc/0001-Do-not-generate-build-version.inc.patch @@ -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 + diff --git a/ports/shaderc/CMakeLists.txt b/ports/shaderc/CMakeLists.txt new file mode 100644 index 000000000..3dc7be973 --- /dev/null +++ b/ports/shaderc/CMakeLists.txt @@ -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}") diff --git a/ports/shaderc/CONTROL b/ports/shaderc/CONTROL new file mode 100644 index 000000000..e1e3d02b8 --- /dev/null +++ b/ports/shaderc/CONTROL @@ -0,0 +1,4 @@ +Source: shaderc +Version: 2df47b51d83ad83cbc2e7f8ff2b56776293e8958 +Description: A collection of tools, libraries and tests for shader compilation. +Build-Depends: glslang diff --git a/ports/shaderc/build-version.inc b/ports/shaderc/build-version.inc new file mode 100644 index 000000000..853e89916 --- /dev/null +++ b/ports/shaderc/build-version.inc @@ -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" diff --git a/ports/shaderc/portfile.cmake b/ports/shaderc/portfile.cmake new file mode 100644 index 000000000..542d18598 --- /dev/null +++ b/ports/shaderc/portfile.cmake @@ -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) |
