forked from SCOREC/pumi-pic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
132 lines (105 loc) · 3.15 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
131
132
cmake_minimum_required(VERSION 3.0.0)
project(pumipic VERSION 1.0.0 LANGUAGES CXX)
include(cmake/bob.cmake)
macro(pumipic_export_lib target headers)
bob_export_target(${target})
install(FILES ${headers} DESTINATION include)
endmacro(pumipic_export_lib)
#look for config files first then look for modules (FindXYZ.cmake)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
bob_begin_package()
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
#Settings options for testing
enable_testing()
include(CTest)
option(IS_TESTING "Build for CTest" OFF)
message(STATUS "IS_TESTING: ${IS_TESTING}")
if(IS_TESTING)
set(TEST_DATA_DIR "" CACHE PATH
"Path to a local copy of the pumipic-data repo.")
if(NOT EXISTS ${TEST_DATA_DIR})
message(FATAL_ERROR "TEST_DATA_DIR \"${TEST_DATA_DIR}\" is not accessible")
endif()
endif()
# find MPI
set(pumipic_USE_MPI_DEFAULT ON)
bob_public_dep(MPI 3)
#get the mpirun binary/script
get_filename_component(COMPILER_DIR "${CMAKE_CXX_COMPILER}" PATH)
find_program(MPIRUN NAMES mpirun PATHS "${COMPILER_DIR}")
set(MPIRUN_PROCFLAG "-np" CACHE STRING
"the command line flag to give process count to MPIRUN")
set(pumipic_USE_Omega_h_DEFAULT ON)
set(Omega_h_PREFIX ${Omega_h_PREFIX})
bob_public_dep(Omega_h)
#Clear the omegah compilation flags that it passes to cuda. Using the
# kokkos target, and nvcc_wrapper, provide sufficient flags.
set_property(TARGET Omega_h::omega_h PROPERTY INTERFACE_COMPILE_OPTIONS "")
include(CheckCXXSymbolExists)
check_cxx_symbol_exists(ask_revClass "Omega_h_mesh.hpp" OMEGA_HAS_REVCLASS)
set(ENGPAR_ENABLED true)
include_directories(${ENGPAR_INCLUDE_DIR})
message(STATUS "Found EnGPar")
set(pumipic_USE_EnGPar_DEFAULT ON)
set(EnGPar_PREFIX ${EnGPar_PREFIX})
bob_public_dep(EnGPar)
option(ENABLE_CABANA "Build with Cabana" OFF)
if(ENABLE_CABANA)
# bob package creation { no idea if this will work
set(pumipic_USE_Cabana_DEFAULT ON)
set(Cabana_PREFIX ${Cabana_PREFIX})
bob_public_dep(Cabana)
# }
add_definitions(-DPP_ENABLE_CAB)
endif()
set(pumipic_USE_Kokkos_DEFAULT ON)
bob_public_dep(Kokkos)
set(KOKKOS_ENABLED true)
set(debug_flag)
if (PP_ENABLE_DEBUG_SYMBOLS)
set(debug_flag "-g")
endif()
set(opt_flag)
if (PP_ENABLE_OPT)
set(opt_flag "-O3")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${debug_flag} ${opt_flag}")
message(STATUS "CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}")
# testing helper function
function(mpi_test TESTNAME PROCS EXE)
add_test(
NAME ${TESTNAME}
COMMAND ${MPIRUN} ${MPIRUN_PROCFLAG} ${PROCS} ${VALGRIND} ${VALGRIND_ARGS} ${EXE} ${ARGN}
)
endfunction(mpi_test)
# support
add_subdirectory(support)
include_directories(support)
set(ALL_LIBS
support
)
if (PP_ENABLE_DEBUG_MODE)
add_definitions(-DPP_DEBUG)
target_compile_definitions(support INTERFACE -DPP_DEBUG)
endif()
# particle structures
add_subdirectory(particle_structs)
set(ALL_LIBS
support
particleStructs
)
# Reset cxx flags since they are picked up from omega-h
set(CMAKE_CXX_FLAGS "${debug_flag} ${opt_flag}")
# pumipic
add_subdirectory(src)
set(ALL_LIBS
${ALL_LIBS}
pumipic
)
if(IS_TESTING)
add_subdirectory(test)
add_subdirectory(performance_tests)
endif()
bob_end_package()