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")
129 set(FFLAGS1 "-g -C" )
130 set(FFLAGS2 "-g -O0 ")
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
176 FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f
177 "C CMake generated file
179 include 'COMMON.IOUNITS'
180 write(iout,*)'++++ Compile info ++++'
181 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
182 write(iout,*)'Compiled ${DATE}'
183 write(iout,*)'Compiled by $ENV{USER}@$ENV{HOST}'
184 write(iout,*)'OS name: ${CMAKE_SYSTEM_NAME}'
185 write(iout,*)'OS release: ${CMAKE_SYSTEM}'
186 write(iout,*)'FC: ${CMAKE_Fortran_COMPILER}'
187 write(iout,*)'Version MINI energy and minimization only'
188 write(iout,*)'++++ End of compile info ++++'
193 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}")
195 #=========================================
196 # Set full unres MIN sources
197 #=========================================
198 set(UNRES_MIN_SRCS ${UNRES_MIN_SRC0} ${UNRES_MIN_SRC1} ${UNRES_MIN_SRC2} ${UNRES_MIN_SRC3} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f )
200 #=========================================
202 #=========================================
203 add_executable(UNRES_BIN-MIN ${UNRES_MIN_SRCS} )
204 set_target_properties(UNRES_BIN-MIN PROPERTIES OUTPUT_NAME ${UNRES_BIN})
206 if (Fortran_COMPILER_NAME STREQUAL "ifort")
207 target_link_libraries (UNRES_BIN-MIN ${CMAKE_THREAD_LIBS_INIT})
208 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
210 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
212 #=========================================
214 #=========================================
216 #-- Copy all the data files from the test directory into the source directory
217 #SET(UNRES_TEST_FILES
221 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
222 # SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
223 # MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
224 # ADD_CUSTOM_COMMAND (
225 # TARGET ${UNRES_BIN}
227 # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
229 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
231 #=========================================
232 # Generate data test files
233 #=========================================
235 #if(NOT UNRES_WITH_MPI)
237 # add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
239 #endif(NOT UNRES_WITH_MPI)