[shaderc] Fix for build (#4398)

* [shaderc] Fix for build

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

* [shaderc][spirv-tools] Restore missing cmake options
This commit is contained in:
Jens Weggemann 2018-10-12 06:27:22 +02:00 committed by Robert Schumacher
parent adcf87465f
commit 1ce7ee30b7
8 changed files with 19 additions and 124 deletions

View File

@ -1,86 +0,0 @@
From 1ccadd2cb6db3ce5a00635f65db21e561eb7f705 Mon Sep 17 00:00:00 2001
From: vlj <vljn.ovi@gmail.com>
Date: Fri, 25 Nov 2016 17:12:35 +0100
Subject: [PATCH] Fix export symbol for Windows.
---
StandAlone/CMakeLists.txt | 1 +
StandAlone/ResourceLimits.cpp | 3 +++
StandAlone/ResourceLimits.h | 10 ++++++++++
3 files changed, 14 insertions(+)
diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt
index 231ba27..3aff02e 100644
--- a/StandAlone/CMakeLists.txt
+++ b/StandAlone/CMakeLists.txt
@@ -2,6 +2,7 @@ add_library(glslang-default-resource-limits
${CMAKE_CURRENT_SOURCE_DIR}/ResourceLimits.cpp
)
set_property(TARGET glslang-default-resource-limits PROPERTY FOLDER glslang)
+set_property(TARGET glslang-default-resource-limits PROPERTY COMPILE_DEFINITIONS DLLEXPORT)
target_include_directories(glslang-default-resource-limits
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/StandAlone/ResourceLimits.cpp b/StandAlone/ResourceLimits.cpp
index e22ec80..634d9c9 100644
--- a/StandAlone/ResourceLimits.cpp
+++ b/StandAlone/ResourceLimits.cpp
@@ -41,6 +41,7 @@
namespace glslang {
+DLL_EXPORT
const TBuiltInResource DefaultTBuiltInResource = {
/* .MaxLights = */ 32,
/* .MaxClipPlanes = */ 6,
@@ -137,6 +138,7 @@ const TBuiltInResource DefaultTBuiltInResource = {
/* .generalConstantMatrixVectorIndexing = */ 1,
}};
+DLL_EXPORT
std::string GetDefaultTBuiltInResourceString()
{
std::ostringstream ostream;
@@ -239,6 +241,7 @@ std::string GetDefaultTBuiltInResourceString()
return ostream.str();
}
+DLL_EXPORT
void DecodeResourceLimits(TBuiltInResource* resources, char* config)
{
static const char* delims = " \t\n\r";
diff --git a/StandAlone/ResourceLimits.h b/StandAlone/ResourceLimits.h
index 9c3eb3e..932a59f 100644
--- a/StandAlone/ResourceLimits.h
+++ b/StandAlone/ResourceLimits.h
@@ -39,17 +39,27 @@
#include "glslang/Include/ResourceLimits.h"
+#ifdef DLLEXPORT
+#define DLL_EXPORT __declspec(dllexport)
+#else
+#define DLL_EXPORT __declspec(dllimport)
+#endif
+
namespace glslang {
// These are the default resources for TBuiltInResources, used for both
// - parsing this string for the case where the user didn't supply one,
// - dumping out a template for user construction of a config file.
+
+DLL_EXPORT
extern const TBuiltInResource DefaultTBuiltInResource;
// Returns the DefaultTBuiltInResource as a human-readable string.
+DLL_EXPORT
std::string GetDefaultTBuiltInResourceString();
// Decodes the resource limits from |config| to |resources|.
+DLL_EXPORT
void DecodeResourceLimits(TBuiltInResource* resources, char* config);
} // end namespace glslang
--
2.10.2.windows.1

View File

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

View File

@ -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
@ -15,6 +13,7 @@ vcpkg_from_github(
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS -DCMAKE_DEBUG_POSTFIX=d
)
vcpkg_install_cmake()

View File

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

View File

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

View File

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

View File

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

View File

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