xref: /aosp_15_r20/external/swiftshader/tests/VulkanBenchmarks/CMakeLists.txt (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
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
15set(ROOT_PROJECT_COMPILE_OPTIONS
16)
17
18set(ROOT_PROJECT_LINK_LIBRARIES
19    ${OS_LIBS}
20    ${SWIFTSHADER_LIBS}
21)
22
23set(VULKAN_BENCHMARKS_SRC_FILES
24    ClearImageBenchmarks.cpp
25    ComputeBenchmarks.cpp
26    main.cpp
27    TriangleBenchmarks.cpp
28)
29
30add_executable(VulkanBenchmarks
31    ${VULKAN_BENCHMARKS_SRC_FILES}
32)
33
34if (NOT TARGET benchmark::benchmark)
35    message(FATAL_ERROR "Missing required target: benchmark::benchmark")
36endif()
37
38if (NOT TARGET VulkanWrapper)
39    message(FATAL_ERROR "Missing required target: VulkanWrapper")
40endif()
41
42add_dependencies(VulkanBenchmarks
43    vk_swiftshader
44)
45
46set_target_properties(VulkanBenchmarks PROPERTIES
47    FOLDER "Tests/Benchmarks"
48    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
49)
50
51target_include_directories(VulkanBenchmarks
52    PRIVATE
53        "${SWIFTSHADER_DIR}/include/"
54)
55
56target_compile_options(VulkanBenchmarks
57    PRIVATE
58        ${ROOT_PROJECT_COMPILE_OPTIONS}
59)
60
61target_link_options(VulkanBenchmarks
62    PRIVATE
63        ${SWIFTSHADER_LINK_FLAGS}
64)
65
66target_link_libraries(VulkanBenchmarks
67    PRIVATE
68        benchmark::benchmark
69        VulkanWrapper
70        ${ROOT_PROJECT_LINK_LIBRARIES}
71)
72