-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
110 lines (91 loc) · 3.45 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
cmake_minimum_required(VERSION 3.5)
project(marty LANGUAGES CXX C Fortran)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(GNU_COMPILERS 0)
set(CLANG_COMPILERS 0)
set(LLVM_COMPILERS 0)
set(REQUIRED_COMPILER_VERSION 0)
set(IDENTICAL_COMPILER_VERSION 0)
find_package(GSL REQUIRED)
# Dependencies for GRAFED
find_program(LUALATEX lualatex REQUIRED)
find_program(CONVERT convert REQUIRED)
find_program(LATEX latex REQUIRED)
find_program(DVIPNG dvipng)
if(NOT LUALATEX)
message(FATAL_ERROR
"The 'lualatex' program is not found but necessary for GRAFED."
"Install it before retrying the installation.")
endif()
if(NOT DVIPNG)
message(FATAL_ERROR
"The 'dvipng' program is not found but necessary for GRAFED."
"Install it before retrying the installation.")
endif()
if(NOT LUALATEX)
message(FATAL_ERROR
"The 'lualatex' program is not found but necessary for GRAFED."
"Install it before retrying the installation.")
endif()
if(NOT CONVERT)
message(FATAL_ERROR
"The 'convert' program is not found but necessary for GRAFED."
"The 'convert' program is part of the ImageMagick package."
"Install it before retrying the installation.")
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 -fprofile-arcs -ftest-coverage")
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used for linking binaries during coverage builds."
FORCE)
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
""
CACHE STRING "Flags used by the shared libraries linker during coverage builds."
FORCE)
enable_testing()
if(CMAKE_BUILD_TYPE STREQUAL "Coverage")
set(ENABLE_COVERAGE 1)
else()
set(ENABLE_COVERAGE 0)
endif()
add_compile_definitions(MARTY_CXX=${CMAKE_CXX_COMPILER})
add_compile_definitions(MARTY_CC=${CMAKE_C_COMPILER})
add_compile_definitions(MARTY_FC=${CMAKE_Fortran_COMPILER})
add_compile_definitions(MARTY_INSTALL_PATH=${CMAKE_INSTALL_PREFIX})
if((NOT CMAKE_COMPILER_IS_GNUCXX) OR(NOT CMAKE_COMPILER_IS_GNUCC))
message(WARNING
"Quadruple precision for numerical library generation can only be used with GNU compilers for now."
" The compilers defined are not GNU (${CMAKE_C_COMPILER} and ${CMAKE_CXX_COMPILER}), change the C/C++ compilers to GNU to enable quadruple precision."
" The build procedure will continue normally but the quadruple precision feature has been disabled."
)
add_compile_definitions(MARTY_QUADRUPLE_ENABLED=0)
set(QUADRUPLE_ENABLED 0)
else()
add_compile_definitions(MARTY_QUADRUPLE_ENABLED=1)
set(QUADRUPLE_ENABLED 1)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(dep)
add_subdirectory(src)
add_subdirectory(examples)
add_subdirectory(tests)
add_subdirectory(doc)
install(TARGETS marty marty-static csl csl-static marty-lha marty-lha-static marty-gamma-api marty-boltzmann-solver marty-boltzmann-solver-static
DESTINATION lib)
install(DIRECTORY src/
DESTINATION include
FILES_MATCHING PATTERN *.h)
install(FILES ${PROJECT_BINARY_DIR}/libooptools.so ${PROJECT_BINARY_DIR}/libooptools-quad.so
DESTINATION lib)
install(FILES ${PROJECT_BINARY_DIR}/libooptools-static.a ${PROJECT_BINARY_DIR}/libooptools-quad-static.a
DESTINATION lib)
install(TARGETS grafed-gui
DESTINATION bin)