Skip to content

Commit

Permalink
Get spirv.hpp from SPIRV-Headers, not Glslang (google#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
dneto0 authored Mar 3, 2020
1 parent 06b6db6 commit 6e90871
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
4 changes: 3 additions & 1 deletion libshaderc/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ LOCAL_CPP_EXTENSION := .cc .cpp .cxx
LOCAL_MODULE:=shaderc
LOCAL_EXPORT_C_INCLUDES:=$(LOCAL_PATH)/include
LOCAL_SRC_FILES:=src/shaderc.cc
LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include
# The Shaderc third_party/Android.mk deduces SPVHEADERS_LOCAL_PATH,
# or delegates that responsibility to SPIRV-Tools' Android.mk.
LOCAL_C_INCLUDES:=$(LOCAL_PATH)/include $(SPVHEADERS_LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES:=shaderc_util SPIRV-Tools-opt
LOCAL_CXXFLAGS:=-std=c++11 -fno-exceptions -fno-rtti -DNV_EXTENSIONS -DENABLE_HLSL=1
LOCAL_EXPORT_CPPFLAGS:=-std=c++11
Expand Down
13 changes: 11 additions & 2 deletions libshaderc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ set(SHADERC_SOURCES

add_library(shaderc STATIC ${SHADERC_SOURCES})
shaderc_default_compile_options(shaderc)
target_include_directories(shaderc PUBLIC include PRIVATE ${glslang_SOURCE_DIR})
target_include_directories(shaderc
PUBLIC include
PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include)

add_library(shaderc_shared SHARED ${SHADERC_SOURCES})
shaderc_default_compile_options(shaderc_shared)
target_include_directories(shaderc_shared PUBLIC include PRIVATE ${glslang_SOURCE_DIR})
target_include_directories(shaderc_shared
PUBLIC include
PRIVATE ${glslang_SOURCE_DIR}
${SPIRV-Headers_SOURCE_DIR}/include)
target_compile_definitions(shaderc_shared
PRIVATE SHADERC_IMPLEMENTATION
PUBLIC SHADERC_SHAREDLIB
Expand Down Expand Up @@ -56,6 +62,7 @@ shaderc_add_tests(
LINK_LIBS shaderc
INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
${spirv-tools_SOURCE_DIR}/include
${SPIRV-Headers_SOURCE_DIR}/include
TEST_NAMES
shaderc
shaderc_cpp
Expand All @@ -66,6 +73,7 @@ shaderc_add_tests(
LINK_LIBS shaderc_shared SPIRV-Tools
INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
${spirv-tools_SOURCE_DIR}/include
${SPIRV-Headers_SOURCE_DIR}/include
TEST_NAMES
shaderc
shaderc_cpp
Expand Down Expand Up @@ -95,6 +103,7 @@ shaderc_add_tests(
LINK_LIBS shaderc_combined ${CMAKE_THREAD_LIBS_INIT}
INCLUDE_DIRS include ${shaderc_SOURCE_DIR}/libshaderc_util/include ${glslang_SOURCE_DIR}
${spirv-tools_SOURCE_DIR}/include
${SPIRV-Headers_SOURCE_DIR}/include
TEST_NAMES
shaderc
shaderc_cpp)
Expand Down
6 changes: 2 additions & 4 deletions libshaderc/src/shaderc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "shaderc_private.h"

#include <algorithm>
#include <cassert>
#include <cstdint>
#include <sstream>
#include <vector>

#include "SPIRV/spirv.hpp"

#include "libshaderc_util/compiler.h"
#include "libshaderc_util/counting_includer.h"
#include "libshaderc_util/resources.h"
#include "libshaderc_util/spirv_tools_wrapper.h"
#include "libshaderc_util/version_profile.h"
#include "shaderc_private.h"
#include "spirv/unified1/spirv.hpp"

#if (defined(_MSC_VER) && !defined(_CPPUNWIND)) || !defined(__EXCEPTIONS)
#define TRY_IF_EXCEPTIONS_ENABLED
Expand Down
6 changes: 3 additions & 3 deletions libshaderc/src/shaderc_cpp_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <memory>
#include <thread>
#include <unordered_map>

#include "SPIRV/spirv.hpp"
#include "spirv-tools/libspirv.hpp"

#include "common_shaders_for_test.h"
#include "shaderc/shaderc.hpp"
#include "spirv-tools/libspirv.hpp"
#include "spirv/unified1/spirv.hpp"

namespace {

Expand Down
7 changes: 4 additions & 3 deletions libshaderc/src/shaderc_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "shaderc/shaderc.h"

#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <memory>
#include <thread>
#include <unordered_map>

#include "SPIRV/spirv.hpp"

#include "common_shaders_for_test.h"
#include "shaderc/shaderc.h"
#include "spirv/unified1/spirv.hpp"

namespace {

Expand Down

0 comments on commit 6e90871

Please sign in to comment.