mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-27 01:21:25 +00:00
Rearrange headers
Now we have public headers arranged as follows: $SPIRV_TOOLS_ROOT/include/spirv-tools/libspirv.h $SPIRV_TOOLS_ROOT/include/spirv/spirv.h $SPIRV_TOOLS_ROOT/include/spirv/GLSL.std.450.h $SPIRV_TOOLS_ROOT/include/spirv/OpenCL.std.h A project should use -I$SPIRV_TOOLS_ROOT/include and then #include "spirv-tools/libspirv.h" The headers from the SPIR-V Registry can be accessed as "spirv/spirv." for example. The install target should also install the headers from the SPIR-V Registry. The libspirv.h header is broken otherwise. The SPIRV-Tools library depends on the headers from the SPIR-V Registry. The util/bitutils.h and util/hex_float.h are pulled into the internal source tree. Those are not part of the public API to SPIRV-Tools.
This commit is contained in:
parent
d1bb51dbb0
commit
5a70335bf1
@ -104,9 +104,12 @@ function(spvtools_default_compile_options TARGET)
|
||||
endfunction()
|
||||
|
||||
set(SPIRV_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/libspirv/libspirv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/util/bitutils.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/util/hex_float.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv/spirv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv/GLSL.std.450.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv/OpenCL.std.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/util/bitutils.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/util/hex_float.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/assembly_grammar.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/binary.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/diagnostic.h
|
||||
@ -145,9 +148,7 @@ set(SPIRV_SOURCES
|
||||
|
||||
add_library(${SPIRV_TOOLS} ${SPIRV_SOURCES})
|
||||
spvtools_default_compile_options(${SPIRV_TOOLS})
|
||||
target_include_directories(${SPIRV_TOOLS} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/external/include)
|
||||
target_include_directories(${SPIRV_TOOLS} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
# Defaults to OFF if the user didn't set it.
|
||||
option(SPIRV_SKIP_EXECUTABLES
|
||||
@ -277,5 +278,11 @@ install(TARGETS ${SPIRV_INSTALL_TARGETS}
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/libspirv/libspirv.h
|
||||
DESTINATION include/libspirv/)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.h
|
||||
DESTINATION include/spirv-tools/)
|
||||
# The installation is broken without these header files from the SPIR-V Registry.
|
||||
# The libspirv.h header includes them.
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv/spirv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv/GLSL.std.450.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/spirv/OpenCL.std.h
|
||||
DESTINATION include/spirv/)
|
||||
|
@ -24,12 +24,12 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
#ifndef LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
||||
#define LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
||||
#ifndef SPIRV_TOOLS_LIBSPIRV_H_
|
||||
#define SPIRV_TOOLS_LIBSPIRV_H_
|
||||
|
||||
#include "headers/GLSL.std.450.h"
|
||||
#include "headers/OpenCL.std.h"
|
||||
#include "headers/spirv.h"
|
||||
#include "spirv/GLSL.std.450.h"
|
||||
#include "spirv/OpenCL.std.h"
|
||||
#include "spirv/spirv.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -448,4 +448,4 @@ spv_result_t spvBinaryParse(const spv_const_context context, void* user_data,
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
||||
#endif // SPIRV_TOOLS_LIBSPIRV_H_
|
@ -27,8 +27,8 @@
|
||||
#ifndef LIBSPIRV_ASSEMBLY_GRAMMAR_H_
|
||||
#define LIBSPIRV_ASSEMBLY_GRAMMAR_H_
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "operand.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "table.h"
|
||||
|
||||
namespace libspirv {
|
||||
|
@ -36,9 +36,9 @@
|
||||
#include "assembly_grammar.h"
|
||||
#include "diagnostic.h"
|
||||
#include "ext_inst.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "opcode.h"
|
||||
#include "operand.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_constant.h"
|
||||
#include "spirv_endian.h"
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef LIBSPIRV_BINARY_H_
|
||||
#define LIBSPIRV_BINARY_H_
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "table.h"
|
||||
|
||||
// Functions
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
// Diagnostic API
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
namespace libspirv {
|
||||
|
||||
|
@ -36,9 +36,9 @@
|
||||
#include "binary.h"
|
||||
#include "diagnostic.h"
|
||||
#include "ext_inst.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "opcode.h"
|
||||
#include "print.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_constant.h"
|
||||
#include "spirv_endian.h"
|
||||
#include "util/hex_float.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef LIBSPIRV_EXT_INST_H_
|
||||
#define LIBSPIRV_EXT_INST_H_
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "table.h"
|
||||
|
||||
// Gets the type of the extended instruction set with the specified name.
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "headers/spirv.h"
|
||||
#include "spirv/spirv.h"
|
||||
|
||||
#include "table.h"
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <cstdlib>
|
||||
|
||||
#include "instruction.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_constant.h"
|
||||
#include "spirv_endian.h"
|
||||
#include "spirv_operands.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#define LIBSPIRV_OPCODE_H_
|
||||
|
||||
#include "instruction.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "table.h"
|
||||
|
||||
// Returns the name of a registered SPIR-V generator as a null-terminated
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "table.h"
|
||||
|
||||
// A sequence of operand types.
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef LIBSPIRV_SPIRV_CONSTANT_H_
|
||||
#define LIBSPIRV_SPIRV_CONSTANT_H_
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
// Version number macros.
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
// A bit mask representing a set of capabilities.
|
||||
// Currently there are 57 distinct capabilities, so 64 bits
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef LIBSPIRV_SPIRV_ENDIAN_H_
|
||||
#define LIBSPIRV_SPIRV_ENDIAN_H_
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
// Converts a word in the specified endianness to the host native endianness.
|
||||
uint32_t spvFixWord(const uint32_t word, const spv_endianness_t endianness);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#ifndef LIBSPIRV_TABLE_H_
|
||||
#define LIBSPIRV_TABLE_H_
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_definition.h"
|
||||
#include "spirv_operands.h"
|
||||
|
||||
|
@ -43,9 +43,9 @@
|
||||
#include "diagnostic.h"
|
||||
#include "ext_inst.h"
|
||||
#include "instruction.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "opcode.h"
|
||||
#include "operand.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_constant.h"
|
||||
#include "table.h"
|
||||
#include "text_handler.h"
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "operand.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_constant.h"
|
||||
|
||||
typedef enum spv_literal_type_t {
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#include "diagnostic.h"
|
||||
#include "instruction.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "text.h"
|
||||
|
||||
namespace libspirv {
|
||||
|
@ -24,8 +24,8 @@
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
#ifndef _LIBSPIRV_UTIL_HEX_FLOAT_H_
|
||||
#define _LIBSPIRV_UTIL_HEX_FLOAT_H_
|
||||
#ifndef LIBSPIRV_UTIL_HEX_FLOAT_H_
|
||||
#define LIBSPIRV_UTIL_HEX_FLOAT_H_
|
||||
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
@ -1087,4 +1087,4 @@ inline std::ostream& operator<<<Float16>(std::ostream& os,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBSPIRV_UTIL_HEX_FLOAT_H_
|
||||
#endif // LIBSPIRV_UTIL_HEX_FLOAT_H_
|
@ -30,7 +30,7 @@
|
||||
#include "binary.h"
|
||||
#include "diagnostic.h"
|
||||
#include "instruction.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "opcode.h"
|
||||
#include "operand.h"
|
||||
#include "spirv_constant.h"
|
||||
|
@ -34,12 +34,11 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
|
||||
#include "assembly_grammar.h"
|
||||
#include "binary.h"
|
||||
#include "diagnostic.h"
|
||||
#include "instruction.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "spirv_definition.h"
|
||||
#include "table.h"
|
||||
|
||||
|
@ -31,8 +31,8 @@
|
||||
|
||||
#include "diagnostic.h"
|
||||
#include "instruction.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "opcode.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
#include "validate.h"
|
||||
|
||||
#define spvCheck(condition, action) \
|
||||
|
@ -27,7 +27,7 @@
|
||||
// Source code for logical layout validation as described in section 2.4
|
||||
|
||||
#include "validate_passes.h"
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
#include "diagnostic.h"
|
||||
#include "opcode.h"
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "headers/spirv.h"
|
||||
#include "spirv/spirv.h"
|
||||
|
||||
#include "spirv_definition.h"
|
||||
#include "validate.h"
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include "UnitSPIRV.h"
|
||||
#include "util/hex_float.h"
|
||||
#include "source/util/hex_float.h"
|
||||
|
||||
namespace {
|
||||
using ::testing::Eq;
|
||||
|
@ -30,8 +30,8 @@
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "source/util/bitutils.h"
|
||||
#include "TestFixture.h"
|
||||
#include "util/bitutils.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -33,8 +33,8 @@
|
||||
#include "TestFixture.h"
|
||||
#include "UnitSPIRV.h"
|
||||
#include "source/spirv_constant.h"
|
||||
#include "util/bitutils.h"
|
||||
#include "util/hex_float.h"
|
||||
#include "source/util/bitutils.h"
|
||||
#include "source/util/hex_float.h"
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "source/assembly_grammar.h"
|
||||
#include "source/binary.h"
|
||||
#include "source/diagnostic.h"
|
||||
@ -40,6 +39,7 @@
|
||||
#include "source/text.h"
|
||||
#include "source/text_handler.h"
|
||||
#include "source/validate.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <vector>
|
||||
|
||||
#include "headers/spirv.h"
|
||||
#include "spirv/spirv.h"
|
||||
|
||||
#include "source/validate.h"
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
void print_usage(char* argv0) {
|
||||
printf(
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
static void print_usage(char* argv0) {
|
||||
printf(
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "libspirv/libspirv.h"
|
||||
#include "spirv-tools/libspirv.h"
|
||||
|
||||
void print_usage(char* argv0) {
|
||||
printf(
|
||||
|
Loading…
Reference in New Issue
Block a user