MPFR.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/mpfr)
  2. set(_dstdir ${${PROJECT_NAME}_DEP_INSTALL_PREFIX})
  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. message(STATUS "${PROJECT_NAME}_DEP_INSTALL_PREFIX=${${PROJECT_NAME}_DEP_INSTALL_PREFIX}")
  23. ExternalProject_Add(dep_MPFR
  24. EXCLUDE_FROM_ALL ON
  25. #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
  26. #URL_HASH SHA256=cf4f4b2d80abb79e820e78c8077b6725bbbb4e8f41896783c899087be0e94068
  27. URL https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.bz2
  28. URL_HASH SHA256=b9df93635b20e4089c29623b19420c4ac848a1b29df1cfd59f26cab0d2666aa0
  29. DOWNLOAD_DIR ${${PROJECT_NAME}_DEP_DOWNLOAD_DIR}/MPFR
  30. BUILD_IN_SOURCE ON
  31. CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${${PROJECT_NAME}_DEP_INSTALL_PREFIX} --enable-shared=no --enable-static=yes --with-gmp=${${PROJECT_NAME}_DEP_INSTALL_PREFIX} ${_gmp_build_tgt}
  32. BUILD_COMMAND make -j
  33. INSTALL_COMMAND make install
  34. )
  35. endif ()
  36. set(DEP_MPFR_DEPENDS GMP)