Merge "remove unnecessary cmake messages" into release-4-6
[alexxy/gromacs.git] / src / contrib / CMakeLists.txt
1 #
2 # This file is part of the GROMACS molecular simulation package.
3 #
4 # Copyright (c) 2012, by the GROMACS development team, led by
5 # David van der Spoel, Berk Hess, Erik Lindahl, and including many
6 # others, as listed in the AUTHORS file in the top-level source
7 # directory and at http://www.gromacs.org.
8 #
9 # GROMACS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1
12 # of the License, or (at your option) any later version.
13 #
14 # GROMACS is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GROMACS; if not, see
21 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
23 #
24 # If you want to redistribute modifications to GROMACS, please
25 # consider that scientific software is very special. Version
26 # control is crucial - bugs must be traceable. We will be happy to
27 # consider code for inclusion in the official distribution, but
28 # derived work must not be called official GROMACS. Details are found
29 # in the README & COPYING files - if they are missing, get the
30 # official version at http://www.gromacs.org.
31 #
32 # To help us fund GROMACS development, we humbly ask that you cite
33 # the research papers on the package. Check out http://www.gromacs.org.
34 #
35 set(CONTRIB_PROGRAMS 
36      #add here any programs you want to compile
37
38 )
39
40 # Uncomment the next line to build OpenMM:
41 #option(GMX_OPENMM "Accelerated execution on GPUs through the OpenMM library (no longer supported" ON)
42
43 # At run time, you may need to set the environment variable
44 # OPENMM_PLUGIN_DIR=PATH_TO_GROMACS/openmm/lib/plugins
45 # to make things work
46
47 if(GMX_OPENMM)
48     if(GMX_GPU)
49         message(FATAL_ERROR "The OpenMM build is not compatible with the native GPU build")
50     endif()
51
52     enable_language(CXX)
53     set (GMX_BINARY_SUFFIX "-openmm")
54     set (GMX_LIBS_SUFFIX "_openmm")
55
56 #######################################################################
57 # Check for options incompatible with OpenMM build                    #
58 #######################################################################
59     # we'll use the built-in fft to avoid unnecessary dependencies
60     string(TOUPPER ${GMX_FFT_LIBRARY} GMX_FFT_LIBRARY)
61     if(NOT ${GMX_FFT_LIBRARY} STREQUAL "FFTPACK")
62         message(STATUS "No external FFT libraries needed for the OpenMM build, switching to fftpack!")
63         set(GMX_FFT_LIBRARY "fftpack" CACHE STRING 
64                 "No external FFT libraries needed for the OpenMM build, switching to  fftpack!" FORCE)
65     endif()
66     if(GMX_MPI)
67         message(FATAL_ERROR "The OpenMM build is not compatible with MPI!")
68     endif(GMX_MPI)
69     if(GMX_THREAD_MPI)
70         message(STATUS "Thread-MPI not compatible with OpenMM, disabled!")
71         set(GMX_THREAD_MPI OFF CACHE BOOL
72                 "Thread-MPI not compatible with OpenMM build, disabled!" FORCE)
73     endif(GMX_THREAD_MPI)
74     if(GMX_OPENMP)
75         message(STATUS "OpenMP multithreading not compatible with OpenMM, disabled")
76         set(GMX_OPENMP OFF CACHE BOOL
77             "OpenMP multithreading not compatible with OpenMM, disabled!" FORCE)
78     endif()
79     if(GMX_SOFTWARE_INVSQRT)
80         set(GMX_SOFTWARE_INVSQRT OFF CACHE STRING 
81                 "The OpenMM build does not need GROMACS software 1/sqrt!" FORCE)
82     endif(GMX_SOFTWARE_INVSQRT)
83     string(TOUPPER ${GMX_CPU_ACCELERATION} GMX_CPU_ACCELERATION)
84     if(NOT GMX_CPU_ACCELERATION STREQUAL "NONE")
85         message(STATUS "Switching off CPU-based acceleration, the OpenMM build does not support/need any!")
86         set(GMX_CPU_ACCELERATION "None" CACHE STRING
87             "Switching off CPU-based acceleration, the OpenMM build does not support/need any!" FORCE)
88     endif()
89     if(GMX_FAHCORE)
90         message(FATAL_ERROR "The OpenMM build does not support FAH build!")
91     endif(GMX_FAHCORE)
92     if(GMX_DOUBLE)
93         message(FATAL_ERROR  "The OpenMM-build does not support double precision calculations!")
94     endif()
95
96     set(CUDA_BUILD_EMULATION OFF)
97     find_package(CUDA 3.1 REQUIRED)
98     add_definitions(-DGMX_OPENMM)
99     if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")    
100         set(CUDA_VERBOSE_BUILD ON)
101     endif()
102     list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/contrib)
103     find_package(OpenMM) 
104
105     # mark as advanced the unused variables
106     mark_as_advanced(FORCE GMX_CPU_ACCELERATION GMX_MPI GMX_FFT_LIBRARY 
107         GMX_QMMM_PROGRAM GMX_THREAD_MPI GMX_DOUBLE)
108
109 else(GMX_OPENMM)
110
111      mark_as_advanced(CLEAR GMX_CPU_ACCELERATION GMX_MPI GMX_FFT_LIBRARY 
112         GMX_QMMM_PROGRAM GMX_THREAD_MPI GMX_DOUBLE)
113
114 endif(GMX_OPENMM)
115
116 foreach(PROG ${CONTRIB_PROGRAMS})
117         add_executable(${PROG} ${PROG}.c ${NGMX_COMMON_SOURCE})
118         set_target_properties(${PROG} PROPERTIES OUTPUT_NAME "${PROG}${GMX_BINARY_SUFFIX}")
119 endforeach(PROG)