-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
78 lines (62 loc) · 1.72 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
project(lbmdem LANGUAGES CXX)
# Require C++11-compliant compiler; only available for CMake v. 3.1 and up
set(CMAKE_CXX_STANDARD 11)
cmake_minimum_required(VERSION 3.1)
SET(CMAKE_COLOR_MAKEFILE ON)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
# General compile settings
IF (NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
ENDIF (NOT CMAKE_BUILD_TYPE)
# GNU Specific settings
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()
# OpenMP
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
# add_compile_options(${OpenMP_CXX_FLAGS})
endif()
# LBM-DEM settings
OPTION(USE_DOUBLE_PRECISION "Use double precision" ON)
# CMake Modules
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# KOKKOS
find_package(KOKKOS REQUIRED)
include_directories(${KOKKOS_INCLUDE_DIRS})
link_libraries(${KOKKOS_LIBRARIES})
# Include directories
include_directories(
${lbmdem_SOURCE_DIR}/include
${lbmdem_SOURCE_DIR}/external
)
# LBMDEM executable
SET(lbm_src
src/lattice.cc
src/main.cc
)
add_executable(lbmdem
${lbm_src}
)
# Unit test
SET(test_src
src/lattice.cc
tests/test.cc
tests/lattice_test.cc
tests/lb_node_2d_test.cc
tests/lb_node_3d_test.cc
)
add_executable(lbmdemtest
${test_src}
)
add_test(NAME lbmdemtest COMMAND $<TARGET_FILE:lbmdemtest>)
include(CTest)
find_program( MEMORYCHECK_COMMAND valgrind )
set( MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --error-exitcode=1" )
# Coverage
find_package(codecov)
add_coverage(lbmdem)
add_coverage(lbmdemtest)
install(TARGETS lbmdem lbmdemtest RUNTIME DESTINATION bin)