forked from SCOREC/pumi-pic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (60 loc) · 2.27 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
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)
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()
#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 debug flag
set(debug_flag)
if (${CMAKE_BUILD_TYPE} STREQUAL "DEBUG")
set(debug_flag "-g")
endif()
#deps
find_package(KokkosCore REQUIRED)
include_directories(${KokkosCore_INCLUDE_DIRS})
message(STATUS "Kokkos enabled - Overriding compiler selection for consistency with Kokkos install")
set(CMAKE_CXX_COMPILER ${KokkosCore_CXX_COMPILER})
set(CMAKE_C_COMPILER ${KokkosCore_C_COMPILER})
message(STATUS "Kokkos CMAKE_CXX_COMPILER ${KokkosCore_CXX_COMPILER}")
message(STATUS "Kokkos CMAKE_C_COMPILER ${KokkosCore_C_COMPILER}")
message(STATUS "Kokkos enabled - Overriding compiler flags for consistency with Kokkos install")
set(CMAKE_CXX_FLAGS "${debug_flag} ${KokkosCore_CXX_FLAGS}")
set(CMAKE_C_FLAGS "${debug_flag} ${KokkosCore_C_FLAGS}")
message(STATUS "Kokkos CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}")
message(STATUS "Kokkos CMAKE_C_FLAGS ${CMAKE_C_FLAGS}")
find_package(particle_structures 0.0.1 REQUIRED)
set(pumipic_USE_particle_structures_DEFAULT ON)
message(STATUS "Found particle_structures: ${particle_structures_VERSION}")
bob_public_dep(particle_structures)
find_package(Omega_h 9 REQUIRED)
set(pumipic_USE_Omega_h_DEFAULT ON)
message(STATUS "Found Omega_h: ${Omega_h_VERSION}")
bob_public_dep(Omega_h)
#code
add_subdirectory(src)
if(IS_TESTING)
add_subdirectory(test)
endif()
bob_end_package()