2 # CMake project file for UNRES
4 cmake_minimum_required(VERSION 2.8)
6 project(UNRESPACK Fortran C)
11 set(UNRES_VERSION ${UNRES_MAJOR}.${UNRES_MINOR}.${UNRES_PATCH})
13 #======================================
15 #======================================
20 # Set makefile verbose on
21 set( CMAKE_VERBOSE_MAKEFILE 1 )
23 #======================================
24 # Fortran compilers stuff
25 #======================================
26 # Get the compiler name
27 get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
29 # Altough cmake enables you to set some compiler definitions it seems by default they are ignored.
30 # This is a workaround to pass compiler definitions (preprocesor flags) to fortran compilers like ifort
31 SET(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} <FLAGS> <DEFINES> -c <SOURCE> -o <OBJECT> ${CMAKE_END_TEMP_FILE}")
32 #set(CPPFLAGS "-DPROCOR -DLINUX -DPGI -DUNRES -DISNAN -DMP -DMPI -DSPLITELE -DLANGO -DCRYST_BOND -DCRYST_THETA -DCRYST_SC" )
33 #add_definitions( ${CPPFLAGS} )
36 # make sure that the default is a RELEASE
37 if (NOT CMAKE_BUILD_TYPE)
38 set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: None Debug Release." FORCE)
39 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "None" "Debug" "Release" )
40 endif (NOT CMAKE_BUILD_TYPE)
42 #=======================================
43 # Set the varous build variables
44 #=======================================
48 set(UNRES_MD_FF "GAB" CACHE STRING "Choose the force field, options are: GAB E0LL2Y" )
49 set_property(CACHE UNRES_MD_FF PROPERTY STRINGS "GAB" "E0LL2Y")
52 # Set CSA version force field
54 set(UNRES_CSA_FF "4P" CACHE STRING "Choose the CSA version force field, options are: CASP3 ALPHA BETA ALPHABETA CASP5 3P 4P" )
55 set_property(CACHE UNRES_CSA_FF PROPERTY STRINGS "CASP3" "ALPHA" "BETA" "ALPHABETA" "CASP5" "3P" "4P" )
56 endif (NOT UNRES_CSA_FF)
58 # Use of MPI library (default ON)
59 option(UNRES_WITH_MPI "Choose whether or not to use MPI library" ON )
62 # Piasek cluster devel stuff
63 option(UNRES_NA_MMCE "Kompilujemy na mmmce?" OFF )
66 #=================================
68 #=================================
70 # Note for the future - use finde package to get MPI
79 find_library(MPIF_LIBRARY NAMES libmpich.a NO_DEFAULT_PATH PATHS ${MPIF_LOCAL_DIR}/lib)
80 find_path( MPIF_INCLUDE_DIRECTORIES NAMES mpif.h NO_DEFAULT_PATH PATHS ${MPIF_LOCAL_DIR}/include )
82 find_library(MPIF_LIBRARY NAMES mpi mpich PATHS
85 /users/local/mpi64/mpich-1.2.7p1/lib
90 find_path( MPIF_INCLUDE_DIRECTORIES NAMES mpif.h PATHS
92 /users/local/mpi64/mpich-1.2.7p1/include
96 /usr/local/mpi/include
100 set( MPIF_LIBRARIES ${MPIF_LIBRARY})
102 if ( MPIF_INCLUDE_DIRECTORIES )
103 set( MPIF_FOUND TRUE )
105 else ( MPIF_INCLUDE_DIRECTORIES )
106 set( MPIF_FOUND FALSE )
107 message("MPI not found - disabling MPI compile flags ")
108 set ( UNRES_WITH_MPI "OFF")
109 endif ( MPIF_INCLUDE_DIRECTORIES )
112 message("MPIF_LIBRARIES=${MPIF_LIBRARY}")
113 message("MPIF_INCLUDE_DIRECTORIES=${MPIF_INCLUDE_DIRECTORIES}" )
118 #======================================
119 # Detect system architecture
120 #=======================================
122 if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
123 set(architektura "32")
124 else (CMAKE_SIZEOF_VOID_P EQUAL 4)
125 set(architektura "64")
126 endif( CMAKE_SIZEOF_VOID_P EQUAL 4 )
128 message("Detected ${architektura}-bit architecture")
130 #=======================================
131 # Find other libraries
132 #=======================================
134 # used by unres/src_MIN
135 find_package (Threads)
139 #=======================================
140 # Create diractories for build targets
141 #=======================================
142 #execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/unres/MD )
144 #=======================================
146 #=======================================
149 add_subdirectory(source/lib/xdrf)
155 # Brak MPI dla gfortrana, wiec tylko na ifort sie skompiluje
156 if (Fortran_COMPILER_NAME STREQUAL "ifort")
157 add_subdirectory(source/unres/src_MD)
158 add_subdirectory(source/unres/src_MD-M)
159 add_subdirectory(source/unres/src_CSA)
160 add_subdirectory(source/cluster/wham/src)
161 add_subdirectory(source/cluster/wham/src-M)
162 endif (Fortran_COMPILER_NAME STREQUAL "ifort")
164 add_subdirectory(source/unres/src_MD)
165 # src_MD-M doesn't work yet witout MPI
166 # add_subdirectory(source/unres/src_MD-M)
168 add_subdirectory(source/unres/src_MIN)
169 add_subdirectory(source/cluster/unres/src)
170 add_subdirectory(source/xdrfpdb/src)
171 add_subdirectory(source/xdrfpdb/src-M)
175 add_subdirectory(source/unres/src_MD)
177 add_subdirectory(source/unres/src_MD-M)
178 add_subdirectory(source/unres/src_CSA)
179 add_subdirectory(source/wham/src)
180 add_subdirectory(source/wham/src-M)
181 add_subdirectory(source/cluster/wham/src)
182 add_subdirectory(source/cluster/wham/src-M)
183 endif(UNRES_WITH_MPI)
184 add_subdirectory(source/unres/src_MIN)
185 add_subdirectory(source/cluster/unres/src)
186 add_subdirectory(source/xdrfpdb/src)
187 add_subdirectory(source/xdrfpdb/src-M)