forked from homerdin/RAJA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRAJAMacros.cmake
108 lines (86 loc) · 2.71 KB
/
RAJAMacros.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
###############################################################################
# Copyright (c) 2016-20, Lawrence Livermore National Security, LLC
# and other RAJA project contributors. See the RAJA/COPYRIGHT file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
################################################################################
macro(raja_add_executable)
set(options )
set(singleValueArgs NAME TEST REPRODUCER BENCHMARK)
set(multiValueArgs SOURCES DEPENDS_ON)
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
list (APPEND arg_DEPENDS_ON RAJA)
if (ENABLE_OPENMP)
list (APPEND arg_DEPENDS_ON openmp)
endif ()
if (ENABLE_CUDA)
list (APPEND arg_DEPENDS_ON cuda)
endif ()
if (ENABLE_HIP)
list (APPEND arg_DEPENDS_ON hip)
endif ()
if (ENABLE_TBB)
list (APPEND arg_DEPENDS_ON tbb)
endif ()
if (${arg_TEST})
set (_output_dir ${CMAKE_BINARY_DIR}/test)
elseif (${arg_REPRODUCER})
set (_output_dir ${CMAKE_BINARY_DIR}/reproducers)
elseif (${arg_BENCHMARK})
set (_output_dir ${CMAKE_BINARY_DIR}/benchmark)
else ()
set (_output_dir ${CMAKE_BINARY_DIR}/bin)
endif()
blt_add_executable(
NAME ${arg_NAME}
SOURCES ${arg_SOURCES}
DEPENDS_ON ${arg_DEPENDS_ON}
OUTPUT_DIR ${_output_dir}
)
endmacro(raja_add_executable)
macro(raja_add_test)
set(options )
set(singleValueArgs NAME)
set(multiValueArgs SOURCES DEPENDS_ON)
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
list (APPEND arg_DEPENDS_ON gtest ${CMAKE_THREAD_LIBS_INIT})
raja_add_executable(
NAME ${arg_NAME}.exe
SOURCES ${arg_SOURCES}
DEPENDS_ON ${arg_DEPENDS_ON}
TEST On)
blt_add_test(
NAME ${arg_NAME}
#COMMAND ${TEST_DRIVER} $<TARGET_FILE:${arg_NAME}>)
COMMAND ${TEST_DRIVER} ${arg_NAME})
endmacro(raja_add_test)
macro(raja_add_reproducer)
set(options )
set(singleValueArgs NAME)
set(multiValueArgs SOURCES DEPENDS_ON)
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
raja_add_executable(
NAME ${arg_NAME}.exe
SOURCES ${arg_SOURCES}
DEPENDS_ON ${arg_DEPENDS_ON}
REPRODUCER On)
endmacro(raja_add_reproducer)
macro(raja_add_benchmark)
set(options )
set(singleValueArgs NAME)
set(multiValueArgs SOURCES DEPENDS_ON)
cmake_parse_arguments(arg
"${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGN})
list (APPEND arg_DEPENDS_ON gbenchmark)
raja_add_executable(
NAME ${arg_NAME}.exe
SOURCES ${arg_SOURCES}
DEPENDS_ON ${arg_DEPENDS_ON}
BENCHMARK On)
blt_add_benchmark(
NAME ${arg_NAME}
COMMAND ${TEST_DRIVER} ${arg_NAME})
endmacro(raja_add_benchmark)