2 # CMake project file for UNRES
4 cmake_minimum_required(VERSION 2.8)
6 project(UNRESPACK Fortran C)
11 set(UNRES_VERSION ${UNRES_MAJOR}.${UNRES_MINOR}.${UNRES_PATCH})
13 #======================================
15 #======================================
20 EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE ${RESULT})
21 string(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" ${RESULT} ${${RESULT}})
23 # EXECUTE_PROCESS(COMMAND "date" OUTPUT_VARIABLE ${RESULT})
24 # string(REGEX REPLACE "(...) (...) (.+) (..:..:..) (.+) (....).*" "\\1 \\2 \\3 \\4 \\5 \\6" ${RESULT} ${${RESULT}})
25 string(TIMESTAMP ${RESULT})
27 MESSAGE(SEND_ERROR "date not implemented")
32 # foramt variables used in cinfo.f
33 MACRO (CINFO_FORMAT FN VN VD)
36 # write(iout,*)'INSTALL_DIR = /users/software/mpich-1.2.7p1_int...'
37 string(LENGTH "${VN}" VNLEN)
38 string(LENGTH "${VD}" VDLEN)
39 set(STR "${VN} ${VD}")
40 string(LENGTH "${STR}" SUMA)
41 math(EXPR STRLEN 50-${VNLEN})
42 # message("lancuch=${STRLEN}")
46 string(SUBSTRING "${STR}" 0 50 STR_OUT)
47 # message(" write(iout,*)'${VAR} = ${STR_OUT}'")
48 file(APPEND ${FN} " write(iout,*)'${STR_OUT}'\n")
49 math(EXPR STRLEN ${SUMA}-50)
50 string(SUBSTRING "${STR}" 50 ${STRLEN} STR)
51 string(LENGTH "${STR}" STRLEN)
52 while(STRLEN GREATER 48)
53 # message("Przycinam lancuch")
54 string(SUBSTRING "${STR}" 0 48 STR_OUT)
55 file(APPEND ${FN} " write(iout,*)' ${STR_OUT}'\n")
56 math(EXPR STRLEN ${STRLEN}-49)
57 string(SUBSTRING "${STR}" 49 ${STRLEN} STR)
58 string(LENGTH "${STR}" STRLEN)
59 endwhile(STRLEN GREATER 48)
60 file(APPEND ${FN} " write(iout,*)' ${STR}'\n")
61 # MESSAGE("DLUGOSC = ${VNLEN}; DLUGOSCD = ${VDLEN}; SUMA=${SUMA}; ${VAR} = ${${VAR}} " )
64 file(APPEND ${FN} " write(iout,*)'${STR}'\n")
65 endif(SUMA GREATER 50)
66 ENDMACRO (CINFO_FORMAT)
68 # Some MPI wrappers pass double include paths
69 # This macro fixes broken by semicolon occurence in path
70 MACRO (FIX_DBL_INCLUDE RESULT)
71 string(REPLACE ";" " -I" ${RESULT} "${${RESULT}}")
72 ENDMACRO (FIX_DBL_INCLUDE)
74 #======================================
76 #======================================A
82 #======================================
83 # Fortran compilers stuff
84 #======================================
85 # Get the compiler name
86 get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
88 # Altough cmake enables you to set some compiler definitions it seems by default they are ignored.
89 # This is a workaround to pass compiler definitions (preprocesor flags) to fortran compilers like ifort
90 SET(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} <FLAGS> <DEFINES> -c <SOURCE> -o <OBJECT> ${CMAKE_END_TEMP_FILE}")
91 #set(CPPFLAGS "-DPROCOR -DLINUX -DPGI -DUNRES -DISNAN -DMP -DMPI -DSPLITELE -DLANGO -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
92 #add_definitions( ${CPPFLAGS} )
95 # make sure that the default is a RELEASE
96 if (NOT CMAKE_BUILD_TYPE)
97 set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo." FORCE)
98 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "None" "Debug" "Release" "RelWithDebInfo")
99 endif (NOT CMAKE_BUILD_TYPE)
102 if (CMAKE_BUILD_TYPE STREQUAL "Release")
103 # Set makefile verbosity off for Release builds
104 set( CMAKE_VERBOSE_MAKEFILE 0 )
106 # Set makefile verbosity on for other builds
107 set( CMAKE_VERBOSE_MAKEFILE 1 )
108 endif (CMAKE_BUILD_TYPE STREQUAL "Release")
110 # Default Install Path
112 set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/bin" CACHE PATH "Binary install directory " FORCE)
114 #=======================================
115 # Set the varous build variables
116 #=======================================
120 set(UNRES_MD_FF "E0LL2Y" CACHE STRING "Choose the force field, options are: GAB E0LL2Y" )
121 set_property(CACHE UNRES_MD_FF PROPERTY STRINGS "GAB" "E0LL2Y")
124 # Set CSA version force field
125 if (NOT UNRES_CSA_FF)
126 set(UNRES_CSA_FF "E0LL2Y" CACHE STRING "Choose the CSA version force field, options are: CASP3 ALPHA BETA ALPHABETA CASP5 3P 4P" )
127 set_property(CACHE UNRES_CSA_FF PROPERTY STRINGS "CASP3" "ALPHA" "BETA" "ALPHABETA" "CASP5" "3P" "4P" )
128 endif (NOT UNRES_CSA_FF)
130 # Use of MPI library (default ON)
131 option(UNRES_WITH_MPI "Choose whether or not to use MPI library" ON )
134 # Piasek cluster devel stuff
135 option(UNRES_NA_MMCE "Kompilujemy na mmmce?" OFF )
137 option(UNRES_DFA "Choose whether or not to use DFA" OFF )
139 #=================================
141 #=================================
143 # Note for the future - use find package to get MPI
144 find_package(MPI QUIET)
146 if (MPI_Fortran_FOUND)
148 FIX_DBL_INCLUDE(MPI_Fortran_INCLUDE_PATH)
150 message("MPI not found - disabling MPI compile flags ")
151 set ( UNRES_WITH_MPI "OFF")
152 endif(MPI_Fortran_FOUND)
154 #======================================
155 # Detect system architecture
156 #=======================================
158 if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
159 set(architektura "32")
160 else (CMAKE_SIZEOF_VOID_P EQUAL 4)
161 set(architektura "64")
162 endif( CMAKE_SIZEOF_VOID_P EQUAL 4 )
164 message("Detected ${architektura}-bit architecture")
166 #=======================================
167 # Find other libraries
168 #=======================================
170 # used by unres/src_MIN
171 find_package (Threads)
173 #=======================================
175 #=======================================
178 add_subdirectory(source/lib/xdrf)
184 # Brak MPI dla gfortrana, wiec tylko na ifort sie skompiluje
185 if (Fortran_COMPILER_NAME STREQUAL "ifort")
186 add_subdirectory(source/unres/src_MD)
187 add_subdirectory(source/unres/src_MD-M)
188 add_subdirectory(source/unres/src_CSA)
189 add_subdirectory(source/cluster/wham/src)
190 add_subdirectory(source/cluster/wham/src-M)
191 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
193 add_subdirectory(source/unres/src_MD)
194 # src_MD-M doesn't work yet witout MPI
195 # add_subdirectory(source/unres/src_MD-M)
197 add_subdirectory(source/unres/src_MIN)
198 add_subdirectory(source/cluster/unres/src)
199 add_subdirectory(source/xdrfpdb/src)
200 add_subdirectory(source/xdrfpdb/src-M)
203 add_subdirectory(source/unres/src_MD)
205 add_subdirectory(source/unres/src_MD-M)
206 add_subdirectory(source/unres/src_CSA)
207 add_subdirectory(source/wham/src)
208 add_subdirectory(source/wham/src-M)
209 add_subdirectory(source/cluster/wham/src)
210 add_subdirectory(source/cluster/wham/src-M)
211 endif(UNRES_WITH_MPI)
212 add_subdirectory(source/unres/src_MIN)
213 add_subdirectory(source/cluster/unres/src)
214 add_subdirectory(source/xdrfpdb/src)
215 add_subdirectory(source/xdrfpdb/src-M)
216 add_subdirectory(source/unres-dock)