From 50b9000d1d73aa9217c99bf1ff6e151f190f7f4b Mon Sep 17 00:00:00 2001 From: Mark Abraham Date: Thu, 14 May 2015 11:29:27 +0200 Subject: [PATCH] Fix own-FFTW build Recent changes broke the expectation that the own-FFTW build attempts to pretend to have run SIMD-support tests on the build that it has not yet performed. This is all more complicated than it needs to be, and will be refactored in master branch. Fixes #1735 Change-Id: I9e5f296b199b6b5af685fa2ba87cc962a41a251f --- cmake/gmxManageFFTLibraries.cmake | 6 ++++++ src/contrib/fftw/CMakeLists.txt | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cmake/gmxManageFFTLibraries.cmake b/cmake/gmxManageFFTLibraries.cmake index bc66a18d92..f8fcc47b16 100644 --- a/cmake/gmxManageFFTLibraries.cmake +++ b/cmake/gmxManageFFTLibraries.cmake @@ -65,6 +65,12 @@ if(${GMX_FFT_LIBRARY} STREQUAL "FFTW3") set(FFTW fftwf) endif() + # Note that these calls are expected to function the same way, + # particularly with respect to setting CMake variables that + # record the presence of particular FFTW SIMD support. + # TODO There is no need for this requirement, all the remaining + # code here can be refactored to have just one check of + # GMX_BUILD_OWN_FFTW, which simplifies both code paths. if(GMX_BUILD_OWN_FFTW) add_subdirectory(src/contrib/fftw) else() diff --git a/src/contrib/fftw/CMakeLists.txt b/src/contrib/fftw/CMakeLists.txt index c7d7298952..2ad1501c68 100644 --- a/src/contrib/fftw/CMakeLists.txt +++ b/src/contrib/fftw/CMakeLists.txt @@ -1,7 +1,7 @@ # # This file is part of the GROMACS molecular simulation package. # -# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by +# Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, # and including many others, as listed in the AUTHORS file in the # top-level source directory and at http://www.gromacs.org. @@ -40,6 +40,9 @@ # Input: FFTW variable contains the FFTW component to build, # either fftw or fftwf for double or single precision +string(TOUPPER "${FFTW}" UPPERFFTW) +string(TOLOWER "${FFTW}" LOWERFFTW) + set(GMX_BUILD_OWN_FFTW_OPTIMIZATION_CONFIGURATION "" CACHE INTERNAL "Optimization flags for FFTW compilation") if(${CMAKE_CURRENT_BINARY_DIR} MATCHES ".*[[:space:]].*") message(FATAL_ERROR "An internal limitation of FFTW means GROMACS cannot build FFTW in a directory with whitespace in its name. Either use a system FFTW, build it yourself, or build GROMACS in a different location.") @@ -58,6 +61,9 @@ endif() # Testing shows FFTW configured with --enable-avx is never better than --enable-sse2, so we do the latter always. if(${GMX_SIMD} MATCHES "^(SSE|AVX)") set(GMX_BUILD_OWN_FFTW_OPTIMIZATION_CONFIGURATION --enable-sse2 CACHE INTERNAL "Optimization flags for FFTW compilation") + # Fake the result of the SIMD test, so the checks for x86 SIMD + # suport are silent + set(${UPPERFFTW}_HAVE_SSE2 TRUE PARENT_SCOPE) endif() # Allow cross-compiles @@ -117,12 +123,11 @@ endif() ExternalProject_get_property(${EXTERNAL_FFTW_BUILD_TARGET} INSTALL_DIR) -string(TOUPPER "${FFTW}" UPPERFFTW) -string(TOLOWER "${FFTW}" LOWERFFTW) string(REGEX REPLACE "fftw" "fftw3" FFTW_LIBNAME ${LOWERFFTW}) set(${UPPERFFTW}_LIBRARIES ${INSTALL_DIR}/lib/lib${FFTW_LIBNAME}${CMAKE_STATIC_LIBRARY_SUFFIX}) set(${UPPERFFTW}_INCLUDE_DIRS ${INSTALL_DIR}/include PARENT_SCOPE) set(${UPPERFFTW}_FOUND TRUE PARENT_SCOPE) +# TODO This is only true on x86, but does not actually cause a problem set(${UPPERFFTW}_HAVE_SIMD TRUE PARENT_SCOPE) add_library(gmxfftw STATIC IMPORTED GLOBAL) -- 2.22.0