1 cmake_minimum_required(VERSION 2.6)
5 # PROJECT_VERSION should have the following structure:
6 # VERSION[-dev-SUFFIX] where the VERSION can have any form and the suffix
7 set(PROJECT_VERSION "4.5-beta3"
8 CACHE STRING "Gromacs version string")
11 # Cmake modules/macros are in a subdirectory to keep this file cleaner
12 set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
14 if(NOT CMAKE_BUILD_TYPE)
15 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
16 endif(NOT CMAKE_BUILD_TYPE)
20 ########################################################################
21 # Fix stupid flags on MSVC
22 ########################################################################
23 IF(CMAKE_GENERATOR MATCHES "Visual Studio")
24 STRING(REPLACE /MD /MT CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
25 SET(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE)
26 STRING(REPLACE /MD /MT CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
27 SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} CACHE STRING "" FORCE)
28 ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
30 set(GMX_EXTRA_LIBRARIES)
32 ######################################################################
34 # these need ot be done early (before further tests).
35 #####################################################################
37 include(CheckCCompilerFlag)
38 include(CheckCXXCompilerFlag)
43 ########################################################################
44 # User input options #
45 ########################################################################
46 option(GMX_DOUBLE "Use double precision" OFF)
47 option(GMX_MPI "Build a parallel (message-passing) version of GROMACS" OFF)
48 option(GMX_THREADS "Build a parallel (threaded-based) version of GROMACS)" ON)
49 option(GMX_SOFTWARE_INVSQRT "Use GROMACS software 1/sqrt" ON)
50 option(GMX_FAHCORE "Build a library with mdrun functionality" OFF)
51 option(GMX_OPENMM "Accelerated execution on GPUs through the OpenMM library" OFF)
52 set(GMX_ACCELERATION "auto"
53 CACHE STRING "Accelerated kernels. Pick one of: none, SSE, BlueGene, Power6, ia64, altivec")
55 set(GMX_FFT_LIBRARY "fftw3"
56 CACHE STRING "FFT library choices: fftw3,fftw2,mkl,fftpack[built-in]")
57 option(GMX_DISABLE_FFTW_MEASURE
58 "Do not optimize FFTW setups (not needed with SSE)" OFF)
59 set(GMX_QMMM_PROGRAM "none"
60 CACHE STRING "QM package choices: none,gaussian,mopac,gamess,orca")
61 option(GMX_BROKEN_CALLOC "Work around broken calloc()" OFF)
62 option(BUILD_SHARED_LIBS "Enable shared libraries (can be problematic with MPI)" OFF)
63 option(GMX_MPI_IN_PLACE "Enable MPI_IN_PLACE for MPIs that have it defined" ON)
64 option(GMX_DLOPEN "Compile with dlopen, needed to read VMD supported file formats" ON)
65 mark_as_advanced(GMX_MPI_IN_PLACE)
68 option(GMX_IA32_ASM "Add SSE assembly files for IA32" OFF)
69 option(GMX_X86_64_ASM "Add SSE assembly files for X86_64" OFF)
71 option(USE_VERSION_H "Generate development version string/information" ON)
73 option(GMX_DEFAULT_SUFFIX "Use default GROMACS suffixes" ON)
74 set(GMX_BINARY_SUFFIX "" CACHE STRING "Suffix for GROMACS binaries (default: _d for doubule).")
75 set(GMX_LIBS_SUFFIX ""
76 CACHE STRING "Suffix for GROMACS libs (default: _d for double, _mpi for mpi, _mpi_d for mpi and double).")
77 if (GMX_DEFAULT_SUFFIX)
79 set(GMX_LIBS_SUFFIX "_mpi")
82 set (GMX_BINARY_SUFFIX "_d")
83 set (GMX_LIBS_SUFFIX "${GMX_LIBS_SUFFIX}_d")
85 endif(GMX_DEFAULT_SUFFIX)
89 set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_DOUBLE")
91 if(GMX_SOFTWARE_INVSQRT)
92 set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_SOFTWARE_INVSQRT")
93 endif(GMX_SOFTWARE_INVSQRT)
95 ########################################################################
97 ########################################################################
100 There are known problems with some MPI implementations:
101 OpenMPI version < 1.4.1
102 MVAPICH2 version <= 1.4.1 *")
104 #message(FATAL_ERROR "Thread-based parallelization conflicts with MPI.")
105 set(GMX_THREADS OFF CACHE BOOL
106 "Thread-based parallelization conflicts with MPI." FORCE)
110 set(GROMACS_C_FLAGS ${GROMACS_FLAGS} ${MPI_COMPILE_FLAGS})
111 set(GROMACS_LINKER_FLAGS ${GROMACS_LINKER_FLAGS} ${MPI_LINK_FLAGS})
113 include_directories(${MPI_INCLUDE_PATH})
114 list(APPEND GMX_EXTRA_LIBRARIES ${MPI_LIBRARIES})
115 add_definitions( -DMPI ) #for FAHCORE
116 include(gmxTestMPI_IN_PLACE)
117 if (GMX_MPI_IN_PLACE)
118 gmx_test_mpi_in_place(MPI_IN_PLACE_EXISTS)
119 endif (GMX_MPI_IN_PLACE)
121 message(FATAL_ERROR "MPI support requested, but no MPI compiler found.")
123 include(gmxTestCatamount)
124 gmx_test_catamount(GMX_CRAY_XT3)
126 set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_CRAY_XT3")
131 set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_LIB_MPI")
135 #######################################################################
136 # Check for options incompatible with OpenMM build #
137 #######################################################################
139 cmake_minimum_required(VERSION 2.6.4)
140 # we'll use the built-in fft to avoid unnecessary dependencies
141 set (GMX_FFT_LIBRARY "fftpack")
143 message(FATAL_ERROR "The OpenMM build is not compatible with MPI!")
146 message(STATUS "Threads not compatible with OpenMM build, disabled")
149 if(GMX_SOFTWARE_INVSQRT)
150 set(GMX_SOFTWARE_INVSQRT OFF)
151 endif(GMX_SOFTWARE_INVSQRT)
152 if(NOT GMX_ACCELERATION MATCHES "auto|none|None|NONE" OR NOT ${GMX_ACCELERATION} STREQUAL "")
153 message(WARNING "The OpenMM build does not support other acceleration modes!")
154 set(GMX_ACCELERATION "none")
157 message(FATAL_ERROR "The OpenMM build does not support FAH build!")
162 ########################################################################
163 # Basic system tests (standard libraries, headers, functions, types) #
164 ########################################################################
165 include(CheckIncludeFiles)
166 check_include_files(string.h HAVE_STRING_H)
167 check_include_files(math.h HAVE_MATH_H)
168 check_include_files(limits.h HAVE_LIMITS_H)
169 check_include_files(memory.h HAVE_MEMORY_H)
170 check_include_files(unistd.h HAVE_UNISTD_H)
171 check_include_files(pwd.h HAVE_PWD_H)
172 check_include_files(stdint.h HAVE_STDINT_H)
173 check_include_files(stdlib.h HAVE_STDLIB_H)
174 check_include_files(pthread.h HAVE_PTHREAD_H)
175 check_include_files(dirent.h HAVE_DIRENT_H)
176 check_include_files(inttypes.h HAVE_INTTYPES_H)
177 check_include_files(regex.h HAVE_REGEX_H)
178 check_include_files(sys/types.h HAVE_SYS_TYPES_H)
179 check_include_files(sys/stat.h HAVE_SYS_STAT_H)
180 check_include_files(sys/time.h HAVE_SYS_TIME_H)
181 check_include_files(rpc/rpc.h HAVE_RPC_RPC_H)
182 check_include_files("rpc/rpc.h;rpc/xdr.h" HAVE_RPC_XDR_H)
184 check_include_files(xmmintrin.h HAVE_XMMINTRIN_H)
185 check_include_files(emmintrin.h HAVE_EMMINTRIN_H)
186 check_include_files(pmmintrin.h HAVE_PMMINTRIN_H)
187 check_include_files(smmintrin.h HAVE_SMMINTRIN_H)
188 check_include_files(io.h HAVE_IO_H)
191 include(CheckFunctionExists)
192 check_function_exists(strcasecmp HAVE_STRCASECMP)
193 check_function_exists(strdup HAVE_STRDUP)
194 check_function_exists(vprintf HAVE_VPRINTF)
195 check_function_exists(memcmp HAVE_MEMCMP)
196 check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
197 check_function_exists(memalign HAVE_MEMALIGN)
198 check_function_exists(_aligned_malloc HAVE__ALIGNED_MALLOC)
199 check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
200 check_function_exists(isnan HAVE_ISNAN)
201 check_function_exists(_isnan HAVE__ISNAN)
202 check_function_exists(isfinite HAVE_ISFINITE)
203 check_function_exists(_isfinite HAVE__ISFINITE)
204 check_function_exists(fsync HAVE_FSYNC)
205 check_function_exists(_fileno HAVE__FILENO)
206 check_function_exists(fileno HAVE_FILENO)
207 check_function_exists(_commit HAVE__COMMIT)
209 include(CheckLibraryExists)
210 check_library_exists(m sqrt "" HAVE_LIBM)
211 check_library_exists(m cbrt "" HAVE_CBRT)
214 include(CheckTypeSize)
216 check_type_size("bool" SIZEOF_BOOL) # will also set HAVE_BOOL
217 check_type_size("int" SIZEOF_INT)
218 check_type_size("long int" SIZEOF_LONG_INT)
219 check_type_size("long long int" SIZEOF_LONG_LONG_INT)
220 check_type_size("off_t" SIZEOF_OFF_T)
221 check_type_size("void *" SIZEOF_VOIDP)
223 if (CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
225 else (CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
226 set(GMX_64_BIT FALSE)
227 endif (CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
229 # Check for some basic types that we *need*, so set these to int if they are not present
230 check_type_size(uid_t uid_t)
237 check_type_size(gid_t gid_t)
244 check_type_size(size_t size_t)
251 check_type_size(off_t off_t)
258 include(TestBigEndian)
259 test_big_endian(GMX_INTEGER_BIG_ENDIAN)
264 ########################################################################
265 # Find external packages #
266 ########################################################################
268 find_package(LibXml2)
271 include_directories(${LIBXML2_INCLUDE_DIR})
272 set(PKG_XML libxml-2.0)
273 set(XML_LIBRARIES ${LIBXML2_LIBRARIES})
278 # X11 includes/libraries are only set in the ngmx subdirectory!
284 set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_THREADS")
286 set(THREAD_MPI_LIB thread_mpi)
288 string(TOUPPER ${GMX_FFT_LIBRARY} ${GMX_FFT_LIBRARY})
289 if(${GMX_FFT_LIBRARY} STREQUAL "FFTW2")
290 message(FATAL_ERROR "FFTW2 can't be used with threads. Try fftw3 or mkl.")
295 set(CUDA_BUILD_EMULATION OFF)
296 find_package(CUDA 3.1 REQUIRED)
297 add_definitions(-DGMX_OPENMM)
298 if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
299 set(CUDA_VERBOSE_BUILD ON)
305 find_library(ACCELERATE_FRAMEWORK Accelerate)
306 list(APPEND GMX_EXTRA_LIBRARIES ${ACCELERATE_FRAMEWORK})
309 # only bother with finding git and using version.h if the source is a git repo
310 if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
312 # We need at least git v1.5.1 be able to parse git's date output. If not
313 # fund or the version is too small, we can't generate version information.
314 find_package(Git 1.5.1)
315 # this should at some point become VERSION_LESS
316 if(NOT Git_FOUND OR Git_VERSION STRLESS "1.5.1")
317 message("No compatible git version found, won't be able to generate proper development version information.")
321 set(USE_VERSION_H OFF)
325 list(APPEND GMX_EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
328 ########################################################################
329 # Generate development version info for cache
330 ########################################################################
331 # set(GEN_VERSION_INFO_INTERNAL "ON")
332 # include(gmxGenerateVersionString)
334 ########################################################################
335 # Our own GROMACS tests
336 ########################################################################
338 add_definitions( -DHAVE_CONFIG_H )
339 include_directories(${CMAKE_BINARY_DIR}/src)
340 include_directories(${CMAKE_SOURCE_DIR}/include)
342 include(gmxCheckBuildUserTime)
343 gmx_check_build_user_time(BUILD_TIME BUILD_USER BUILD_MACHINE)
345 include(gmxTestFloatFormat)
346 gmx_test_float_format(GMX_FLOAT_FORMAT_IEEE754
347 GMX_IEEE754_BIG_ENDIAN_BYTE_ORDER
348 GMX_IEEE754_BIG_ENDIAN_WORD_ORDER)
350 include(gmxTestLargeFiles)
351 gmx_test_large_files(GMX_LARGEFILES)
352 check_function_exists(fseeko HAVE_FSEEKO)
354 include(gmxTestSignal)
355 gmx_test_retsigtype(RETSIGTYPE)
356 gmx_test_sigusr1(HAVE_SIGUSR1)
358 include(gmxTestInline)
359 gmx_test_inline(INLINE_KEYWORD)
361 include(gmxTestRestrict)
362 gmx_test_inline(RESTRICT_KEYWORD)
364 include(gmxTestPipes)
365 gmx_test_pipes(HAVE_PIPES)
367 include(gmxTestInlineASM)
368 gmx_test_inline_asm_gcc_x86(GMX_X86_GCC_INLINE_ASM)
369 gmx_test_inline_asm_msvc_x86(GMX_X86_MSVC_INLINE_ASM)
371 # turn on SSE if supported with reasonable defaults.
372 if (${GMX_ACCELERATION} STREQUAL "auto")
373 if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.86|x86|x64|x86_64|AMD64|amd64)")
375 set(GMX_ACCELERATION "SSE" CACHE STRING "Accelerated kernels. Pick one of: none, SSE, BlueGene, Power6, ia64, altivec" FORCE)
378 set(GMX_X86_64_ASM ON CACHE BOOL "Add SSE assembly files for x86_64" FORCE)
380 set(GMX_IA32_ASM ON CACHE BOOL "Add SSE assembly files for i386" FORCE)
383 # Determine the assembler/compiler to use
385 set(GMX_ACCELERATION "none" CACHE STRING "Accelerated kernels. Pick one of: none, SSE, BlueGene, Power6, ia64, altivec" FORCE)
387 endif (${GMX_ACCELERATION} STREQUAL "auto")
391 gmx_test_xdr(GMX_SYSTEM_XDR)
392 if(NOT GMX_SYSTEM_XDR)
393 set(GMX_INTERNAL_XDR 1)
394 set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_INTERNAL_XDR")
395 endif(NOT GMX_SYSTEM_XDR)
397 if(GMX_FORTRAN OR GMX_POWER6)
398 enable_language(Fortran)
399 include(FortranCInterface)
400 discover_fortran_mangling(prefix isupper suffix extra_under_score found)
401 if(extra_under_score)
403 endif(extra_under_score)
406 set(F77_FUNCDEF "${prefix} ## NAME ## ${suffix}")
407 set(F77_FUNCDEF_ "${prefix} ## NAME ## ${suffix}${extrasuffix}")
409 set(F77_FUNCDEF "${prefix} ## name ## ${suffix}")
410 set(F77_FUNCDEF_ "${prefix} ## name ## ${suffix}${extrasuffix}")
412 else(GMX_FORTRAN OR GMX_POWER6)
413 set(F77_FUNCDEF "name ## _")
414 set(F77_FUNCDEF_ "name ## _")
415 endif(GMX_FORTRAN OR GMX_POWER6)
418 # Process nonbonded accelerated kernels settings
419 string(TOUPPER ${GMX_ACCELERATION} ${GMX_ACCELERATION})
420 if(${GMX_ACCELERATION} STREQUAL "NONE")
422 elseif(${GMX_ACCELERATION} STREQUAL "SSE")
424 if(CMAKE_GENERATOR MATCHES "Visual Studio")
425 option(GMX_ASM_USEASM-NASM "Use Nasm for assembly instead of compiler (necessary on windows)" ON)
426 else(CMAKE_GENERATOR MATCHES "Visual Studio")
427 option(GMX_ASM_USEASM-NASM "Use Nasm for assembly instead of compiler (necessary on windows)" OFF)
428 endif(CMAKE_GENERATOR MATCHES "Visual Studio")
430 # for 32-bit compiles, we might need to turn on sse
431 CHECK_C_COMPILER_FLAG("-msse2" XFLAGS_SSE)
433 set(GROMACS_C_FLAGS "-msse2 ${GROMACS_C_FLAGS}")
435 CHECK_CXX_COMPILER_FLAG("-msse2" XXFLAGS_SSE)
437 set(GROMACS_CXX_FLAGS "-msse2 ${GROMACS_CXX_FLAGS}")
439 endif (NOT GMX_64_BIT)
447 elseif(GMX_X86_64_ASM)
449 set(GMX_X86_64_SSE2 1)
451 set(GMX_X86_64_SSE 1)
455 # if(HAVE_PMMINTRIN_H)
457 # endif(HAVE_PMMINTRIN_H)
458 # if(HAVE_SMMINTRIN_H)
460 # endif(HAVE_SMMINTRIN_H)
462 elseif(${GMX_ACCELERATION} STREQUAL "FORTRAN")
464 elseif(${GMX_ACCELERATION} STREQUAL "BLUEGENE")
466 elseif(${GMX_ACCELERATION} STREQUAL "POWER6")
468 elseif(${GMX_ACCELERATION} STREQUAL "IA64")
470 set(DISABLE_WATERWATER_NLIST 1)
471 set(DISABLE_WATER_NLIST 1)
472 elseif(${GMX_ACCELERATION} STREQUAL "ALTIVEC")
473 check_include_files(altivec.h HAVE_ALTIVEC_H)
475 set(GMX_PPC_ALTIVEC 1)
476 endif(HAVE_ALTIVEC_H)
477 else(${GMX_ACCELERATION} STREQUAL "NONE")
478 MESSAGE(FATAL_ERROR "Unrecognized option for accelerated kernels: ${GMX_ACCELERATION}. Pick one of none, SSE, Fortran, BlueGene, Power6, ia64, altivec")
479 endif(${GMX_ACCELERATION} STREQUAL "NONE")
487 # Process QM/MM Settings
488 string(TOUPPER ${GMX_QMMM_PROGRAM} ${GMX_QMMM_PROGRAM})
489 if(${GMX_QMMM_PROGRAM} STREQUAL "GAUSSIAN")
490 set(GMX_QMMM_GAUSSIAN 1)
491 elseif(${GMX_QMMM_PROGRAM} STREQUAL "MOPAC")
492 set(GMX_QMMM_MOPAC 1)
493 elseif(${GMX_QMMM_PROGRAM} STREQUAL "GAMESS")
494 set(GMX_QMMM_GAMESS 1)
495 elseif(${GMX_QMMM_PROGRAM} STREQUAL "ORCA")
497 elseif(${GMX_QMMM_PROGRAM} STREQUAL "NONE")
499 else(${GMX_QMMM_PROGRAM} STREQUAL "GAUSSIAN")
500 MESSAGE(FATAL_ERROR "Invalid QM/MM program option: ${GMX_QMMM_PROGRAM}. Choose one of: Gaussian, Mopac, Gamess, Orca, None")
501 endif(${GMX_QMMM_PROGRAM} STREQUAL "GAUSSIAN")
503 # Process FFT library settings - if not OpenMM build
504 string(TOUPPER ${GMX_FFT_LIBRARY} ${GMX_FFT_LIBRARY})
507 if(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
508 # MESSAGE(STATUS "Using external FFT library - fftw3")
510 find_package(FFTW3 REQUIRED)
511 include_directories(${FFTW3_INCLUDE_DIR})
512 set(FFT_LIBRARIES ${FFTW3_LIBRARIES})
515 find_package(FFTW3F REQUIRED)
516 include_directories(${FFTW3F_INCLUDE_DIR})
517 set(FFT_LIBRARIES ${FFTW3F_LIBRARIES})
518 set(PKG_FFT "fftw3f")
521 if(NOT FFTW3_FOUND AND NOT FFTW3F_FOUND)
522 MESSAGE(FATAL_ERROR "Cannot find fftw3 (with correct precision). Fix it, choose another FFT library, or use the Gromacs built-in fftpack (slower)!")
523 endif(NOT FFTW3_FOUND AND NOT FFTW3F_FOUND)
527 elseif(${GMX_FFT_LIBRARY} STREQUAL "FFTW2")
528 # MESSAGE(STATUS "Using external FFT library - fftw2")
530 find_package(FFTW2 REQUIRED)
532 find_package(FFTW2F REQUIRED)
536 MESSAGE(FATAL_ERROR "Cannot find fftw2 (with correct precision). Fix it, choose another FFT library, or use the Gromacs built-in fftpack (slower)!")
537 endif(NOT FFTW2_FOUND)
538 include_directories(${FFTW2_INCLUDE_DIR})
539 set(FFT_LIBRARIES ${FFTW2_LIBRARIES})
540 set(PKG_FFT_LIBS ${FFTW2_LIBRARIES})
542 if("${FFTW2_LIBRARIES}" MATCHES "dfftw")
543 set(FFTW2_NAME_DFFTW 1)
544 elseif("${FFTW2_LIBRARIES}" MATCHES "sfftw")
545 set(FFTW2_NAME_SFFTW 1)
546 else("${FFTW2_LIBRARIES}" MATCHES "dfftw")
547 set(FFTW2_NAME_FFTW 1)
548 endif("${FFTW2_LIBRARIES}" MATCHES "dfftw")
551 elseif(${GMX_FFT_LIBRARY} STREQUAL "MKL")
552 # MESSAGE(STATUS "Using external FFT library - Intel MKL")
553 find_package(MKL REQUIRED)
554 include_directories(${MKL_INCLUDE_DIR})
555 set(FFT_LIBRARIES ${MKL_LIBRARIES})
556 set(PKG_FFT_LIBS ${MKL_LIBRARIES})
561 #elseif(${GMX_FFT_LIBRARY} STREQUAL "ACML")
562 # MESSAGE(STATUS "Using external FFT library - AMD core math library")
563 # set(GMX_FFT_ACML 1)
564 elseif(${GMX_FFT_LIBRARY} STREQUAL "FFTPACK")
565 MESSAGE(STATUS "Using internal FFT library - fftpack")
566 set(GMX_FFT_FFTPACK 1)
567 else(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
568 MESSAGE(FATAL_ERROR "Invalid FFT library setting: ${GMX_FFT_LIBRARY}. Choose one of: fftw3, fftw2, mkl, acml, fftpack")
569 endif(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
571 # MKL has BLAS/LAPACK routines
572 if(HAVE_MKL OR ACCELERATE_FRAMEWORK)
573 set(GMX_EXTERNAL_BLAS TRUE CACHE BOOL "Use external BLAS instead of built-in")
574 set(GMX_EXTERNAL_LAPACK TRUE CACHE BOOL "Use external LAPACK instead of built-in")
575 else(HAVE_MKL OR ACCELERATE_FRAMEWORK)
576 set(GMX_EXTERNAL_BLAS FALSE CACHE BOOL "Use external LAPACK instead of built-in")
577 set(GMX_EXTERNAL_LAPACK FALSE CACHE BOOL "Use external LAPACK instead of built-in")
578 endif(HAVE_MKL OR ACCELERATE_FRAMEWORK)
580 # Math and thread libraries must often come after all others when linking...
582 list(APPEND GMX_EXTRA_LIBRARIES m)
588 set(COREWRAP_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/../corewrap" CACHE STRING
589 "Path to swindirect.h")
590 include_directories(${COREWRAP_INCLUDE_DIR})
593 # # # # # # # # # # NO MORE TESTS AFTER THIS LINE! # # # # # # # # # # #
594 # these are set after everything else
595 if (NOT DEFINED GROMACS_C_FLAGS_SET)
596 set(GROMACS_C_FLAGS_SET true CACHE INTERNAL "Whether to reset the C flags"
598 set(CMAKE_C_FLAGS "${GROMACS_C_FLAGS} ${CMAKE_C_FLAGS}" CACHE STRING
599 "Flags used by the compiler during all build types" FORCE)
600 set(CMAKE_CXX_FLAGS "${GROMACS_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" CACHE STRING
601 "Flags used by the compiler during all build types" FORCE)
602 set(CMAKE_EXE_LINKER_FLAGS
603 "${GROMACS_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}"
604 CACHE STRING "Linker flags" FORCE)
605 endif (NOT DEFINED GROMACS_C_FLAGS_SET)
607 ########################################################################
608 # Specify install locations and which subdirectories to process #
609 ########################################################################
610 set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
611 set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
612 set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/gromacs)
613 set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man)
614 set(INCL_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include)
616 set(GMXLIBDIR ${DATA_INSTALL_DIR}/top)
619 add_subdirectory(share)
620 add_subdirectory(include)
621 add_subdirectory(man)
622 add_subdirectory(src)
623 add_subdirectory(scripts)
625 #######################
627 #######################
629 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
630 "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
632 ###########################
633 ADD_CUSTOM_TARGET(uninstall
634 "${CMAKE_COMMAND}" -P
635 "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
636 ###########################
639 ########################################################################
641 ########################################################################
644 add_test(TestBuildAll make)
646 add_subdirectory(tests)