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}})
26 MESSAGE(SEND_ERROR "date not implemented")
31 # foramt variables used in cinfo.f
32 MACRO (CINFO_FORMAT FN VN VD)
35 # write(iout,*)'INSTALL_DIR = /users/software/mpich-1.2.7p1_int...'
36 string(LENGTH "${VN}" VNLEN)
37 string(LENGTH "${VD}" VDLEN)
38 set(STR "${VN} ${VD}")
39 string(LENGTH "${STR}" SUMA)
40 math(EXPR STRLEN 50-${VNLEN})
41 # message("lancuch=${STRLEN}")
45 string(SUBSTRING "${STR}" 0 50 STR_OUT)
46 # message(" write(iout,*)'${VAR} = ${STR_OUT}'")
47 file(APPEND ${FN} " write(iout,*)'${STR_OUT}'\n")
48 math(EXPR STRLEN ${SUMA}-50)
49 string(SUBSTRING "${STR}" 50 ${STRLEN} STR)
50 string(LENGTH "${STR}" STRLEN)
51 while(STRLEN GREATER 48)
52 # message("Przycinam lancuch")
53 string(SUBSTRING "${STR}" 0 48 STR_OUT)
54 file(APPEND ${FN} " write(iout,*)' ${STR_OUT}'\n")
55 math(EXPR STRLEN ${STRLEN}-49)
56 string(SUBSTRING "${STR}" 49 ${STRLEN} STR)
57 string(LENGTH "${STR}" STRLEN)
58 endwhile(STRLEN GREATER 48)
59 file(APPEND ${FN} " write(iout,*)' ${STR}'\n")
60 # MESSAGE("DLUGOSC = ${VNLEN}; DLUGOSCD = ${VDLEN}; SUMA=${SUMA}; ${VAR} = ${${VAR}} " )
63 file(APPEND ${FN} " write(iout,*)'${STR}'\n")
64 endif(SUMA GREATER 50)
65 ENDMACRO (CINFO_FORMAT)
66 #======================================
68 #======================================A
74 #======================================
75 # Fortran compilers stuff
76 #======================================
77 # Get the compiler name
78 get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
80 # Altough cmake enables you to set some compiler definitions it seems by default they are ignored.
81 # This is a workaround to pass compiler definitions (preprocesor flags) to fortran compilers like ifort
82 SET(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} <FLAGS> <DEFINES> -c <SOURCE> -o <OBJECT> ${CMAKE_END_TEMP_FILE}")
83 #set(CPPFLAGS "-DPROCOR -DLINUX -DPGI -DUNRES -DISNAN -DMP -DMPI -DSPLITELE -DLANGO -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
84 #add_definitions( ${CPPFLAGS} )
87 # make sure that the default is a RELEASE
88 if (NOT CMAKE_BUILD_TYPE)
89 set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None Debug Release." FORCE)
90 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "None" "Debug" "Release" )
91 endif (NOT CMAKE_BUILD_TYPE)
94 if (CMAKE_BUILD_TYPE STREQUAL "Release")
95 # Set makefile verbosity off for Release builds
96 set( CMAKE_VERBOSE_MAKEFILE 0 )
98 # Set makefile verbosity on for other builds
99 set( CMAKE_VERBOSE_MAKEFILE 1 )
100 endif (CMAKE_BUILD_TYPE STREQUAL "Release")
102 #=======================================
103 # Set the varous build variables
104 #=======================================
108 set(UNRES_MD_FF "GAB" CACHE STRING "Choose the force field, options are: GAB E0LL2Y" )
109 set_property(CACHE UNRES_MD_FF PROPERTY STRINGS "GAB" "E0LL2Y")
112 # Set CSA version force field
113 if (NOT UNRES_CSA_FF)
114 set(UNRES_CSA_FF "4P" CACHE STRING "Choose the CSA version force field, options are: CASP3 ALPHA BETA ALPHABETA CASP5 3P 4P" )
115 set_property(CACHE UNRES_CSA_FF PROPERTY STRINGS "CASP3" "ALPHA" "BETA" "ALPHABETA" "CASP5" "3P" "4P" )
116 endif (NOT UNRES_CSA_FF)
118 # Use of MPI library (default ON)
119 option(UNRES_WITH_MPI "Choose whether or not to use MPI library" ON )
122 # Piasek cluster devel stuff
123 option(UNRES_NA_MMCE "Kompilujemy na mmmce?" OFF )
126 #=================================
128 #=================================
130 # Note for the future - use find package to get MPI
131 find_package(MPI QUIET)
133 if (MPI_Fortran_FOUND)
136 message("MPI not found - disabling MPI compile flags ")
137 set ( UNRES_WITH_MPI "OFF")
138 endif(MPI_Fortran_FOUND)
140 #======================================
141 # Detect system architecture
142 #=======================================
144 if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
145 set(architektura "32")
146 else (CMAKE_SIZEOF_VOID_P EQUAL 4)
147 set(architektura "64")
148 endif( CMAKE_SIZEOF_VOID_P EQUAL 4 )
150 message("Detected ${architektura}-bit architecture")
152 #=======================================
153 # Find other libraries
154 #=======================================
156 # used by unres/src_MIN
157 find_package (Threads)
161 #=======================================
162 # Create diractories for build targets
163 #=======================================
164 #execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/unres/MD )
166 #=======================================
168 #=======================================
171 add_subdirectory(source/lib/xdrf)
177 # Brak MPI dla gfortrana, wiec tylko na ifort sie skompiluje
178 if (Fortran_COMPILER_NAME STREQUAL "ifort")
179 add_subdirectory(source/unres/src_MD)
180 add_subdirectory(source/unres/src_MD-M)
181 add_subdirectory(source/unres/src_CSA)
182 add_subdirectory(source/unres/src_CSA_DiL)
183 add_subdirectory(source/cluster/wham/src)
184 add_subdirectory(source/cluster/wham/src-M)
185 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
187 add_subdirectory(source/unres/src_MD)
188 # src_MD-M doesn't work yet witout MPI
189 # add_subdirectory(source/unres/src_MD-M)
191 add_subdirectory(source/unres/src_MIN)
192 add_subdirectory(source/cluster/unres/src)
193 add_subdirectory(source/xdrfpdb/src)
194 add_subdirectory(source/xdrfpdb/src-M)
195 add_subdirectory(source/maxlik/src_CSA)
198 add_subdirectory(source/unres/src_MD)
200 add_subdirectory(source/unres/src_MD-M)
201 add_subdirectory(source/unres/src_CSA)
202 add_subdirectory(source/unres/src_CSA_DiL)
203 add_subdirectory(source/wham/src)
204 add_subdirectory(source/wham/src-M)
205 add_subdirectory(source/cluster/wham/src)
206 add_subdirectory(source/cluster/wham/src-M)
207 endif(UNRES_WITH_MPI)
208 add_subdirectory(source/unres/src_MIN)
209 add_subdirectory(source/cluster/unres/src)
210 add_subdirectory(source/xdrfpdb/src)
211 add_subdirectory(source/xdrfpdb/src-M)
212 add_subdirectory(source/maxlik/src_CSA)