mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-24 20:40:13 +00:00
Split CMakeLists.txt into smaller ones.
This commit is contained in:
parent
02141e53a7
commit
eb6fc51d35
179
CMakeLists.txt
179
CMakeLists.txt
@ -135,188 +135,17 @@ add_custom_target(spirv-tools-build-version
|
||||
${spirv-tools_SOURCE_DIR}
|
||||
COMMENT "Update build-version.inc in the Spirv-tools build directory (if necessary).")
|
||||
|
||||
set(SPIRV_SOURCES
|
||||
${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
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/ext_inst.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/instruction.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/opcode.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/operand.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/print.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/spirv_constant.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/spirv_definition.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/spirv_endian.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/table.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/text.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/text_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/assembly_grammar.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/binary.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/disassemble.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/diagnostic.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/ext_inst.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/instruction.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/opcode.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/operand.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/print.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/spirv_endian.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/table.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/text.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/text_handler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate_cfg.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate_id.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate_instruction.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate_layout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate_ssa.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/source/validate_types.cpp)
|
||||
|
||||
add_library(${SPIRV_TOOLS} ${SPIRV_SOURCES})
|
||||
spvtools_default_compile_options(${SPIRV_TOOLS})
|
||||
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
|
||||
"Skip building the executable and tests along with the library"
|
||||
${SPIRV_SKIP_EXECUTABLES})
|
||||
set(SPIRV_INSTALL_TARGETS ${SPIRV_TOOLS})
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
list(APPEND SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val)
|
||||
|
||||
add_executable(spirv-as ${CMAKE_CURRENT_SOURCE_DIR}/tools/as/as.cpp)
|
||||
spvtools_default_compile_options(spirv-as)
|
||||
target_link_libraries(spirv-as PRIVATE ${SPIRV_TOOLS})
|
||||
target_include_directories(spirv-as PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_dependencies(${SPIRV_TOOLS} spirv-tools-build-version)
|
||||
add_subdirectory(external)
|
||||
|
||||
add_subdirectory(source)
|
||||
add_subdirectory(tools)
|
||||
|
||||
add_executable(spirv-dis ${CMAKE_CURRENT_SOURCE_DIR}/tools/dis/dis.cpp)
|
||||
spvtools_default_compile_options(spirv-dis)
|
||||
target_link_libraries(spirv-dis PRIVATE ${SPIRV_TOOLS})
|
||||
target_include_directories(spirv-dis PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_dependencies(${SPIRV_TOOLS} spirv-tools-build-version)
|
||||
|
||||
add_executable(spirv-val ${CMAKE_CURRENT_SOURCE_DIR}/tools/val/val.cpp)
|
||||
spvtools_default_compile_options(spirv-val)
|
||||
target_link_libraries(spirv-val PRIVATE ${SPIRV_TOOLS})
|
||||
target_include_directories(spirv-val PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
add_dependencies(${SPIRV_TOOLS} spirv-tools-build-version)
|
||||
|
||||
# Find gmock if we can. If it's not already configured, then try finding
|
||||
# it in external/googletest
|
||||
if (TARGET gmock)
|
||||
message(STATUS "Google Mock already configured")
|
||||
else()
|
||||
set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googlemock)
|
||||
if(EXISTS ${GMOCK_DIR})
|
||||
if(WIN32)
|
||||
option(gtest_force_shared_crt
|
||||
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
|
||||
ON)
|
||||
endif()
|
||||
add_subdirectory(${GMOCK_DIR})
|
||||
endif()
|
||||
endif()
|
||||
if (TARGET gmock)
|
||||
message(STATUS "Found Google Mock, building tests.")
|
||||
|
||||
set(TEST_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TestFixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/UnitSPIRV.h
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/AssemblyContext.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/AssemblyFormat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryEndianness.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryHeaderGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryParse.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryToText.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/BinaryToText.Literal.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Comment.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/DiagnosticDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/DiagnosticPrint.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/DiagnosticStream.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ExtInstGLSLstd450.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ExtInst.OpenCL.std.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/FixWord.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/GeneratorMagicNumber.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/HexFloat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ImmediateInt.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/LibspirvMacros.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/NamedId.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeMake.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeRequiresCapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeSplit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OpcodeTableGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OperandCapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Operand.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/OperandPattern.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextAdvance.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextLiteral.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextStartsNewInst.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Annotation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Barrier.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Constant.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.ControlFlow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Debug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.DeviceSideEnqueue.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Extension.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Function.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Group.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Image.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Literal.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Memory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.Miscellaneous.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.ModeSetting.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextToBinary.TypeDeclaration.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/TextWordGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/UnitSPIRV.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ValidateFixtures.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.Capability.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.Layout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.Storage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Validate.SSA.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ValidateID.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/ValidationState.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/Version.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test/main.cpp)
|
||||
|
||||
add_executable(UnitSPIRV ${TEST_SOURCES})
|
||||
spvtools_default_compile_options(UnitSPIRV)
|
||||
if(${COMPILER_IS_LIKE_GNU})
|
||||
target_compile_options(UnitSPIRV PRIVATE -Wno-undef)
|
||||
endif()
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
# Disable C4503 "decorated name length exceeded" warning, triggered
|
||||
# by some heavily templated types.
|
||||
# We don't care much about that in test code.
|
||||
# Important to do since we have warnings-as-errors.
|
||||
target_compile_options(UnitSPIRV PRIVATE /wd4503)
|
||||
endif()
|
||||
target_include_directories(UnitSPIRV PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${gmock_SOURCE_DIR}/include ${gtest_SOURCE_DIR}/include)
|
||||
target_link_libraries(UnitSPIRV PRIVATE ${SPIRV_TOOLS} gmock)
|
||||
add_test(NAME spirv-tools-testsuite COMMAND UnitSPIRV)
|
||||
else()
|
||||
message(STATUS "Did not find googletest, tests will not be built."
|
||||
"To enable tests place googletest in '<spirv-dir>/external/googletest'.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(TARGETS ${SPIRV_INSTALL_TARGETS}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
add_subdirectory(test)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/spirv-tools/libspirv.h
|
||||
DESTINATION include/spirv-tools/)
|
||||
|
43
external/CMakeLists.txt
vendored
Normal file
43
external/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and/or associated documentation files (the
|
||||
# "Materials"), to deal in the Materials without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
# permit persons to whom the Materials are furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Materials.
|
||||
#
|
||||
# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
# KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
# SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
# https://www.khronos.org/registry/
|
||||
#
|
||||
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
# Find gmock if we can. If it's not already configured, then try finding
|
||||
# it in external/googletest.
|
||||
if (TARGET gmock)
|
||||
message(STATUS "Google Mock already configured")
|
||||
else()
|
||||
set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock)
|
||||
if(EXISTS ${GMOCK_DIR})
|
||||
if(WIN32)
|
||||
option(gtest_force_shared_crt
|
||||
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
|
||||
ON)
|
||||
endif()
|
||||
add_subdirectory(${GMOCK_DIR})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
77
source/CMakeLists.txt
Normal file
77
source/CMakeLists.txt
Normal file
@ -0,0 +1,77 @@
|
||||
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and/or associated documentation files (the
|
||||
# "Materials"), to deal in the Materials without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
# permit persons to whom the Materials are furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Materials.
|
||||
#
|
||||
# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
# KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
# SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
# https://www.khronos.org/registry/
|
||||
#
|
||||
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
set(SPIRV_SOURCES
|
||||
${spirv-tools_SOURCE_DIR}/include/spirv-tools/libspirv.h
|
||||
${spirv-tools_SOURCE_DIR}/include/spirv/spirv.h
|
||||
${spirv-tools_SOURCE_DIR}/include/spirv/GLSL.std.450.h
|
||||
${spirv-tools_SOURCE_DIR}/include/spirv/OpenCL.std.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/util/bitutils.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/util/hex_float.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/binary.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/instruction.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opcode.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/operand.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/print.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_constant.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_definition.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/table.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/text.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/text_handler.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assembly_grammar.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/binary.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/disassemble.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/diagnostic.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ext_inst.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/instruction.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/opcode.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/operand.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/print.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/spirv_endian.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/table.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/text.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/text_handler.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate_cfg.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate_id.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate_instruction.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate_layout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate_ssa.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/validate_types.cpp)
|
||||
|
||||
add_library(${SPIRV_TOOLS} ${SPIRV_SOURCES})
|
||||
spvtools_default_compile_options(${SPIRV_TOOLS})
|
||||
target_include_directories(${SPIRV_TOOLS} PUBLIC ${spirv-tools_SOURCE_DIR}/include)
|
||||
|
||||
install(TARGETS ${SPIRV_TOOLS}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
115
test/CMakeLists.txt
Normal file
115
test/CMakeLists.txt
Normal file
@ -0,0 +1,115 @@
|
||||
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and/or associated documentation files (the
|
||||
# "Materials"), to deal in the Materials without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
# permit persons to whom the Materials are furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Materials.
|
||||
#
|
||||
# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
# KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
# SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
# https://www.khronos.org/registry/
|
||||
#
|
||||
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
if (TARGET gmock)
|
||||
message(STATUS "Found Google Mock, building tests.")
|
||||
|
||||
set(TEST_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TestFixture.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/UnitSPIRV.h
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssemblyContext.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AssemblyFormat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryEndianness.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryHeaderGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryParse.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryToText.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/BinaryToText.Literal.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Comment.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DiagnosticDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DiagnosticPrint.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/DiagnosticStream.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ExtInstGLSLstd450.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ExtInst.OpenCL.std.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FixWord.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/GeneratorMagicNumber.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ImmediateInt.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/LibspirvMacros.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/NamedId.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/OpcodeMake.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/OpcodeRequiresCapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/OpcodeSplit.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/OpcodeTableGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/OperandCapabilities.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Operand.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/OperandPattern.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextAdvance.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextDestroy.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextLiteral.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextStartsNewInst.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Annotation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Barrier.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Constant.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.ControlFlow.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Debug.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.DeviceSideEnqueue.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Extension.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Function.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Group.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Image.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Literal.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Memory.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.Miscellaneous.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.ModeSetting.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextToBinary.TypeDeclaration.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/TextWordGet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/UnitSPIRV.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ValidateFixtures.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Validate.Capability.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Validate.Layout.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Validate.Storage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Validate.SSA.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ValidateID.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ValidationState.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Version.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)
|
||||
|
||||
add_executable(UnitSPIRV ${TEST_SOURCES})
|
||||
spvtools_default_compile_options(UnitSPIRV)
|
||||
if(${COMPILER_IS_LIKE_GNU})
|
||||
target_compile_options(UnitSPIRV PRIVATE -Wno-undef)
|
||||
endif()
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
|
||||
# Disable C4503 "decorated name length exceeded" warning, triggered
|
||||
# by some heavily templated types.
|
||||
# We don't care much about that in test code.
|
||||
# Important to do since we have warnings-as-errors.
|
||||
target_compile_options(UnitSPIRV PRIVATE /wd4503)
|
||||
endif()
|
||||
target_include_directories(UnitSPIRV PRIVATE
|
||||
${spirv-tools_SOURCE_DIR}
|
||||
${gmock_SOURCE_DIR}/include ${gtest_SOURCE_DIR}/include)
|
||||
target_link_libraries(UnitSPIRV PRIVATE ${SPIRV_TOOLS} gmock)
|
||||
add_test(NAME spirv-tools-testsuite COMMAND UnitSPIRV)
|
||||
else()
|
||||
message(STATUS "Did not find googletest, tests will not be built."
|
||||
"To enable tests place googletest in '<spirv-dir>/external/googletest'.")
|
||||
endif()
|
||||
endif()
|
52
tools/CMakeLists.txt
Normal file
52
tools/CMakeLists.txt
Normal file
@ -0,0 +1,52 @@
|
||||
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and/or associated documentation files (the
|
||||
# "Materials"), to deal in the Materials without restriction, including
|
||||
# without limitation the rights to use, copy, modify, merge, publish,
|
||||
# distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
# permit persons to whom the Materials are furnished to do so, subject to
|
||||
# the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included
|
||||
# in all copies or substantial portions of the Materials.
|
||||
#
|
||||
# MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
|
||||
# KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
|
||||
# SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
|
||||
# https://www.khronos.org/registry/
|
||||
#
|
||||
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
||||
set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val)
|
||||
|
||||
add_executable(spirv-as ${CMAKE_CURRENT_SOURCE_DIR}/as/as.cpp)
|
||||
spvtools_default_compile_options(spirv-as)
|
||||
target_link_libraries(spirv-as PRIVATE ${SPIRV_TOOLS})
|
||||
target_include_directories(spirv-as PRIVATE ${spirv-tools_BINARY_DIR})
|
||||
add_dependencies(${SPIRV_TOOLS} spirv-tools-build-version)
|
||||
|
||||
add_executable(spirv-dis ${CMAKE_CURRENT_SOURCE_DIR}/dis/dis.cpp)
|
||||
spvtools_default_compile_options(spirv-dis)
|
||||
target_link_libraries(spirv-dis PRIVATE ${SPIRV_TOOLS})
|
||||
target_include_directories(spirv-dis PRIVATE ${spirv-tools_BINARY_DIR})
|
||||
add_dependencies(${SPIRV_TOOLS} spirv-tools-build-version)
|
||||
|
||||
add_executable(spirv-val ${CMAKE_CURRENT_SOURCE_DIR}/val/val.cpp)
|
||||
spvtools_default_compile_options(spirv-val)
|
||||
target_link_libraries(spirv-val PRIVATE ${SPIRV_TOOLS})
|
||||
target_include_directories(spirv-val PRIVATE ${spirv-tools_BINARY_DIR})
|
||||
add_dependencies(${SPIRV_TOOLS} spirv-tools-build-version)
|
||||
|
||||
install(TARGETS ${SPIRV_INSTALL_TARGETS}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
Loading…
Reference in New Issue
Block a user