update new files
[unres.git] / source / cluster / wham / src-old / CMakeLists.txt
1 #
2 # CMake project file for cluster analysis from WHAM for single-chain proteins  
3
4
5 enable_language (Fortran)
6
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_CLUSTER_WHAM_SRC0 
11         arcos.f
12         cartprint.f
13         chainbuild.f
14         contact.f
15         convert.f
16         energy_p_new.F
17         fitsq.f
18         geomout.F
19         gnmr1.f
20         hc.f
21         icant.f
22         initialize_p.F
23         intcor.f
24         int_from_cart1.F
25         main_clust.F
26         matmult.f
27         misc.f
28         noyes.f
29         parmread.F
30         pinorm.f
31         probabl.F
32         read_coords.F
33         readpdb.F
34         readrtns.F
35         rescode.f
36         setup_var.f
37         srtclust.f
38         ssMD.F
39         timing.F
40         track.F
41         wrtclust.f
42         work_partition.F
43         dfa.F
44         printmat.f
45 )
46
47 set(UNRES_CLUSTER_WHAM_PP_SRC
48         energy_p_new.F
49         initialize_p.F
50         geomout.F
51         main_clust.F
52         parmread.F
53         probabl.F
54         read_coords.F
55         readrtns.F
56         ssMD.F
57         timing.F
58         track.F
59         work_partition.F
60
61
62
63 #================================================
64 # Set comipiler flags for different sourcefiles  
65 #================================================
66 if (Fortran_COMPILER_NAME STREQUAL "ifort")
67   set(FFLAGS0 "-mcmodel=medium -shared-intel -ip -w -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres " ) 
68 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
69   set(FFLAGS0 "-std=legacy -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres " ) 
70 else ()
71   set(FFLAGS0 "-g -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
72 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
73
74 #=========================================
75 # Add MPI compiler flags
76 #=========================================
77 if(UNRES_WITH_MPI)
78   set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
79 endif(UNRES_WITH_MPI)
80
81 set_property(SOURCE ${UNRES_CLUSTER_WHAM_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
82
83 #=========================================
84 #  Settings for GAB force field
85 #=========================================
86 if(UNRES_MD_FF STREQUAL "GAB" )
87    # set preprocesor flags   
88    set(CPPFLAGS "PROCOR  -DSPLITELE -DCRYST_BOND  -DCRYST_THETA -DCRYST_SC  -DSCCORPDB" )
89
90 #=========================================
91 #  Settings for E0LL2Y force field
92 #=========================================
93 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
94    # set preprocesor flags   
95    set(CPPFLAGS "PROCOR  -DSPLITELE -DSCCORPDB" )
96 elseif(UNRES_MD_FF STREQUAL "4P")
97   set(CPPFLAGS "SPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
98 endif(UNRES_MD_FF STREQUAL "GAB")
99
100 #=========================================
101 # Additional flags
102 #=========================================
103 set(CPPFLAGS "${CPPFLAGS} -DUNRES -DISNAN -DCLUST" )
104
105 #=========================================
106 # Compiler specific flags
107 #=========================================
108 if (Fortran_COMPILER_NAME STREQUAL "ifort")
109   # Add ifort preprocessor flags
110   set(CPPFLAGS "${CPPFLAGS} -DPGI") 
111 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
112   # Add new gfortran flags
113   set(CPPFLAGS "${CPPFLAGS} -DG77") 
114 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
115   # Add old gfortran flags
116   set(CPPFLAGS "${CPPFLAGS} -DG77") 
117 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
118
119
120 #=========================================
121 # System specific flags
122 #=========================================
123 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
124   set(CPPFLAGS "${CPPFLAGS} -DLINUX") 
125 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
126
127 #=========================================
128 # Add MPI preprocessor flags
129 #=========================================
130 if (UNRES_WITH_MPI)
131   set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI") 
132 endif(UNRES_WITH_MPI)
133
134
135 #=========================================
136 # Apply preprocesor flags to *.F files
137 #=========================================
138 set_property(SOURCE ${UNRES_CLUSTER_WHAM_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )  
139
140
141 #========================================
142 #  Setting binary name
143 #========================================
144 set(UNRES_CLUSTER_WHAM_BIN "cluster_wham_${Fortran_COMPILER_NAME}_MPI_${UNRES_MD_FF}.exe")
145
146 #=========================================
147 # cinfo.f workaround for CMake
148 #=========================================
149 # get the current date  
150 TODAY(DATE)
151 # generate cinfo.f
152
153 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
154 FILE(WRITE ${CINFO}
155 "C CMake generated file
156        subroutine cinfo
157        include 'COMMON.IOUNITS'
158        write(iout,*)'++++ Compile info ++++'
159        write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
160 ")
161
162 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
163 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
164 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
165 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
166 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
167 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
168 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
169
170 FILE(APPEND ${CINFO} 
171 "       write(iout,*)'++++ End of compile info ++++'  
172        return 
173        end ")
174
175 # set include path
176 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
177
178
179 set_property(SOURCE proc_proc.c PROPERTY COMPILE_DEFINITIONS "LINUX -DPGI" )  
180
181 #=========================================
182 # Set full unres CLUSTER sources
183 #=========================================
184 set(UNRES_CLUSTER_WHAM_SRCS ${UNRES_CLUSTER_WHAM_SRC0} ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f proc_proc.c)
185
186
187
188 #=========================================
189 # Build the binary
190 #=========================================
191 add_executable(UNRES_CLUSTER_WHAM_BIN ${UNRES_CLUSTER_WHAM_SRCS} )
192 set_target_properties(UNRES_CLUSTER_WHAM_BIN PROPERTIES OUTPUT_NAME ${UNRES_CLUSTER_WHAM_BIN})
193 set_property(TARGET UNRES_CLUSTER_WHAM_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
194
195 #=========================================
196 # Link libraries
197 #=========================================
198 # link MPI libraries
199 if(UNRES_WITH_MPI)
200   target_link_libraries( UNRES_CLUSTER_WHAM_BIN ${MPI_Fortran_LIBRARIES} )
201 endif(UNRES_WITH_MPI)
202 # link libxdrf.a 
203 target_link_libraries( UNRES_CLUSTER_WHAM_BIN xdrf )
204
205 #=========================================
206 # Install Path
207 #=========================================
208 install(TARGETS UNRES_CLUSTER_WHAM_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/cluster)
209
210