MPFR.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/mpfr)
  2. set(_dstdir ${DESTDIR}/usr/local)
  3. if (MSVC)
  4. set(_output ${_dstdir}/include/mpfr.h
  5. ${_dstdir}/include/mpf2mpfr.h
  6. ${_dstdir}/lib/libmpfr-4.lib
  7. ${_dstdir}/bin/libmpfr-4.dll)
  8. add_custom_command(
  9. OUTPUT ${_output}
  10. COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpfr.h ${_dstdir}/include/
  11. COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpf2mpfr.h ${_dstdir}/include/
  12. COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.lib ${_dstdir}/lib/
  13. COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.dll ${_dstdir}/bin/
  14. )
  15. add_custom_target(dep_MPFR SOURCES ${_output})
  16. else ()
  17. set(_cross_compile_arg "")
  18. if (CMAKE_CROSSCOMPILING)
  19. # TOOLCHAIN_PREFIX should be defined in the toolchain file
  20. set(_cross_compile_arg --host=${TOOLCHAIN_PREFIX})
  21. endif ()
  22. ExternalProject_Add(dep_MPFR
  23. URL http://ftp.vim.org/ftp/gnu/mpfr/mpfr-3.1.6.tar.bz2 https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 # mirrors are allowed
  24. URL_HASH SHA256=cf4f4b2d80abb79e820e78c8077b6725bbbb4e8f41896783c899087be0e94068
  25. DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/MPFR
  26. BUILD_IN_SOURCE ON
  27. CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt}
  28. BUILD_COMMAND make -j
  29. INSTALL_COMMAND make install
  30. ${_cmake_args_osx_arch}
  31. DEPENDS dep_GMP
  32. )
  33. endif ()