2 # CMake project file for UNRES with Minimazation
5 enable_language (Fortran)
7 #================================
8 # Set source file lists
9 #================================
10 # sources used with FFLAGS0
44 # sources used with FFLAGS1
49 # sources used with FFLAGS2
54 # sources used with FFLAGS3
56 energy_p_new_barrier.F
60 # sources used with preprocesor flags (should also be listed above with FFLAGSX)
73 energy_p_new_barrier.F
118 #================================================
119 # Set comipiler flags for different sourcefiles
120 #================================================
121 if (Fortran_COMPILER_NAME STREQUAL "ifort")
122 find_package (Threads)
123 set(FFLAGS0 "-g -ip -w" )
124 set(FFLAGS1 "-w -g -d2 -CA -CB" )
125 set(FFLAGS2 "-w -g -00 ")
126 set(FFLAGS3 "-g -w -ipo " )
127 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
128 set(FFLAGS0 "-std=legacy -O " )
129 set(FFLAGS1 "-std=legacy -g -C" )
130 set(FFLAGS2 "-std=legacy -g -O0 ")
131 set(FFLAGS3 "-std=legacy -O3" )
132 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
135 set_property(SOURCE ${UNRES_MIN_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
136 set_property(SOURCE ${UNRES_MIN_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
137 set_property(SOURCE ${UNRES_MIN_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
138 set_property(SOURCE ${UNRES_MIM_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
140 # set preprocesor flags
141 set(CPPFLAGS "PROCOR -DLINUX -DISNAN -DSPLITELE -DLANG0" )
143 if (Fortran_COMPILER_NAME STREQUAL "ifort")
144 # Add ifort preprocessor flags
145 set(CPPFLAGS "${CPPFLAGS} -DPGI")
146 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
148 set(CPPFLAGS "${CPPFLAGS} -DG77")
149 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
151 set(CPPFLAGS "${CPPFLAGS} -DG77")
152 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
155 # add 64-bit specific preprocessor flags
156 if (architektura STREQUAL "64")
157 set(CPPFLAGS "${CPPFLAGS} -DAMD64")
158 endif (architektura STREQUAL "64")
160 # Apply preprocesor flags to *.F files
161 set_property(SOURCE ${UNRES_MIN_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
165 #========================================
166 # Setting binary name
167 #========================================
168 set(UNRES_BIN "unres_min_${Fortran_COMPILER_NAME}.exe")
170 #========================================
171 # cinfo.f workaround for Cmake
172 #========================================
173 # get the current date
177 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
179 "C CMake generated file
181 include 'COMMON.IOUNITS'
182 write(iout,*)'++++ Compile info ++++'
183 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
186 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
187 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
188 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
189 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
190 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
191 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
194 " write(iout,*)'Version MINI energy and minimalization only'
195 write(iout,*)'++++ End of compile info ++++'
200 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}")
202 #=========================================
203 # Set full unres MIN sources
204 #=========================================
205 set(UNRES_MIN_SRCS ${UNRES_MIN_SRC0} ${UNRES_MIN_SRC1} ${UNRES_MIN_SRC2} ${UNRES_MIN_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
207 #=========================================
209 #=========================================
210 add_executable(UNRES_BIN-MIN ${UNRES_MIN_SRCS} )
211 set_target_properties(UNRES_BIN-MIN PROPERTIES OUTPUT_NAME ${UNRES_BIN})
213 if (Fortran_COMPILER_NAME STREQUAL "ifort")
214 target_link_libraries (UNRES_BIN-MIN ${CMAKE_THREAD_LIBS_INIT})
215 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
217 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
219 #=========================================
221 #=========================================
223 #-- Copy all the data files from the test directory into the source directory
224 #SET(UNRES_TEST_FILES
228 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
229 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
230 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
231 # ADD_CUSTOM_COMMAND (
232 # TARGET ${UNRES_BIN}
234 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
236 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
238 #=========================================
239 # Generate data test files
240 #=========================================
242 #if(NOT UNRES_WITH_MPI)
244 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
246 #endif(NOT UNRES_WITH_MPI)