-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathCMakeLists.txt
52 lines (44 loc) · 1.58 KB
/
CMakeLists.txt
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
# Copyright (C) Eta Scale AB. Licensed under the Eta Scale Open Source License. See the LICENSE file for details.
function(forall_backends target)
list(REMOVE_AT ARGV 0 )
foreach(BACKEND IN LISTS backends)
add_executable( ${target}-${BACKEND} ${ARGV} )
# Link test executable against gtest & gtest_main
target_link_libraries(${target}-${BACKEND}
argo argobackend-${BACKEND} gtest)
set_target_properties(${target}-${BACKEND} PROPERTIES
OUTPUT_NAME "${target}"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${BACKEND}"
)
if(${BACKEND} STREQUAL "mpi")
set(TEST_PARAMETERS mpirun -n ${ARGO_TESTS_NPROCS})
else()
set(TEST_PARAMETERS "")
endif()
add_test(${target}-${BACKEND}
${TEST_PARAMETERS} ${CMAKE_BINARY_DIR}/bin/${BACKEND}/${target})
endforeach(BACKEND)
endfunction(forall_backends)
function(enable_openmp target)
foreach(BACKEND IN LISTS backends)
set_target_properties(${target}-${BACKEND} PROPERTIES
COMPILE_FLAGS "-fopenmp"
LINK_FLAGS "-fopenmp")
endforeach(BACKEND)
endfunction(enable_openmp)
################################
# Unit Tests
################################
# Add test cpp file
forall_backends(trivialTests trivial.cpp)
forall_backends(allocatorsTests allocators.cpp)
forall_backends(prefetchTests prefetch.cpp)
forall_backends(apiTests api.cpp)
forall_backends(ompTests omp.cpp)
forall_backends(cppSTLTests stlallocation.cpp)
forall_backends(barrierTests barrier.cpp)
forall_backends(uninitializedTests uninitialized.cpp)
forall_backends(lockTests lock.cpp)
forall_backends(backendTests backend.cpp)
# Enable OpenMP
enable_openmp(ompTests)