2 # CMake project file for cluster analysis from WHAM for oligomeric proteins
5 enable_language (Fortran C)
7 #================================
8 # Set source file lists
9 #================================
10 set(UNRES_CLUSTER_WHAM_M_SRC0
46 set(UNRES_CLUSTER_WHAM_M_PP_SRC
61 #================================================
62 # Set comipiler flags for different sourcefiles
63 #================================================
64 if (Fortran_COMPILER_NAME STREQUAL "ifort")
65 set(FFLAGS0 "-ip -w -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
66 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
67 set(FFLAGS0 "-std=legacy -I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
69 set(FFLAGS0 "-I. -I${CMAKE_CURRENT_SOURCE_DIR}/include_unres" )
70 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
72 #=========================================
73 # Add MPI compiler flags
74 #=========================================
76 set(FFLAGS0 "${FFLAGS0} -I${MPI_Fortran_INCLUDE_PATH}")
79 set_property(SOURCE ${UNRES_CLUSTER_WHAM_M_SRC0} PROPERTY COMPILE_FLAGS ${FFLAGS0} )
81 #=========================================
82 # Settings for GAB force field
83 #=========================================
84 if(UNRES_MD_FF STREQUAL "GAB" )
85 # set preprocesor flags
86 set(CPPFLAGS "PROCOR -DSPLITELE -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
88 #=========================================
89 # Settings for E0LL2Y force field
90 #=========================================
91 elseif(UNRES_MD_FF STREQUAL "E0LL2Y")
92 # set preprocesor flags
93 set(CPPFLAGS "PROCOR -DSPLITELE -DSCCORPDB" )
94 elseif(UNRES_MD_FF STREQUAL "4P")
95 set(CPPFLAGS "SPLITELE -DLANG0 -DCRYST_BOND -DCRYST_THETA -DCRYST_SC -DSCCORPDB" )
96 endif(UNRES_MD_FF STREQUAL "GAB")
98 #=========================================
100 #=========================================
101 set(CPPFLAGS "${CPPFLAGS} -DUNRES -DISNAN")
103 #=========================================
104 # Compiler specific flags
105 #=========================================
106 if (Fortran_COMPILER_NAME STREQUAL "ifort")
107 # Add ifort preprocessor flags
108 set(CPPFLAGS "${CPPFLAGS} -DPGI")
109 elseif (Fortran_COMPILER_NAME STREQUAL "f95")
110 # Add new gfortran flags
111 set(CPPFLAGS "${CPPFLAGS} -DG77")
112 elseif (Fortran_COMPILER_NAME STREQUAL "gfortran")
113 # Add old gfortran flags
114 set(CPPFLAGS "${CPPFLAGS} -DG77")
115 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
118 #=========================================
119 # System specific flags
120 #=========================================
121 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
122 set(CPPFLAGS "${CPPFLAGS} -DLINUX")
123 endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
125 #=========================================
126 # Add MPI preprocessor flags
127 #=========================================
129 set(CPPFLAGS "${CPPFLAGS} -DMP -DMPI")
130 endif(UNRES_WITH_MPI)
133 #=========================================
134 # Apply preprocesor flags to *.F files
135 #=========================================
136 set_property(SOURCE ${UNRES_CLUSTER_WHAM_M_PP_SRC} PROPERTY COMPILE_DEFINITIONS ${CPPFLAGS} )
138 set_property(SOURCE proc_proc.c PROPERTY COMPILE_DEFINITIONS "LINUX -DPGI" )
140 #========================================
141 # Setting binary name
142 #========================================
143 set(UNRES_CLUSTER_WHAM_M_BIN "cluster_wham-mult_${Fortran_COMPILER_NAME}_MPI_${UNRES_MD_FF}.exe")
145 #=========================================
146 # cinfo.f workaround for CMake
147 #=========================================
148 # get the current date
152 set(CINFO "${CMAKE_CURRENT_BINARY_DIR}/cinfo.f")
154 "C CMake generated file
156 include 'COMMON.IOUNITS'
157 write(iout,*)'++++ Compile info ++++'
158 write(iout,*)'Version ${UNRES_MAJOR}.${UNRES_MINOR} build ${UNRES_PATCH}'
161 CINFO_FORMAT(${CINFO} "Compiled" "${DATE}" )
162 CINFO_FORMAT(${CINFO} "Compiled by" "$ENV{USER}@$ENV{HOST}" )
163 CINFO_FORMAT(${CINFO} "OS name:" "${CMAKE_SYSTEM_NAME}" )
164 CINFO_FORMAT(${CINFO} "OS release:" "${CMAKE_SYSTEM}" )
165 CINFO_FORMAT(${CINFO} "Fortran Compiler:" "${CMAKE_Fortran_COMPILER}" )
166 CINFO_FORMAT(${CINFO} "MD Force field:" "${UNRES_MD_FF}" )
167 CINFO_FORMAT(${CINFO} "CPPFLAGS =" "${CPPFLAGS}")
170 " write(iout,*)'++++ End of compile info ++++'
175 set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/cinfo.f PROPERTY COMPILE_FLAGS "${FFLAGS0} -I${CMAKE_CURRENT_SOURCE_DIR}" )
178 set_property(SOURCE proc_proc.c PROPERTY COMPILE_DEFINITIONS "LINUX -DPGI" )
181 #=========================================
182 # Set full unres CLUSTER sources
183 #=========================================
184 set(UNRES_CLUSTER_WHAM_M_SRCS ${UNRES_CLUSTER_WHAM_M_SRC0} proc_proc.c)
186 #=========================================
188 #=========================================
189 add_executable(UNRES_CLUSTER_WHAM_M_BIN ${UNRES_CLUSTER_WHAM_M_SRCS} )
190 set_target_properties(UNRES_CLUSTER_WHAM_M_BIN PROPERTIES OUTPUT_NAME ${UNRES_CLUSTER_WHAM_M_BIN})
191 set_property(TARGET UNRES_CLUSTER_WHAM_M_BIN PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
193 #=========================================
195 #=========================================
198 target_link_libraries( UNRES_CLUSTER_WHAM_M_BIN ${MPI_Fortran_LIBRARIES} )
199 endif(UNRES_WITH_MPI)
201 target_link_libraries( UNRES_CLUSTER_WHAM_M_BIN xdrf )
204 #=========================================
206 #=========================================
207 install(TARGETS UNRES_CLUSTER_WHAM_M_BIN DESTINATION ${CMAKE_INSTALL_PREFIX}/cluster)