Skip to content

Commit

Permalink
[shaderc] Fix for build (microsoft#4398)
Browse files Browse the repository at this point in the history
* [shaderc] Fix for build

* [glslang] Use 'd' debug suffix on all platforms

* [shaderc][spirv-tools] Restore missing cmake options
  • Loading branch information
jeweg authored and ras0219-msft committed Oct 12, 2018
1 parent adcf874 commit 1ce7ee3
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 124 deletions.
86 changes: 0 additions & 86 deletions ports/glslang/0001-Fix-export-symbol-for-Windows.patch

This file was deleted.

2 changes: 1 addition & 1 deletion ports/glslang/CONTROL
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Source: glslang
Version: 2018-03-02
Version: 2018-03-02-1
Description: Khronos reference front-end for GLSL and ESSL, and sample SPIR-V generator
7 changes: 3 additions & 4 deletions ports/glslang/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
include(vcpkg_common_functions)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(WARNING "Dynamic not supported. Building static")
set(VCPKG_LIBRARY_LINKAGE "static")
endif()

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -15,6 +13,7 @@ vcpkg_from_github(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DCMAKE_DEBUG_POSTFIX=d
)

vcpkg_install_cmake()
Expand Down
4 changes: 2 additions & 2 deletions ports/shaderc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ ENDIF()

add_library(glslang STATIC IMPORTED GLOBAL)
set_property(TARGET glslang PROPERTY IMPORTED_LOCATION "${GLSLANG}")
set(glslang_SOURCE_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" CACHE STRING "glslang source dir")
set_property(TARGET glslang APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
find_path(glslang_SOURCE_DIR glslang/Include/Common)
set_property(TARGET glslang APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${glslang_SOURCE_DIR}")

add_library(OSDependent STATIC IMPORTED GLOBAL)
set_property(TARGET OSDependent PROPERTY IMPORTED_LOCATION "${OSDEPENDENT}")
Expand Down
12 changes: 3 additions & 9 deletions ports/shaderc/CMakeLists_spirv.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
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()
find_library(SPIRVTOOLSOPT SPIRV-Tools-opt)
find_library(SPIRVTOOLS SPIRV-Tools)

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}")
set_property(TARGET SPIRV-Tools PROPERTY IMPORTED_LOCATION "${SPIRVTOOLS}")
2 changes: 1 addition & 1 deletion ports/shaderc/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: shaderc
Version: 12fb656ab20ea9aa06e7084a74e5ff832b7ce2da-1
Version: 12fb656ab20ea9aa06e7084a74e5ff832b7ce2da-2
Description: A collection of tools, libraries and tests for shader compilation.
Build-Depends: glslang, spirv-tools
19 changes: 4 additions & 15 deletions ports/shaderc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
# 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)

vcpkg_from_github(
Expand All @@ -14,11 +6,8 @@ vcpkg_from_github(
REF 12fb656ab20ea9aa06e7084a74e5ff832b7ce2da
SHA512 6fb45a0b01e6709c44a11658648b9271fe06bd94023dcc5042c47b5f2a04889c2efb0ab4c166f18728594ac9b9aa9f8b354af46d88eb7f7c39c7246f52f5a933
HEAD_REF master
)

vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Do-not-generate-build-version.inc.patch
PATCHES
0001-Do-not-generate-build-version.inc.patch
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}/third_party/glslang)
Expand All @@ -36,11 +25,11 @@ 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_add_to_path(PREPEND "${PYTHON3_EXE_PATH}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DSHADERC_SKIP_TESTS=true ${OPTIONS}
OPTIONS -DSHADERC_SKIP_TESTS=true ${OPTIONS} -Dglslang_SOURCE_DIR=${CURRENT_INSTALLED_DIR}/include
OPTIONS_DEBUG -DSUFFIX_D=true
OPTIONS_RELEASE -DSUFFIX_D=false
)
Expand Down
11 changes: 5 additions & 6 deletions ports/spirv-tools/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
include(vcpkg_common_functions)

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(WARNING "Dynamic not supported. Building static")
set(VCPKG_LIBRARY_LINKAGE "static")
endif()
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -23,12 +20,14 @@ vcpkg_from_github(

vcpkg_find_acquire_program(PYTHON3)
get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY)
set(ENV{PATH} "$ENV{PATH};${PYTHON3_DIR}")
vcpkg_add_to_path("${PYTHON3_DIR}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DSPIRV-Headers_SOURCE_DIR=${SPIRV_HEADERS_PATH}
OPTIONS
-DSPIRV-Headers_SOURCE_DIR=${SPIRV_HEADERS_PATH}
-DSPIRV_WERROR=OFF
)

vcpkg_install_cmake()
Expand Down

0 comments on commit 1ce7ee3

Please sign in to comment.