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 endif (NOT CMAKE_BUILD_TYPE)
41 #=======================================
42 # Set the varous build variables
43 #=======================================
47 set(UNRES_FF "GAB" "E0LL2Y" CACHE STRING "Choose the force field, options are: GAB E0LL2Y" )
48 #message ( "Please set the Force field (UNRES_FF) to : GAB, 0ELE" )
51 # Use of MPI library (default ON)
52 option(UNRES_WITH_MPI "Choose whether or not to use MPI library" ON )
54 #=================================
56 #=================================
58 # Note for the future - use finde package to get MPI
62 find_library(MPIF_LIBRARY NAMES libmpich.a NO_DEFAULT_PATH PATHS ${MPIF_LOCAL_DIR}/lib)
63 find_path( MPIF_INCLUDE_DIRECTORIES NAMES mpif.h NO_DEFAULT_PATH PATHS ${MPIF_LOCAL_DIR}/include )
65 find_library(MPIF_LIBRARY NAMES mpich PATHS
66 /users/local/mpi64/mpich-1.2.7p1/lib
71 find_path( MPIF_INCLUDE_DIRECTORIES NAMES mpif.h PATHS
72 /users/local/mpi64/mpich-1.2.7p1/include
76 /usr/local/mpi/include
80 set( MPIF_LIBRARIES ${MPIF_LIBRARY})
82 if ( MPIF_INCLUDE_DIRECTORIES )
83 set( MPIF_FOUND TRUE )
85 else ( MPIF_INCLUDE_DIRECTORIES )
86 set( MPIF_FOUND FALSE )
87 message("MPIF not found - disabling MPI compile flags ")
88 set ( UNRES_WITH_MPI "OFF")
89 endif ( MPIF_INCLUDE_DIRECTORIES )
92 message("MPIF_LIBRARIES=${MPIF_LIBRARY}")
93 message("MPIF_INCLUDE_DIRECTORIES=${MPIF_INCLUDE_DIRECTORIES}" )
98 #======================================
99 # Detect system architecture
102 if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
103 set(architektura "32")
104 else (CMAKE_SIZEOF_VOID_P EQUAL 4)
105 set(architektura "64")
106 endif( CMAKE_SIZEOF_VOID_P EQUAL 4 )
108 message("Detected ${architektura}-bit architecture")
111 #=======================================
112 # Create diractories for build targets
113 #=======================================
114 #execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/bin/unres/MD )
116 #=======================================
118 #=======================================
119 add_subdirectory(source/unres/src_MD)
122 # add_subdirectory(source/unres/src_CSA)
123 add_subdirectory(source/unres/src_MD-M)
126 add_subdirectory(source/unres/src_MIN)