-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
130 lines (113 loc) · 3.86 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
cmake_minimum_required(VERSION 3.12)
project(efc_no)
include(FetchContent)
FetchContent_Declare(
catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.7)
FetchContent_GetProperties(catch2)
if(NOT catch2_POPULATED)
FetchContent_Populate(catch2)
add_subdirectory(${catch2_SOURCE_DIR} ${catch2_BINARY_DIR})
endif()
find_package(Threads)
set(FIND_HDF_COMPONENTS C static)
find_package(HDF5 REQUIRED)
# find_package(HDF5 NAMES "hdf5" COMPONENTS ${FIND_HDF_COMPONENTS})
if(HDF5_FOUND)
# if(HDF5_static_C_FOUND)
set(LINK_LIBS ${LINK_LIBS} ${HDF5_C_LIBRARIES})
# endif()
else()
message(FATAL_ERROR "HDF5 is Required")
endif()
INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O2")
set(efc_no_srcs src/efc_no.cpp)
add_executable(efc_no ${efc_no_srcs})
target_link_libraries(efc_no ${LINK_LIBS} Catch2::Catch2)
target_include_directories(efc_no PUBLIC ${MPI_C_INCLUDE_DIRS})
set_property(TARGET efc_no
APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
)
set(cmpd_subset_srcs src/cmpd_subset.cpp)
add_executable(cmpd_subset ${cmpd_subset_srcs})
target_link_libraries(cmpd_subset ${LINK_LIBS} Catch2::Catch2)
target_include_directories(cmpd_subset PUBLIC ${MPI_C_INCLUDE_DIRS})
set_property(TARGET cmpd_subset
APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
)
set(many_dsets_srcs src/many_dsets.cpp)
add_executable(many_dsets ${many_dsets_srcs})
target_link_libraries(many_dsets ${LINK_LIBS} Catch2::Catch2)
target_include_directories(many_dsets PUBLIC ${MPI_C_INCLUDE_DIRS})
set_property(TARGET many_dsets
APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE
)
set(TEST_nprocs 2)
add_test(
NAME CLEAR_efc_no
COMMAND ${CMAKE_COMMAND} -E remove *.h5
)
add_test(NAME TEST_efc_no COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:efc_no>"
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE:BOOL=true"
-D "TEST_OUTPUT=efc_no.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${PROJECT_SOURCE_DIR}/scripts/runTest.cmake"
)
set_tests_properties(TEST_efc_no PROPERTIES DEPENDS CLEAR_efc_no)
add_test(
NAME CLEAR_many_dsets
COMMAND ${CMAKE_COMMAND} -E remove *.h5
)
add_test(NAME TEST_many_dsets COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:many_dsets>"
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE:BOOL=true"
-D "TEST_OUTPUT=many_dsets.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${PROJECT_SOURCE_DIR}/scripts/runTest.cmake"
)
set_tests_properties(TEST_many_dsets PROPERTIES DEPENDS CLEAR_many_dsets)
#[[
add_test(
NAME CLEAR_cmpd_subset
COMMAND ${CMAKE_COMMAND} -E remove *.h5
)
add_test(NAME TEST_cmpd_subset COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:cmpd_subset>"
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE:BOOL=true"
-D "TEST_OUTPUT=cmpd_subset.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${PROJECT_SOURCE_DIR}/scripts/runTest.cmake"
)
set_tests_properties(TEST_cmpd_subset PROPERTIES DEPENDS CLEAR_cmpd_subset)
]]
set(DART_TESTING_TIMEOUT 1200
CACHE STRING
"Timeout in seconds for each test(default 1200=20minutes)"
)
enable_testing()
include(CTest)
include(${PROJECT_SOURCE_DIR}/CTestConfig.cmake)
target_compile_options(
${PROJECT_NAME}
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/DCATCH_CONFIG_ENABLE_BENCHMARKING>
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-DCATCH_CONFIG_ENABLE_BENCHMARKING>
)
target_compile_options(
cmpd_subset
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/DCATCH_CONFIG_ENABLE_BENCHMARKING>
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-DCATCH_CONFIG_ENABLE_BENCHMARKING>
)
target_compile_options(
many_dsets
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/DCATCH_CONFIG_ENABLE_BENCHMARKING>
$<$<OR:$<CXX_COMPILER_ID:GNU>,$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-DCATCH_CONFIG_ENABLE_BENCHMARKING>
)