-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
207 lines (147 loc) · 5.34 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
##################################################
# DMFTED PROJECT
##################################################
CMAKE_MINIMUM_REQUIRED(VERSION 3.10.0)
PROJECT(edipack2 Fortran)
SET(VERSION 1.4.1)
MESSAGE(STATUS "OS: ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}")
SET(BUILD_TYPE "RELEASE" CACHE STRING "Build type")
STRING(TOUPPER "${BUILD_TYPE}" BUILD_TYPE)
MESSAGE(STATUS "BUILD_TYPE=${BUILD_TYPE}")
SET(CMAKE_BUILD_TYPE ${BUILD_TYPE} CACHE INTERNAL "Build type" FORCE)
# CMakeGraphVizOptions.cmake
set(GRAPHVIZ_CUSTOM_TARGETS TRUE)
# Add our local CMAKE modules to the module path
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
INCLUDE(${CMAKE_MODULE_PATH}/ColorsMsg.cmake)
# Set some options the user may choose
OPTION(USE_MPI "Set MPI pre-compilation flag" ON)
OPTION(VERBOSE "Build a verbose Makefile" OFF)
OPTION(WITH_BLAS_LAPACK "Use internal Blas/Lapack" OFF)
IF(VERBOSE)
SET(CMAKE_VERBOSE_MAKEFILE ON)
ELSE(VERBOSE)
SET(CMAKE_VERBOSE_MAKEFILE OFF)
ENDIF(VERBOSE)
############################################################
# Look for MPI if needed
############################################################
INCLUDE(${CMAKE_MODULE_PATH}/MpiConfig.cmake)
############################################################
# Look for required libraries: scifor
# (includes Blas/Lapack/Scalapack/Quadpack/Minpack/FFTpack/Arpack/...)
############################################################
# Find Scifor
FIND_PACKAGE(PkgConfig)
PKG_SEARCH_MODULE(SCIFOR REQUIRED scifor)
IF(${SCIFOR_FOUND})
MESSAGE(STATUS "SCIFOR found at: ${SCIFOR_PREFIX}")
ELSE()
MESSAGE(FATAL_ERROR "
Can not find SciFortran in this system. Check SciFor installation. Try adding the provided PKG-CONFIG file to the environment:
$ export PKG_CONFIG_PATH=<path_to_scifor_dir>/etc:$PKG_CONFIG_PATH")
ENDIF()
INCLUDE_DIRECTORIES(BEFORE ${SCIFOR_INCLUDE_DIRS})
############################################################
# Configure Fortran Compiler Main options
############################################################
INCLUDE(${CMAKE_MODULE_PATH}/FortranCompilerConfig.cmake)
############################################################
# Check for .git and extract the current SHA1 revision.
############################################################
INCLUDE(${CMAKE_MODULE_PATH}/GitConfig.cmake)
############################################################
# Define the actual files and folders that make up the build
############################################################
INCLUDE(${CMAKE_MODULE_PATH}/MainConfig.cmake)
############################################################
############################################################
############################################################
# DEFINE HERE THE DETAILS OF THE LIBRARY CONFIGURATION
# Define some directories
SET(LIB_SRC ${CMAKE_SOURCE_DIR}/src)
SET(LIB_ETC ${CMAKE_SOURCE_DIR}/etc)
SET(LIB_TEST ${CMAKE_SOURCE_DIR}/test)
SET(LIB_ENV ${CMAKE_SOURCE_DIR}/etc/environment_modules)
SET(LIB_TMP_INC ${CMAKE_BINARY_DIR}/include)
SET(LIB_TMP_ETC ${CMAKE_BINARY_DIR}/etc)
SET(LIB_TMP_VER ${CMAKE_BINARY_DIR}/version)
SET(LIB_TARGET_LIB ${CMAKE_INSTALL_PREFIX}/lib)
SET(LIB_TARGET_INC ${CMAKE_INSTALL_PREFIX}/include)
SET(LIB_TARGET_ETC ${CMAKE_INSTALL_PREFIX}/etc)
SET(LIB_TARGET_BIN ${CMAKE_INSTALL_PREFIX}/bin)
SET(LIB_TARGET_DIR ${CMAKE_INSTALL_PREFIX})
# Have the .mod files placed in the INC folder
SET(CMAKE_Fortran_MODULE_DIRECTORY ${LIB_TMP_INC})
INCLUDE_DIRECTORIES(BEFORE ${CMAKE_Fortran_MODULE_DIRECTORY})
ADD_SUBDIRECTORY(${LIB_SRC}/ED_BATH)
ADD_SUBDIRECTORY(${LIB_SRC}/ED_IO)
ADD_SUBDIRECTORY(${LIB_SRC}/ED_NORMAL)
ADD_SUBDIRECTORY(${LIB_SRC}/ED_SUPERC)
ADD_SUBDIRECTORY(${LIB_SRC}/ED_NONSU2)
ADD_SUBDIRECTORY(${LIB_SRC}/ED_FIT)
ADD_SUBDIRECTORY(${LIB_SRC})
ADD_DEPENDENCIES(ED_BATH_LIB
ED_INIT_LIB
)
ADD_DEPENDENCIES(ED_IO_LIB
ED_INIT_LIB
ED_BATH_LIB
)
ADD_DEPENDENCIES(ED_NORMAL_LIB
ED_INIT_LIB
ED_BATH_LIB
ED_IO_LIB
)
ADD_DEPENDENCIES(ED_SUPERC_LIB
ED_INIT_LIB
ED_BATH_LIB
ED_IO_LIB
)
ADD_DEPENDENCIES(ED_NONSU2_LIB
ED_INIT_LIB
ED_BATH_LIB
ED_IO_LIB
)
ADD_DEPENDENCIES(ED_FIT_LIB
ED_INIT_LIB
ED_BATH_LIB
ED_NORMAL_LIB
ED_SUPERC_LIB
ED_NONSU2_LIB
)
ADD_DEPENDENCIES(ED_GLOB_LIB
ED_INIT_LIB
ED_BATH_LIB
ED_IO_LIB
ED_NORMAL_LIB
ED_SUPERC_LIB
ED_NONSU2_LIB
ED_FIT_LIB
)
ADD_LIBRARY(edipack2 STATIC
$<TARGET_OBJECTS:ED_INIT_LIB>
$<TARGET_OBJECTS:ED_BATH_LIB>
$<TARGET_OBJECTS:ED_IO_LIB>
$<TARGET_OBJECTS:ED_NORMAL_LIB>
$<TARGET_OBJECTS:ED_SUPERC_LIB>
$<TARGET_OBJECTS:ED_NONSU2_LIB>
$<TARGET_OBJECTS:ED_FIT_LIB>
$<TARGET_OBJECTS:ED_GLOB_LIB>
)
SET(PERMISSION_777
OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_WRITE GROUP_READ GROUP_EXECUTE
WORLD_WRITE WORLD_READ WORLD_EXECUTE)
#Build the PKG-CONFIG file
SET(TMP_PKCONFIG_FILE ${LIB_TMP_ETC}/${PROJECT_NAME}.pc)
CONFIGURE_FILE( ${LIB_ETC}/${PROJECT_NAME}.pc.in ${TMP_PKCONFIG_FILE} @ONLY)
############################################################
############################################################
############################################################
#Final messages + additional custom targets:
# - distclean: cleans the generated cmake files
# - uninstall: provides uninstall of (almost) all the installed files
# - doc: creates documentation using sphinx (if found)
# - test: compiles and launches the test in ${LIB_TEST} directory
INCLUDE(${CMAKE_MODULE_PATH}/PostConfig.cmake)