fftw.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ***** END GPL LICENSE BLOCK *****
  18. set(FFTW_EXTRA_ARGS)
  19. if(WIN32)
  20. set(FFTW3_ENV set CFLAGS=-fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-lto &&)
  21. set(FFTW3_PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/fftw3/src/external_fftw3 < ${PATCH_DIR}/fftw3.diff)
  22. endif()
  23. ExternalProject_Add(external_fftw3
  24. URL ${FFTW_URI}
  25. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  26. URL_HASH MD5=${FFTW_HASH}
  27. PREFIX ${BUILD_DIR}/fftw3
  28. CONFIGURE_COMMAND ${CONFIGURE_ENV} && ${FFTW3_ENV} cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && ${CONFIGURE_COMMAND} --enable-static --prefix=${mingw_LIBDIR}/fftw3
  29. PATCH_COMMAND ${FFTW3_PATCH_COMMAND}
  30. BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make -j${MAKE_THREADS}
  31. INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make install
  32. INSTALL_DIR ${LIBDIR}/fftw3
  33. )
  34. if(MSVC)
  35. set_target_properties(external_fftw3 PROPERTIES FOLDER Mingw)
  36. if(BUILD_MODE STREQUAL Release)
  37. ExternalProject_Add_Step(external_fftw3 after_install
  38. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.a ${HARVEST_TARGET}/fftw3/lib/libfftw.lib
  39. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/include/fftw3.h ${HARVEST_TARGET}/fftw3/include/fftw3.h
  40. DEPENDEES install
  41. )
  42. endif()
  43. endif()