2016-03-17 02:43:31 +00:00
|
|
|
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
|
|
|
#
|
2016-09-01 19:33:59 +00:00
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
2016-03-17 02:43:31 +00:00
|
|
|
#
|
2016-09-01 19:33:59 +00:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2016-03-17 02:43:31 +00:00
|
|
|
#
|
2016-09-01 19:33:59 +00:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
2016-03-17 02:43:31 +00:00
|
|
|
|
2019-04-26 13:37:23 +00:00
|
|
|
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
|
|
|
add_subdirectory(lesspipe)
|
|
|
|
endif()
|
2016-09-02 20:04:02 +00:00
|
|
|
add_subdirectory(emacs)
|
2016-08-22 15:38:18 +00:00
|
|
|
|
2016-06-30 17:56:34 +00:00
|
|
|
# Add a SPIR-V Tools command line tool. Signature:
|
|
|
|
# add_spvtools_tool(
|
|
|
|
# TARGET target_name
|
|
|
|
# SRCS src_file1.cpp src_file2.cpp
|
|
|
|
# LIBS lib_target1 lib_target2
|
|
|
|
# )
|
|
|
|
function(add_spvtools_tool)
|
|
|
|
set(one_value_args TARGET)
|
|
|
|
set(multi_value_args SRCS LIBS)
|
|
|
|
cmake_parse_arguments(
|
|
|
|
ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN})
|
2016-03-17 02:43:31 +00:00
|
|
|
|
2016-06-30 17:56:34 +00:00
|
|
|
add_executable(${ARG_TARGET} ${ARG_SRCS})
|
|
|
|
spvtools_default_compile_options(${ARG_TARGET})
|
|
|
|
target_link_libraries(${ARG_TARGET} PRIVATE ${ARG_LIBS})
|
2017-03-15 21:28:24 +00:00
|
|
|
target_include_directories(${ARG_TARGET} PRIVATE
|
|
|
|
${spirv-tools_SOURCE_DIR}
|
|
|
|
${spirv-tools_BINARY_DIR}
|
2017-04-05 21:32:39 +00:00
|
|
|
)
|
|
|
|
set_property(TARGET ${ARG_TARGET} PROPERTY FOLDER "SPIRV-Tools executables")
|
2016-06-30 17:56:34 +00:00
|
|
|
endfunction()
|
2016-03-17 02:43:31 +00:00
|
|
|
|
2016-06-30 17:56:34 +00:00
|
|
|
if (NOT ${SPIRV_SKIP_EXECUTABLES})
|
2020-10-29 13:25:26 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-as SRCS as/as.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2022-02-02 15:33:18 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-diff SRCS diff/diff.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-diff SPIRV-Tools-opt ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2020-10-29 13:25:26 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-dis SRCS dis/dis.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY})
|
|
|
|
add_spvtools_tool(TARGET spirv-val SRCS val/val.cpp util/cli_consumer.cpp LIBS ${SPIRV_TOOLS_FULL_VISIBILITY})
|
|
|
|
add_spvtools_tool(TARGET spirv-opt SRCS opt/opt.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-opt ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2021-12-10 15:35:52 +00:00
|
|
|
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS")) # iOS does not allow std::system calls which spirv-reduce requires
|
2020-10-29 13:25:26 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-reduce SRCS reduce/reduce.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-reduce ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2019-02-04 17:39:39 +00:00
|
|
|
endif()
|
2020-10-29 13:25:26 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-link SRCS link/linker.cpp LIBS SPIRV-Tools-link ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2021-08-06 18:03:59 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-lint SRCS lint/lint.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-lint SPIRV-Tools-opt ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2016-08-03 15:55:14 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-cfg
|
|
|
|
SRCS cfg/cfg.cpp
|
|
|
|
cfg/bin_to_dot.h
|
|
|
|
cfg/bin_to_dot.cpp
|
2020-10-29 13:25:26 +00:00
|
|
|
LIBS ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2016-08-03 15:55:14 +00:00
|
|
|
target_include_directories(spirv-cfg PRIVATE ${spirv-tools_SOURCE_DIR}
|
|
|
|
${SPIRV_HEADER_INCLUDE_DIR})
|
2019-05-24 19:43:59 +00:00
|
|
|
set(SPIRV_INSTALL_TARGETS spirv-as spirv-dis spirv-val spirv-opt
|
2021-08-06 18:03:59 +00:00
|
|
|
spirv-cfg spirv-link spirv-lint)
|
2021-12-10 15:35:52 +00:00
|
|
|
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL "iOS"))
|
2019-02-04 17:39:39 +00:00
|
|
|
set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-reduce)
|
|
|
|
endif()
|
2017-09-25 16:45:48 +00:00
|
|
|
|
2019-05-27 14:46:35 +00:00
|
|
|
if(SPIRV_BUILD_FUZZER)
|
2020-10-29 13:25:26 +00:00
|
|
|
add_spvtools_tool(TARGET spirv-fuzz SRCS fuzz/fuzz.cpp util/cli_consumer.cpp LIBS SPIRV-Tools-fuzz ${SPIRV_TOOLS_FULL_VISIBILITY})
|
2019-05-27 14:46:35 +00:00
|
|
|
set(SPIRV_INSTALL_TARGETS ${SPIRV_INSTALL_TARGETS} spirv-fuzz)
|
|
|
|
endif(SPIRV_BUILD_FUZZER)
|
|
|
|
|
2017-07-04 13:11:40 +00:00
|
|
|
if(ENABLE_SPIRV_TOOLS_INSTALL)
|
2021-12-10 15:35:52 +00:00
|
|
|
install(TARGETS ${SPIRV_INSTALL_TARGETS} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2017-07-04 13:11:40 +00:00
|
|
|
endif(ENABLE_SPIRV_TOOLS_INSTALL)
|
2016-03-17 02:43:31 +00:00
|
|
|
endif()
|