• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
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
15add_executable(turbo-cov
16    main.cpp
17)
18
19set_target_properties(turbo-cov PROPERTIES
20    FOLDER "Tests"
21    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
22)
23
24target_link_libraries(turbo-cov
25    PRIVATE
26        llvm-with-cov
27)
28
29# Emit a coverage-toolchain.txt file next to the vk_swiftshader_icd.json
30# file so that regres can locate the LLVM toolchain used to build the
31# .so file. With this, the correct llvm-cov and llvm-profdata tools
32# from the same toolchain can be located.
33get_filename_component(COMPILER_TOOLCHAIN_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
34file(GENERATE
35    OUTPUT "${CMAKE_BINARY_DIR}/${CMAKE_SYSTEM_NAME}/coverage-toolchain.txt"
36    CONTENT "{\"llvm\": \"${COMPILER_TOOLCHAIN_DIR}\", \"turbo-cov\": \"$<TARGET_FILE:turbo-cov>\"}"
37)
38