Added CMake files for building source/wham/src-M
[unres.git] / source / unres / src_MIN / CMakeLists.txt
1 #
2 # CMake project file for UNRES with Minimazation 
3
4
5 enable_language (Fortran)
6
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_MIN_SRC0 
11         arcos.f
12         cartder.F 
13         cartprint.f 
14         chainbuild.F 
15         checkder_p.F 
16         convert.f 
17         econstr_local.F
18         geomout_min.F
19         initialize_p.F 
20         intcartderiv.F
21         intcor.f 
22         intlocal.f 
23         int_to_cart.f 
24         matmult.f 
25         minimize_p.F
26         misc.f 
27         MP.F 
28         parmread.F 
29         pinorm.f 
30         printmat.f 
31         randgens.f 
32         readrtns_min.F
33         rescode.f 
34         rmdd.f 
35         sumsld.f 
36         timing.F
37         unres_min.F
38
39 )
40
41 set(UNRES_MIN_SRC1 
42         cored.f
43 )
44
45 set(UNRES_MIN_SRC2 
46         readpdb.F
47 )
48
49 set(UNRES_MIN_SRC3 
50         energy_p_new_barrier.F
51         gradient_p.F
52 )
53
54 set(UNRES_MIN_PP_SRC
55         bank.F 
56         cartder.F 
57         chainbuild.F 
58         checkder_p.F 
59         compare_s1.F
60         cored.f
61         csa.f 
62         dihed_cons.F
63         diff12.f 
64         econstr_local.F
65         energy_p_new.F
66         energy_p_new_barrier.F 
67         energy_split-sep.F 
68         entmcm.F 
69         gen_rand_conf.F
70         geomout.F 
71         gradient_p.F 
72         intcor.f
73         initialize_p.F 
74         intcartderiv.F 
75         lagrangian_lesyng.F 
76         matmult.f
77         mc.F 
78         mcm.F 
79         MD_A-MTS.F
80         minimize_p.F 
81         minim_jlee.F
82         minim_mcmf.F 
83         MP.F 
84         MREMD.F
85         newconf.f 
86         parmread.F 
87         permut.F
88         prng_32.F 
89         q_measure1.F 
90         q_measure3.F 
91         q_measure.F
92         ran.f
93         rattle.F 
94         readpdb.F 
95         readrtns_min.F
96         regularize.F
97         rmdd.f 
98         rmsd.F 
99         sc_move.F
100         shift.F 
101         stochfric.F
102         sumsld.f 
103         test.F 
104         thread.F 
105         timing.F
106         together.F
107         unres.F 
108
109
110
111 #================================================
112 # Set comipiler flags for different sourcefiles  
113 #================================================
114 if (Fortran_COMPILER_NAME STREQUAL "ifort")
115   find_package (Threads)
116   set(FFLAGS0 "-g -ip -w" ) 
117   set(FFLAGS1 "-w -g -d2 -CA -CB" ) 
118   set(FFLAGS2 "-w -g -00 ")
119   set(FFLAGS3 "-g -w -ipo " )
120 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
121   set(FFLAGS0 "-O" ) 
122   set(FFLAGS1 "-g -C" ) 
123   set(FFLAGS2 "-g -O0 ")
124   set(FFLAGS3 "-O3" )
125 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
126
127
128 set_property(SOURCE ${UNRES_MIN_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
129 set_property(SOURCE ${UNRES_MIN_SRC1} PROPERTY COMPILE_FLAGS ${FFLAGS1} )
130 set_property(SOURCE ${UNRES_MIN_SRC2} PROPERTY COMPILE_FLAGS ${FFLAGS2} )
131 set_property(SOURCE ${UNRES_MIM_SRC3} PROPERTY COMPILE_FLAGS ${FFLAGS3} )
132
133 # set preprocesor flags   
134 set(CPPFLAGS "PROCOR -DLINUX -DISNAN -DSPLITELE -DLANG0" )
135
136 if (Fortran_COMPILER_NAME STREQUAL "ifort")
137   # Add ifort preprocessor flags
138   set(CPPFLAGS "${CPPFLAGS} -DPGI") 
139 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
140   # Add gfortran flags
141   set(CPPFLAGS "${CPPFLAGS} -DG77") 
142 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
143   # Add gfortran flags
144   set(CPPFLAGS "${CPPFLAGS} -DG77") 
145 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
146
147
148 # add 64-bit specific preprocessor flags
149 if (architektura STREQUAL "64")
150   set(CPPFLAGS "${CPPFLAGS} -DAMD64")
151 endif (architektura STREQUAL "64")
152
153 # Apply preprocesor flags to *.F files
154 set_property(SOURCE ${UNRES_MIN_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )  
155
156
157
158 #========================================
159 #  Setting binary name
160 #========================================
161 set(UNRES_BIN "unres_min_${Fortran_COMPILER_NAME}.exe")
162
163 #set(UNRES_CINFO_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
164
165 #=========================================
166 # Set full unres MIN sources
167 #=========================================
168 set(UNRES_MIN_SRCS ${UNRES_MIN_SRC0} ${UNRES_MIN_SRC1} ${UNRES_MIN_SRC2} ${UNRES_MIN_SRC3} cinfo.f )
169
170 #=========================================
171 # Build the binary
172 #=========================================
173 add_executable(UNRES_BIN-MIN ${UNRES_MIN_SRCS} )
174 set_target_properties(UNRES_BIN-MIN PROPERTIES OUTPUT_NAME ${UNRES_BIN})
175
176 if (Fortran_COMPILER_NAME STREQUAL "ifort")
177   target_link_libraries (UNRES_BIN-MIN ${CMAKE_THREAD_LIBS_INIT})
178 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
179
180 #set_property(TARGET ${UNRES_BIN} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/unres/MD )
181
182 #=========================================
183 # TESTS 
184 #=========================================
185
186 #-- Copy all the data files from the test directory into the source directory
187 #SET(UNRES_TEST_FILES
188 #       ala10.inp
189 #    )
190
191 #FOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
192 #      SET (unres_test_dest "${CMAKE_CURRENT_BINARY_DIR}/${UNRES_TEST_FILE}")
193 #      MESSAGE (STATUS " Copying ${UNRES_TEST_FILE} from ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} to ${unres_test_dest}")
194 #      ADD_CUSTOM_COMMAND (
195 #          TARGET     ${UNRES_BIN}
196 #          POST_BUILD
197 #          COMMAND    ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/examples/unres/MD/ff_gab/${UNRES_TEST_FILE} ${unres_test_dest}
198 #      )
199 #ENDFOREACH (UNRES_TEST_FILE ${UNRES_TEST_FILES})
200
201 #=========================================
202 # Generate data test files
203 #=========================================
204
205 #if(NOT UNRES_WITH_MPI)
206
207 #  add_test(NAME UNRES_MD_Ala10 COMMAND sh ${CMAKE_CURRENT_BINARY_DIR}/test_single_ala.sh )
208
209 #endif(NOT UNRES_WITH_MPI)
210