forked from aamaricci/DMFTtools
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
183 lines (131 loc) · 5.63 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
##################################################
# DMFT_TOOLS PROJECT
##################################################
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
PROJECT(dmft_tools Fortran)
SET(VERSION 2.2.3)
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)
# 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 "Use the MPI library for parallelization" ON)
OPTION(VERBOSE "Build a verbose Makefile" 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)
############################################################
# Find Scifor and add to Include dir
############################################################
FIND_PACKAGE(PkgConfig)
PKG_SEARCH_MODULE(SCIFOR REQUIRED scifor)
IF(${SCIFOR_FOUND})
MESSAGE(STATUS "${Yellow}Scifor found at: ${ColourReset}${SCIFOR_PREFIX}")
ELSE()
MESSAGE( FATAL_ERROR "
${Red}Can not find SciFortran in this system. Check SciFor installation. Try adding the provided PKG-CONFIG file (usually in the path-to-scifor/etc) to the environment variable PKG_CONFIG_PATH:${ColourReset}
$ export PKG_CONFIG_PATH=<path_to_scifor_dir>/etc:$PKG_CONFIG_PATH"
)
ENDIF()
############################################################
# 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_ENV ${CMAKE_SOURCE_DIR}/etc/environment_modules)
SET(LIB_BIN ${CMAKE_SOURCE_DIR}/bin)
SET(LIB_TMP_INC ${CMAKE_BINARY_DIR}/include)
SET(LIB_TMP_ETC ${CMAKE_BINARY_DIR}/etc)
SET(LIB_TMP_BIN ${CMAKE_BINARY_DIR}/bin)
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})
INCLUDE_DIRECTORIES(BEFORE ${SCIFOR_INCLUDE_DIRS})
SET(SRC_DIR_DMFT_CTRL_VARS ${LIB_SRC}/DMFT_CTRL_VARS)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_CTRL_VARS})
SET(SRC_DIR_DMFT_GF ${LIB_SRC}/DMFT_GF)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_GF})
SET(SRC_DIR_LEGACY_DMFT_GF ${LIB_SRC}/LEGACY_DMFT_GF)
ADD_SUBDIRECTORY(${SRC_DIR_LEGACY_DMFT_GF})
SET(SRC_DIR_DMFT_WEISS_FIELD ${LIB_SRC}/DMFT_WEISS_FIELD)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_WEISS_FIELD})
SET(SRC_DIR_LEGACY_DMFT_WEISS_FIELD ${LIB_SRC}/LEGACY_DMFT_WEISS_FIELD)
ADD_SUBDIRECTORY(${SRC_DIR_LEGACY_DMFT_WEISS_FIELD})
SET(SRC_DIR_DMFT_EKIN ${LIB_SRC}/DMFT_EKIN)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_EKIN})
SET(SRC_DIR_DMFT_TIGHT_BINDING ${LIB_SRC}/DMFT_TIGHT_BINDING)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_TIGHT_BINDING})
SET(SRC_DIR_DMFT_FFT ${LIB_SRC}/DMFT_FFT)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_FFT})
SET(SRC_DIR_DMFT_CONVERGENCE ${LIB_SRC}/DMFT_CONVERGENCE)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_CONVERGENCE})
SET(SRC_DIR_DMFT_MISC ${LIB_SRC}/DMFT_MISC)
ADD_SUBDIRECTORY(${SRC_DIR_DMFT_MISC})
ADD_SUBDIRECTORY(${LIB_SRC})
# # Build the scifor library and have it placed in the target lib folder
ADD_LIBRARY(dmft_tools
$<TARGET_OBJECTS:DMFT_CTRL_VARSLIB>
$<TARGET_OBJECTS:DMFT_GFLIB>
$<TARGET_OBJECTS:LEGACY_DMFT_GFLIB>
$<TARGET_OBJECTS:DMFT_WEISS_FIELDLIB>
$<TARGET_OBJECTS:LEGACY_DMFT_WEISS_FIELDLIB>
$<TARGET_OBJECTS:DMFT_EKINLIB>
$<TARGET_OBJECTS:DMFT_TIGHT_BINDINGLIB>
$<TARGET_OBJECTS:DMFT_FFTLIB>
$<TARGET_OBJECTS:DMFT_CONVERGENCELIB>
$<TARGET_OBJECTS:DMFT_MISCLIB>
$<TARGET_OBJECTS:DMFT_TOOLSLIB>
)
ADD_DEPENDENCIES(DMFT_TOOLSLIB
DMFT_CTRL_VARSLIB
DMFT_GFLIB
LEGACY_DMFT_GFLIB
DMFT_WEISS_FIELDLIB
LEGACY_DMFT_WEISS_FIELDLIB
DMFT_EKINLIB
DMFT_TIGHT_BINDINGLIB
DMFT_FFTLIB
DMFT_CONVERGENCELIB
DMFT_MISCLIB
)
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)
############################################################
############################################################
############################################################
INCLUDE(${CMAKE_MODULE_PATH}/PostConfig.cmake)