xref: /aosp_15_r20/external/swiftshader/tests/VulkanBenchmarks/CMakeLists.txt (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1*03ce13f7SAndroid Build Coastguard Worker# Copyright 2020 The SwiftShader Authors. All Rights Reserved.
2*03ce13f7SAndroid Build Coastguard Worker#
3*03ce13f7SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*03ce13f7SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*03ce13f7SAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*03ce13f7SAndroid Build Coastguard Worker#
7*03ce13f7SAndroid Build Coastguard Worker#    http://www.apache.org/licenses/LICENSE-2.0
8*03ce13f7SAndroid Build Coastguard Worker#
9*03ce13f7SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*03ce13f7SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*03ce13f7SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*03ce13f7SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*03ce13f7SAndroid Build Coastguard Worker# limitations under the License.
14*03ce13f7SAndroid Build Coastguard Worker
15*03ce13f7SAndroid Build Coastguard Workerset(ROOT_PROJECT_COMPILE_OPTIONS
16*03ce13f7SAndroid Build Coastguard Worker)
17*03ce13f7SAndroid Build Coastguard Worker
18*03ce13f7SAndroid Build Coastguard Workerset(ROOT_PROJECT_LINK_LIBRARIES
19*03ce13f7SAndroid Build Coastguard Worker    ${OS_LIBS}
20*03ce13f7SAndroid Build Coastguard Worker    ${SWIFTSHADER_LIBS}
21*03ce13f7SAndroid Build Coastguard Worker)
22*03ce13f7SAndroid Build Coastguard Worker
23*03ce13f7SAndroid Build Coastguard Workerset(VULKAN_BENCHMARKS_SRC_FILES
24*03ce13f7SAndroid Build Coastguard Worker    ClearImageBenchmarks.cpp
25*03ce13f7SAndroid Build Coastguard Worker    ComputeBenchmarks.cpp
26*03ce13f7SAndroid Build Coastguard Worker    main.cpp
27*03ce13f7SAndroid Build Coastguard Worker    TriangleBenchmarks.cpp
28*03ce13f7SAndroid Build Coastguard Worker)
29*03ce13f7SAndroid Build Coastguard Worker
30*03ce13f7SAndroid Build Coastguard Workeradd_executable(VulkanBenchmarks
31*03ce13f7SAndroid Build Coastguard Worker    ${VULKAN_BENCHMARKS_SRC_FILES}
32*03ce13f7SAndroid Build Coastguard Worker)
33*03ce13f7SAndroid Build Coastguard Worker
34*03ce13f7SAndroid Build Coastguard Workerif (NOT TARGET benchmark::benchmark)
35*03ce13f7SAndroid Build Coastguard Worker    message(FATAL_ERROR "Missing required target: benchmark::benchmark")
36*03ce13f7SAndroid Build Coastguard Workerendif()
37*03ce13f7SAndroid Build Coastguard Worker
38*03ce13f7SAndroid Build Coastguard Workerif (NOT TARGET VulkanWrapper)
39*03ce13f7SAndroid Build Coastguard Worker    message(FATAL_ERROR "Missing required target: VulkanWrapper")
40*03ce13f7SAndroid Build Coastguard Workerendif()
41*03ce13f7SAndroid Build Coastguard Worker
42*03ce13f7SAndroid Build Coastguard Workeradd_dependencies(VulkanBenchmarks
43*03ce13f7SAndroid Build Coastguard Worker    vk_swiftshader
44*03ce13f7SAndroid Build Coastguard Worker)
45*03ce13f7SAndroid Build Coastguard Worker
46*03ce13f7SAndroid Build Coastguard Workerset_target_properties(VulkanBenchmarks PROPERTIES
47*03ce13f7SAndroid Build Coastguard Worker    FOLDER "Tests/Benchmarks"
48*03ce13f7SAndroid Build Coastguard Worker    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
49*03ce13f7SAndroid Build Coastguard Worker)
50*03ce13f7SAndroid Build Coastguard Worker
51*03ce13f7SAndroid Build Coastguard Workertarget_include_directories(VulkanBenchmarks
52*03ce13f7SAndroid Build Coastguard Worker    PRIVATE
53*03ce13f7SAndroid Build Coastguard Worker        "${SWIFTSHADER_DIR}/include/"
54*03ce13f7SAndroid Build Coastguard Worker)
55*03ce13f7SAndroid Build Coastguard Worker
56*03ce13f7SAndroid Build Coastguard Workertarget_compile_options(VulkanBenchmarks
57*03ce13f7SAndroid Build Coastguard Worker    PRIVATE
58*03ce13f7SAndroid Build Coastguard Worker        ${ROOT_PROJECT_COMPILE_OPTIONS}
59*03ce13f7SAndroid Build Coastguard Worker)
60*03ce13f7SAndroid Build Coastguard Worker
61*03ce13f7SAndroid Build Coastguard Workertarget_link_options(VulkanBenchmarks
62*03ce13f7SAndroid Build Coastguard Worker    PRIVATE
63*03ce13f7SAndroid Build Coastguard Worker        ${SWIFTSHADER_LINK_FLAGS}
64*03ce13f7SAndroid Build Coastguard Worker)
65*03ce13f7SAndroid Build Coastguard Worker
66*03ce13f7SAndroid Build Coastguard Workertarget_link_libraries(VulkanBenchmarks
67*03ce13f7SAndroid Build Coastguard Worker    PRIVATE
68*03ce13f7SAndroid Build Coastguard Worker        benchmark::benchmark
69*03ce13f7SAndroid Build Coastguard Worker        VulkanWrapper
70*03ce13f7SAndroid Build Coastguard Worker        ${ROOT_PROJECT_LINK_LIBRARIES}
71*03ce13f7SAndroid Build Coastguard Worker)
72