2 # CMake project file for UNRES with Minimazation
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
10 # sources used with FFLAGS0
46 # sources used with FFLAGS1
51 # sources used with FFLAGS2
56 # sources used with FFLAGS3
58 energy_p_new_barrier.F
62 # sources used with preprocesor flags (should also be listed above with FFLAGSX)
75 energy_p_new_barrier.F
120 #================================================
121 # Set comipiler flags for different sourcefiles
122 #================================================
123 if (Fortran_COMPILER_NAME STREQUAL "ifort")
124 find_package (Threads)
125 set(FFLAGS0 "-g -ip -w" )
126 set(FFLAGS1 "-w -g -d2 -CA -CB" )
127 set(FFLAGS2 "-w -g -00 ")
128 set(FFLAGS3 "-g -w -ipo " )
129 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
130 set(FFLAGS0 "-std=legacy -O " )
131 set(FFLAGS1 "-std=legacy -g -C" )
132 set(FFLAGS2 "-std=legacy -g -O0 ")
133 set(FFLAGS3 "-std=legacy -O3" )
134 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
137 set_property(SOURCE ${UNRES_MIN_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
138 set_property(SOURCE ${UNRES_MIN_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
139 set_property(SOURCE ${UNRES_MIN_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
140 set_property(SOURCE ${UNRES_MIM_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
142 # set preprocesor flags
143 set(CPPFLAGS "PROCOR -DLINUX -DISNAN -DSPLITELE -DLANG0" )
145 if (Fortran_COMPILER_NAME STREQUAL "ifort")
146 # Add ifort preprocessor flags
147 set(CPPFLAGS "${CPPFLAGS} -DPGI")
148 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
150 set(CPPFLAGS "${CPPFLAGS} -DG77")
151 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
153 set(CPPFLAGS "${CPPFLAGS} -DG77")
154 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
157 # add 64-bit specific preprocessor flags
158 if (architektura STREQUAL "64")
159 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
160 endif (architektura STREQUAL "64")
162 # Apply preprocesor flags to *.F files
163 set_property(SOURCE ${UNRES_MIN_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
167 #========================================
168 # Setting binary name
169 #========================================
170 set(UNRES_BIN "unres_min_${Fortran_COMPILER_NAME}.exe")
172 #========================================
173 # cinfo.f workaround for Cmake
174 #========================================
175 # get the current date
179 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
181 "C CMake generated file
183 include 'COMMON.IOUNITS'
184 write(iout,*)'++++ Compile info ++++'
185 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
188 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
189 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
190 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
191 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
192 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
193 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
196 " write(iout,*)'Version MINI energy and minimalization only'
197 write(iout,*)'++++ End of compile info ++++'
202 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}")
204 #=========================================
205 # Set full unres MIN sources
206 #=========================================
207 set(UNRES_MIN_SRCS ${UNRES_MIN_SRC0} ${UNRES_MIN_SRC1} ${UNRES_MIN_SRC2} ${UNRES_MIN_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
209 #=========================================
211 #=========================================
212 add_executable(UNRES_MIN_BIN ${UNRES_MIN_SRCS} )
213 set_target_properties(UNRES_MIN_BIN PROPERTIES OUTPUT_NAME ${UNRES_BIN})
215 if (Fortran_COMPILER_NAME STREQUAL "ifort")
216 target_link_libraries (UNRES_MIN_BIN ${CMAKE_THREAD_LIBS_INIT})
217 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
218 set_property(TARGET UNRES_MIN_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
221 #=========================================
223 #=========================================
224 install(TARGETS UNRES_MIN_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/unres/MINIM)