From f7facd51cc0d714cdce0e2b59765c8aabebd9b7d Mon Sep 17 00:00:00 2001 From: atkawa7 Date: Thu, 27 Jul 2017 19:25:07 -0700 Subject: [PATCH] [glslang] use vcpkg_from_github --- ports/glslang/CONTROL | 4 +-- ports/glslang/portfile.cmake | 61 ++++++++++++------------------------ 2 files changed, 22 insertions(+), 43 deletions(-) diff --git a/ports/glslang/CONTROL b/ports/glslang/CONTROL index 3b81f52875..ac6e6810b9 100644 --- a/ports/glslang/CONTROL +++ b/ports/glslang/CONTROL @@ -1,3 +1,3 @@ Source: glslang -Version: 1c573fbcfba6b3d631008b1babc838501ca925d3-1 -Description: Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator +Version: 1c573fbcfba6b3d631008b1babc838501ca925d3-2 +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 9fd6ae468b..8dabcb390a 100644 --- a/ports/glslang/portfile.cmake +++ b/ports/glslang/portfile.cmake @@ -1,51 +1,30 @@ -# Common Ambient Variables: -# VCPKG_ROOT_DIR = -# 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(GIT_URL "https://github.com/KhronosGroup/glslang.git") -set(GIT_REF "1c573fbcfba6b3d631008b1babc838501ca925d3") - -if(NOT EXISTS "${DOWNLOADS}/glslang.git") - message(STATUS "Cloning") - vcpkg_execute_required_process( - COMMAND ${GIT} clone --bare ${GIT_URL} ${DOWNLOADS}/glslang.git - WORKING_DIRECTORY ${DOWNLOADS} - LOGNAME clone - ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(WARNING "Dynamic not supported. Building static") + set(VCPKG_LIBRARY_LINKAGE "static") endif() -if(NOT EXISTS "${CURRENT_BUILDTREES_DIR}/src/.git") - message(STATUS "Adding worktree and patching") - file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}) - vcpkg_execute_required_process( - COMMAND ${GIT} worktree add -f --detach ${CURRENT_BUILDTREES_DIR}/src ${GIT_REF} - WORKING_DIRECTORY ${DOWNLOADS}/glslang.git - LOGNAME worktree - ) - message(STATUS "Patching") -endif() - -set(VCPKG_LIBRARY_LINKAGE "static") +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO KhronosGroup/glslang + REF 1c573fbcfba6b3d631008b1babc838501ca925d3 + SHA512 4f04dc39d9a70959ded1f4fe05ca5c7b0413c05bc3f049c11b5be7c8e1a70675f4221c9d8c712e7695f30eadb9bd7d0f1e71f431a6c9d4fea2cd2abbc73bd49a + HEAD_REF master +) vcpkg_configure_cmake( - SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src" + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) vcpkg_install_cmake() -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 "${SOURCE_PATH}/glslang/Public" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang) +file(COPY "${SOURCE_PATH}/glslang/Include" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang) +file(COPY "${SOURCE_PATH}/glslang/MachineIndependent/Versions.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/glslang/MachineIndependent) +file(COPY "${SOURCE_PATH}/SPIRV/Logger.h" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV) +file(COPY "${SOURCE_PATH}/SPIRV/spirv.hpp" DESTINATION ${CURRENT_PACKAGES_DIR}/include/SPIRV) +file(COPY "${SOURCE_PATH}/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 +35,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