2 # This file is part of the GROMACS molecular simulation package.
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.
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.
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.
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.
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.
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.
35 # Find OpenMM library.
37 # Looks for the OpenMM libraries at the default (/usr/local) location
38 # or custom location found in the OPENMM_ROOT_DIR environment variable.
40 # The script defines defines:
46 # OpenMM_LIBRARIES_D - debug version of libraries
50 # Author: Szilard Pall (pszilard@cbr.su.se)
52 if(OpenMM_INCLUDE_DIR AND OpenMM_LIBRARY_DIR AND OpenMM_PLUGIN_DIR)
53 set(OpenMM_FIND_QUIETLY)
56 file(TO_CMAKE_PATH "$ENV{OPENMM_ROOT_DIR}" _env_OPENMM_ROOT_DIR)
58 if(IS_DIRECTORY ${_env_OPENMM_ROOT_DIR})
59 set(OpenMM_ROOT_DIR "${_env_OPENMM_ROOT_DIR}" CACHE PATH "OpenMM installation directory" FORCE)
61 if(IS_DIRECTORY "/usr/local/openmm")
62 set(OpenMM_ROOT_DIR "/usr/local/openmm" CACHE PATH "OpenMM installation directory" FORCE)
66 find_library(OpenMM_LIBRARIES
68 PATHS "${OpenMM_ROOT_DIR}/lib"
69 CACHE STRING "OpenMM libraries")
71 find_library(OpenMM_LIBRARIES_D
73 PATHS "${OpenMM_ROOT_DIR}/lib"
74 CACHE STRING "OpenMM debug libraries")
76 if(OpenMM_LIBRARIES_D AND NOT OpenMM_LIBRARIES)
77 set(OpenMM_LIBRARIES ${OpenMM_LIBRARIES_D}
78 CACHE STRING "OpenMM libraries" FORCE)
79 message(WARNING " Only found debug versions of the OpenMM libraries!")
82 get_filename_component(OpenMM_LIBRARY_DIR
85 CACHE STRING "OpenMM library path")
87 find_path(OpenMM_INCLUDE_DIR
89 PATHS "${OpenMM_ROOT_DIR}/include" "${OpenMM_LIBRARY_DIR}/../include"
90 CACHE STRING "OpenMM include directory")
92 # if we did not manage to set the root dir at the beginning but found the
93 # libs then set the ${OpenMM_LIBRARY_DIR}/.. as root
94 if(NOT IS_DIRECTORY ${OpenMM_ROOT_DIR})
95 if (IS_DIRECTORY "${OpenMM_LIBRARY_DIR}/..") # just double-checking
96 get_filename_component(OpenMM_ROOT_DIR
97 "${OpenMM_LIBRARY_DIR}/.."
102 if(NOT IS_DIRECTORY ${OpenMM_ROOT_DIR})
103 message(FATAL_ERROR "Could not find OpenMM! Set the OPENMM_ROOT_DIR environment "
104 "variable to contain the path of the OpenMM installation.")
107 if(NOT IS_DIRECTORY ${OpenMM_LIBRARY_DIR})
108 message(FATAL_ERROR "Can't find OpenMM libraries. Check your OpenMM installation!")
111 # now we can be sure that we have the library dir
112 if(IS_DIRECTORY "${OpenMM_LIBRARY_DIR}/plugins")
113 get_filename_component(OpenMM_PLUGIN_DIR
114 "${OpenMM_LIBRARY_DIR}/plugins"
116 set(OpenMM_PLUGIN_DIR ${OpenMM_PLUGIN_DIR} CACHE PATH "OpenMM plugins directory")
118 message(WARNING "Could not detect the OpenMM plugin directory at the default location (${OpenMM_LIBRARY_DIR}/plugins)."
119 "Check your OpenMM installation or set the OPENMM_PLUGIN_DIR environment variable!")
122 if(NOT OpenMM_INCLUDE_DIR)
123 message(FATAL_ERROR "Can't find OpenMM includes. Check your OpenMM installation!")
126 set(OpenMM_ROOT_DIR ${OpenMM_ROOT_DIR} CACHE PATH "OpenMM installation directory")
128 include(FindPackageHandleStandardArgs)
129 find_package_handle_standard_args(OpenMM DEFAULT_MSG
135 mark_as_advanced(OpenMM_INCLUDE_DIR