You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
2.3 KiB

3 months ago
  1. if(UNIX)
  2. find_program(M4 m4)
  3. if(NOT M4)
  4. message(FATAL_ERROR "Can not build gmp, missing binary for m4")
  5. endif()
  6. mark_as_advanced(M4)
  7. ExternalProject_Add(
  8. GMP-EP
  9. URL "https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.bz2"
  10. URL_MD5 8ddbb26dc3bd4e2302984debba1406a5
  11. DOWNLOAD_NO_PROGRESS 1
  12. BUILD_IN_SOURCE YES
  13. CONFIGURE_COMMAND ./configure --enable-cxx --prefix=<INSTALL_DIR>
  14. )
  15. elseif(WIN32)
  16. ExternalProject_Add(
  17. GMP-EP
  18. URL "http://mpir.org/mpir-3.0.0.zip"
  19. URL_MD5 0ac60c2e6e183d401d1f876ca177cdb7
  20. DOWNLOAD_NO_PROGRESS 1
  21. CONFIGURE_COMMAND ""
  22. BUILD_IN_SOURCE YES
  23. BUILD_COMMAND cd build.vc15
  24. COMMAND ./msbuild.bat gc dll x64 RELEASE
  25. COMMAND ./msbuild.bat gc dll x64 DEBUG
  26. COMMAND ./msbuild.bat gc lib x64 RELEASE
  27. COMMAND ./msbuild.bat gc lib x64 DEBUG
  28. INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/lib
  29. COMMAND ${CMAKE_COMMAND} -E make_directory <INSTALL_DIR>/include
  30. COMMAND cp <SOURCE_DIR>/dll/x64/${CMAKE_BUILD_TYPE}/mpir${DYNAMIC_EXT} <INSTALL_DIR>/lib/gmp${DYNAMIC_EXT}
  31. COMMAND cp <SOURCE_DIR>/dll/x64/${CMAKE_BUILD_TYPE}/mpir${DYNAMIC_EXT} <INSTALL_DIR>/lib/gmpxx${DYNAMIC_EXT}
  32. COMMAND cp <SOURCE_DIR>/dll/x64/${CMAKE_BUILD_TYPE}/mpir.h <INSTALL_DIR>/include/mpir.h
  33. COMMAND cp <SOURCE_DIR>/dll/x64/${CMAKE_BUILD_TYPE}/mpirxx.h <INSTALL_DIR>/include/gmpxx.h
  34. COMMAND cp <SOURCE_DIR>/lib/x64/${CMAKE_BUILD_TYPE}/mpir${STATIC_EXT} <INSTALL_DIR>/lib/gmp${STATIC_EXT}
  35. COMMAND cp <SOURCE_DIR>/lib/x64/${CMAKE_BUILD_TYPE}/mpirxx${STATIC_EXT} <INSTALL_DIR>/lib/gmpxx${STATIC_EXT}
  36. )
  37. endif()
  38. ExternalProject_Get_Property(GMP-EP INSTALL_DIR)
  39. add_imported_library(GMP SHARED "${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}gmp${DYNAMIC_EXT}" "${INSTALL_DIR}/include")
  40. add_imported_library(GMP STATIC "${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gmp${STATIC_EXT}" "${INSTALL_DIR}/include")
  41. add_imported_library(GMPXX SHARED "${INSTALL_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}gmpxx${DYNAMIC_EXT}" "${INSTALL_DIR}/include")
  42. add_imported_library(GMPXX STATIC "${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gmpxx${STATIC_EXT}" "${INSTALL_DIR}/include")
  43. add_dependencies(GMP_SHARED GMP-EP)
  44. add_dependencies(GMP_STATIC GMP-EP)
  45. add_dependencies(GMPXX_SHARED GMP-EP)
  46. add_dependencies(GMPXX_STATIC GMP-EP)
  47. add_dependencies(resources GMP_SHARED GMP_STATIC GMPXX_SHARED GMPXX_STATIC)