• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2016 Google Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# Add a SPIR-V Tools example. Signature:
16#   add_spvtools_example(
17#     TARGET target_name
18#     SRCS   src_file1.cpp src_file2.cpp
19#     LIBS   lib_target1 lib_target2
20#   )
21function(add_spvtools_example)
22  if (NOT ${SPIRV_SKIP_EXECUTABLES})
23    set(one_value_args TARGET)
24    set(multi_value_args SRCS LIBS)
25    cmake_parse_arguments(
26        ARG "" "${one_value_args}" "${multi_value_args}" ${ARGN})
27
28    add_executable(${ARG_TARGET} ${ARG_SRCS})
29    spvtools_default_compile_options(${ARG_TARGET})
30    target_link_libraries(${ARG_TARGET} PRIVATE ${ARG_LIBS})
31    set_property(TARGET ${ARG_TARGET} PROPERTY FOLDER "SPIRV-Tools examples")
32  endif()
33endfunction()
34
35add_subdirectory(cpp-interface)
36