-
Notifications
You must be signed in to change notification settings - Fork 7
/
CMakeLists.txt
75 lines (59 loc) · 2.06 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
cmake_minimum_required(VERSION 3.00)
project(root_digger)
option(MPI_BUILD "Build with MPI" OFF)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fno-omit-frame-pointer" CACHE INTERNAL "")
set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE INTERNAL "")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fno-omit-frame-pointer " CACHE INTERNAL "")
set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE INTERNAL "")
find_package(Git)
if(GIT_FOUND)
if(EXISTS ${CMAKE_SOURCE_DIR})
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags
WORKING_DIRECTORY "${local_dir}"
OUTPUT_VARIABLE RD_BUILD_VERSION
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${RD_BUILD_VERSION})
string(REGEX REPLACE "-g.+" "" RD_BUILD_VERSION ${RD_BUILD_VERSION})
if(STATIC_BUILD)
set(RD_BUILD_VERSION "${RD_BUILD_VERSION}-static")
endif()
endif()
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY "${local_dir}"
OUTPUT_VARIABLE RD_BUILD_COMMIT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
find_package(OpenMP)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EX_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
find_package(MPI)
if(STATIC_BUILD)
set(STATIC_GSL ON)
endif()
if(NOT (RD_BUILD_VERSION AND RD_BUILD_COMMIT))
set(RD_BUILD_VERSION "1.4.1")
set(RD_BUILD_COMMIT "From Release")
endif()
if(MPI_BUILD)
set(RD_BUILD_VERSION "${RD_BUILD_VERSION}-mpi")
endif()
string(TIMESTAMP RD_BUILD_DATE "%Y-%m-%d %H:%M:%S")
set(LOCALDEPS_DIR ${PROJECT_BINARY_DIR}/localdeps)
add_subdirectory(lib)
include_directories(${LOCALDEPS_DIR}/include)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
add_subdirectory(src)
if(STATIC_BUILD)
add_dependencies(rd gsl)
endif()
find_library(ASAN_FOUND asan)
if(ASAN_FOUND AND NOT MPI_BUILD)
add_subdirectory(test)
add_subdirectory(benchmark)
endif()