-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8)
project(Gromacs)
include(Dart)
# machine with no git.
#
# NOTE: when releasing the "-dev" suffix needs to be stripped off!
-set(PROJECT_VERSION "4.5.5-dev")
+set(PROJECT_VERSION "4.6-dev")
set(CUSTOM_VERSION_STRING ""
CACHE STRING "Custom version string (if empty, use hard-coded default)")
mark_as_advanced(CUSTOM_VERSION_STRING)
set(SOVERSION 6)
# It is a bit irritating, but this has to be set separately for now!
SET(CPACK_PACKAGE_VERSION_MAJOR "4")
-SET(CPACK_PACKAGE_VERSION_MINOR "5")
-SET(CPACK_PACKAGE_VERSION_PATCH "5")
+SET(CPACK_PACKAGE_VERSION_MINOR "6")
+#SET(CPACK_PACKAGE_VERSION_PATCH "0")
# Cmake modules/macros are in a subdirectory to keep this file cleaner
option(BUILD_SHARED_LIBS "Enable shared libraries (can be problematic with MPI, Windows)" ${SHARED_LIBS_DEFAULT})
option(GMX_MPI_IN_PLACE "Enable MPI_IN_PLACE for MPIs that have it defined" ON)
mark_as_advanced(GMX_MPI_IN_PLACE)
-option(GMX_DLOPEN "Compile with dlopen, needed to read VMD supported file formats" ON)
-mark_as_advanced(GMX_DLOPEN)
+option(GMX_LOAD_PLUGINS "Compile with plugin support, needed to read VMD supported file formats" ON)
+mark_as_advanced(GMX_LOAD_PLUGINS)
option(GMX_IA32_ASM "Add SSE assembly files for IA32" OFF)
option(GMX_X86_64_ASM "Add SSE assembly files for X86_64" OFF)
mark_as_advanced(GMX_X86_64_ASM)
+option(GMX_OPENMP "Enable OpenMP-based mutithreading. " ON)
+
option(USE_VERSION_H "Generate development version string/information" ON)
mark_as_advanced(USE_VERSION_H)
set (GMX_LIBS_SUFFIX "_gpu")
endif(GMX_OPENMM)
mark_as_advanced(FORCE GMX_BINARY_SUFFIX GMX_LIBS_SUFFIX)
- message(STATUS "Using default binary suffix: \"${GMX_BINARY_SUFFIX}\"")
- message(STATUS "Using default library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ if (NOT SUFFIX_QUIETLY)
+ message(STATUS "Using default binary suffix: \"${GMX_BINARY_SUFFIX}\"")
+ message(STATUS "Using default library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ endif (NOT SUFFIX_QUIETLY)
else(GMX_DEFAULT_SUFFIX)
mark_as_advanced(CLEAR GMX_BINARY_SUFFIX GMX_LIBS_SUFFIX)
- message(STATUS "Using manually set binary suffix: \"${GMX_BINARY_SUFFIX}\"")
- message(STATUS "Using manually set library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ if (NOT SUFFIX_QUIETLY)
+ message(STATUS "Using manually set binary suffix: \"${GMX_BINARY_SUFFIX}\"")
+ message(STATUS "Using manually set library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ endif (NOT SUFFIX_QUIETLY)
endif(GMX_DEFAULT_SUFFIX)
+set(SUFFIX_QUIETLY TRUE CACHE INTERNAL "")
set(PKG_CFLAGS "")
if(GMX_DOUBLE)
########################################################################
#Process MPI settings
########################################################################
-include(CheckCSourceCompiles) # for gmxTestMPI_IN_PLACE
-if(GMX_MPI)
- if(GMX_THREADS)
- #message(FATAL_ERROR "Thread-based parallelization conflicts with MPI.")
- set(GMX_THREADS OFF CACHE BOOL
- "Thread-based parallelization conflicts with MPI." FORCE)
- endif(GMX_THREADS)
- find_package(MPI)
- if(MPI_FOUND)
- set(GROMACS_C_FLAGS ${GROMACS_FLAGS} ${MPI_COMPILE_FLAGS})
- set(GROMACS_LINKER_FLAGS ${GROMACS_LINKER_FLAGS} ${MPI_LINK_FLAGS})
-
- include_directories(${MPI_INCLUDE_PATH})
- list(APPEND GMX_EXTRA_LIBRARIES ${MPI_LIBRARIES})
- if(GMX_FAHCORE)
- add_definitions( -DMPI ) #for FAHCORE
- endif(GMX_FAHCORE)
- include(gmxTestMPI_IN_PLACE)
- if (GMX_MPI_IN_PLACE)
- gmx_test_mpi_in_place(MPI_IN_PLACE_EXISTS)
- endif (GMX_MPI_IN_PLACE)
-
- # test for unsuitable versions of OpenMPI
- exec_program(${MPIEXEC}
- ARGS --version
- OUTPUT_VARIABLE MPI_TYPE
- RETURN_VALUE MPI_EXEC_RETURN)
- if(MPI_EXEC_RETURN EQUAL 0)
- if(MPI_TYPE MATCHES "Open MPI|OpenRTE")
- string(REGEX MATCH "[0-9]+\\.[0-9]*\\.?[0-9]*" MPI_VERSION ${MPI_TYPE})
- if(MPI_VERSION VERSION_LESS "1.4.1")
- MESSAGE(WARNING "
- There are known problems with OpenMPI version < 1.4.1.
- Please consider updating your OpenMPI.")
- endif(MPI_VERSION VERSION_LESS "1.4.1")
- unset(MPI_VERSION)
- else(MPI_TYPE MATCHES "Open MPI|OpenRTE")
- # This is not OpenMPI, so give the old generic warning message
- MESSAGE(WARNING "
- There are known problems with some MPI implementations:
- MVAPICH2 version <= 1.4.1
- Please consider updating your MPI if applicable.")
- endif(MPI_TYPE MATCHES "Open MPI|OpenRTE")
- unset(MPI_TYPE)
- endif(MPI_EXEC_RETURN EQUAL 0)
- else(MPI_FOUND)
- message(FATAL_ERROR "MPI support requested, but no MPI compiler found.")
- endif(MPI_FOUND)
- include(gmxTestCatamount)
- gmx_test_catamount(GMX_CRAY_XT3)
- if(GMX_CRAY_XT3)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_CRAY_XT3")
- set(GMX_NO_SYSTEM 1)
- set(GMX_NO_NICE 1)
- endif(GMX_CRAY_XT3)
- set(GMX_LIB_MPI 1)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_LIB_MPI")
-endif(GMX_MPI)
-
+include(gmxManageMPI)
#######################################################################
# Check for options incompatible with OpenMM build #
set(GMX_THREADS OFF CACHE BOOL
"Threads are not compatible with OpenMM build, disabled!" FORCE)
endif(GMX_THREADS)
+ if(GMX_OPENMP)
+ message(STATUS "OpenMP multithreading is not compatible with OpenMM, disabled")
+ set(GMX_OPENMP OFF CACHE BOOL
+ "OpenMP multithreading is not compatible with OpenMM, disabled!" FORCE)
+ endif()
if(GMX_SOFTWARE_INVSQRT)
set(GMX_SOFTWARE_INVSQRT OFF CACHE STRING
"The OpenMM build does not need GROMACS software 1/sqrt!" FORCE)
find_package(OpenMM)
endif(GMX_OPENMM)
+if(GMX_OPENMP)
+ find_package(OpenMP REQUIRED)
+ list(APPEND GROMACS_C_FLAGS ${OpenMP_C_FLAGS})
+ list(APPEND GROMACS_CXX_FLAGS ${OpenMP_CXX_FLAGS})
+ add_definitions(-DGMX_OPENMP)
+endif()
+
if(APPLE)
find_library(ACCELERATE_FRAMEWORK Accelerate)
list(APPEND GMX_EXTRA_LIBRARIES ${ACCELERATE_FRAMEWORK})
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
if(USE_VERSION_H)
# We need at least git v1.5.1 be able to parse git's date output. If not
- # fund or the version is too small, we can't generate version information.
- find_package(Git 1.5.1)
- # this should at some point become VERSION_LESS
- if(NOT Git_FOUND OR Git_VERSION STRLESS "1.5.1")
- message("No compatible git version found, won't be able to generate proper development version information.")
- set(USE_VERSION_H OFF)
+ # found or the version is too small, we can't generate version information.
+ find_package(Git)
+
+ # Find out the git version
+ if(GIT_FOUND AND NOT GIT_VERSION)
+ execute_process(COMMAND ${GIT_EXECUTABLE} "--version"
+ OUTPUT_VARIABLE _exec_out
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "git version (.*)" "\\1" GIT_VERSION ${_exec_out})
+ set(GIT_VERSION ${GIT_VERSION} CACHE STRING "Git version")
+ mark_as_advanced(GIT_VERSION)
+ endif()
+
+ if(NOT GIT_FOUND OR GIT_VERSION VERSION_LESS "1.5.1")
+ message("No compatible git version found, won't be able to generate proper development version information.")
+ set(USE_VERSION_H OFF)
endif()
endif()
else()
set(USE_VERSION_H OFF)
endif()
-if (GMX_DLOPEN)
- list(APPEND GMX_EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
- set(PKG_DL_LIBS "-l${CMAKE_DL_LIBS}")
-else(GMX_DLOPEN)
- set(PKG_DL_LIBS)
-endif (GMX_DLOPEN)
-
########################################################################
# Generate development version info for cache
########################################################################
check_function_exists(fseeko HAVE_FSEEKO)
include(gmxTestSignal)
-gmx_test_retsigtype(RETSIGTYPE)
gmx_test_sigusr1(HAVE_SIGUSR1)
include(gmxTestInline)
mark_as_advanced(GMX_EXTERNAL_LAPACK)
mark_as_advanced(GMX_EXTERNAL_BLAS)
+set(GMX_USE_PLUGINS OFF CACHE INTERNAL "Whether GROMACS will really try to compile support for VMD plugins")
+set(GMX_VMD_PLUGIN_PATH)
+mark_as_advanced(GMX_VMD_PLUGIN_PATH)
+
+if(GMX_LOAD_PLUGINS)
+ if(CYGWIN OR NOT WIN32)
+ # Native Windows does not have, nor need dlopen
+ # Note that WIN32 is set with Cygwin, but Cygwin needs dlopen to use plug-ins
+ include(gmxTestdlopen)
+ gmx_test_dlopen(HAVE_DLOPEN)
+ endif()
+
+ find_package(VMD)
+
+ # Test for unsuitable versions of VMD
+
+ if(VMD_FOUND AND NOT GMX_VMD_PLUGIN_PATH)
+ message(STATUS "Checking for suitable VMD version")
+ exec_program(${VMD_EXECUTABLE}
+ ARGS --help
+ OUTPUT_VARIABLE VMD_HELP
+ RETURN_VALUE VMD_EXEC_RETURN)
+
+ if(VMD_EXEC_RETURN EQUAL 0)
+ # This is the accepted idiom for subexpression matching, unfortunately
+ string(REGEX REPLACE ".*VMD for .*, version ([0-9]+\\.[0-9]*\\.?[0-9]*).*" "\\1" VMD_VERSION ${VMD_HELP})
+ string(REGEX REPLACE ".*VMD for (.*), version .*" "\\1" VMD_ARCH ${VMD_HELP})
+
+ if(VMD_VERSION VERSION_LESS "1.8")
+ MESSAGE(WARNING "Found VMD version ${VMD_VERSION}, but GROMACS needs at least 1.8")
+ unset(VMD_EXECUTABLE)
+ set(VMD_FOUND FALSE)
+ else()
+ message(STATUS "VMD version ${VMD_VERSION} is suitable")
+ if(DEFINED ENV{VMDDIR})
+ # This permits GROMACS to avoid hard-coding a fall-back
+ # path that it can tell right now would be useless.
+ set(GMX_VMD_PLUGIN_PATH "$ENV{VMDDIR}/plugins/${VMD_ARCH}/molfile" CACHE PATH "Path to VMD plugins for molfile I/O")
+ else()
+ set(GMX_VMD_PLUGIN_PATH "/usr/local/lib/vmd/plugins/*/molfile" CACHE PATH "Path to VMD plugins for molfile I/O")
+ endif()
+ endif()
+
+ # clean up
+ unset(VMD_HELP)
+ unset(VMD_VERSION)
+ unset(VMD_ARCH)
+ endif()
+ endif()
+
+ # so, should we use plug-ins?
+ if((WIN32 AND NOT CYGWIN) OR (HAVE_DLOPEN AND BUILD_SHARED_LIBS))
+ if (NOT VMD_QUIETLY)
+ MESSAGE(STATUS "Found the ability to use plug-ins when building shared libaries, so will compile to use plug-ins (e.g. to read VMD-supported file formats).")
+ endif(NOT VMD_QUIETLY)
+ set(GMX_USE_PLUGINS ON)
+ list(APPEND GMX_EXTRA_LIBRARIES ${CMAKE_DL_LIBS}) # magic cross-platform pre-set variable for dlopen library
+ set(PKG_DL_LIBS "-l${CMAKE_DL_LIBS}")
+ else()
+ set(PKG_DL_LIBS)
+ endif()
+endif(GMX_LOAD_PLUGINS)
+set(VMD_QUIETLY TRUE CACHE INTERNAL "")
+
# Math and thread libraries must often come after all others when linking...
if(HAVE_LIBM)
list(APPEND GMX_EXTRA_LIBRARIES m)