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:
David Neto 2016-02-17 14:44:00 -05:00
parent d1bb51dbb0
commit 5a70335bf1
39 changed files with 56 additions and 50 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@
#include <iostream>
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
// Diagnostic API

View File

@ -31,7 +31,7 @@
#include <sstream>
#include <utility>
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
namespace libspirv {

View File

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

View File

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

View File

@ -30,7 +30,7 @@
#include <cstdint>
#include <vector>
#include "headers/spirv.h"
#include "spirv/spirv.h"
#include "table.h"

View File

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

View File

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

View File

@ -29,7 +29,7 @@
#include <deque>
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
#include "table.h"
// A sequence of operand types.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -34,7 +34,7 @@
#include "diagnostic.h"
#include "instruction.h"
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
#include "text.h"
namespace libspirv {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@
#include <unordered_set>
#include <vector>
#include "headers/spirv.h"
#include "spirv/spirv.h"
#include "spirv_definition.h"
#include "validate.h"

View File

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

View File

@ -30,8 +30,8 @@
#include <gmock/gmock.h>
#include "source/util/bitutils.h"
#include "TestFixture.h"
#include "util/bitutils.h"
namespace {

View File

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

View File

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

View File

@ -30,7 +30,7 @@
#include <gtest/gtest.h>
#include <vector>
#include "headers/spirv.h"
#include "spirv/spirv.h"
#include "source/validate.h"

View File

@ -28,7 +28,7 @@
#include <vector>
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
void print_usage(char* argv0) {
printf(

View File

@ -29,7 +29,7 @@
#include <string>
#include <vector>
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
static void print_usage(char* argv0) {
printf(

View File

@ -30,7 +30,7 @@
#include <vector>
#include "libspirv/libspirv.h"
#include "spirv-tools/libspirv.h"
void print_usage(char* argv0) {
printf(