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.

185 lines
5.0 KiB

2 months ago
  1. include(ExternalProject)
  2. set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/resources)
  3. add_custom_target(resources)
  4. ###############
  5. ##### Generic resource configuration
  6. ###############
  7. if("${CMAKE_GENERATOR}" MATCHES "Make")
  8. set(CMAKE_MAKE_PROGRAM "$(MAKE)")
  9. endif()
  10. # Make sure that libraries from /usr/lib et al are found before OSX frameworks
  11. set(CMAKE_FIND_FRAMEWORK "LAST")
  12. function(print_resource_info name target version)
  13. if(TARGET ${target})
  14. get_target_property(TYPE ${target} TYPE)
  15. if(TYPE STREQUAL "EXECUTABLE")
  16. get_target_property(PATH1 ${target} IMPORTED_LOCATION)
  17. elseif(TYPE STREQUAL "SHARED_LIBRARY")
  18. get_target_property(PATH1 ${target} INTERFACE_INCLUDE_DIRECTORIES)
  19. get_target_property(PATH2 ${target} IMPORTED_LOCATION)
  20. elseif(TYPE STREQUAL "STATIC_LIBRARY")
  21. get_target_property(PATH1 ${target} INTERFACE_INCLUDE_DIRECTORIES)
  22. get_target_property(PATH2 ${target} IMPORTED_LOCATION)
  23. elseif(TYPE STREQUAL "INTERFACE_LIBRARY")
  24. get_target_property(PATH1 ${target} INTERFACE_INCLUDE_DIRECTORIES)
  25. get_target_property(PATH2 ${target} INTERFACE_LINK_LIBRARIES)
  26. endif()
  27. if(PATH1 AND PATH2)
  28. message(STATUS "${name} ${version} was found at ${PATH1} and ${PATH2}")
  29. else()
  30. message(STATUS "${name} ${version} was found at ${PATH1}")
  31. endif()
  32. else()
  33. message(STATUS "${name} was not found.")
  34. endif()
  35. endfunction(print_resource_info)
  36. ###############
  37. ##### Process resource dependencies
  38. ###############
  39. if(USE_GINAC)
  40. set(USE_CLN_NUMBERS ON)
  41. endif()
  42. ###############
  43. ##### Load resources
  44. #####
  45. ##### Note that the resources may have dependencies among each other.
  46. ###############
  47. ##### GMP / GMPXX
  48. if((NOT FORCE_SHIPPED_RESOURCES) AND (NOT FORCE_SHIPPED_GMP))
  49. load_library(carl GMP 6.1)
  50. load_library(carl GMPXX 6.1)
  51. endif()
  52. if(NOT GMP_FOUND)
  53. set(GMP_VERSION "6.1.2")
  54. include(resources/gmp.cmake)
  55. endif()
  56. print_resource_info("GMP / GMPXX" GMP_SHARED ${GMP_VERSION})
  57. ##### Boost
  58. set(BOOST_COMPONENTS "filesystem;system;program_options;regex;unit_test_framework")
  59. set(Boost_USE_DEBUG_RUNTIME OFF)
  60. set(Boost_NO_BOOST_CMAKE ON)
  61. if(NOT FORCE_SHIPPED_RESOURCES)
  62. load_library(carl Boost 1.58 COMPONENTS ${BOOST_COMPONENTS})
  63. endif()
  64. if(NOT Boost_FOUND)
  65. set(Boost_VERSION "1.64.0")
  66. set(Boost_ZIPHASH "36093e4018aecd5b0e31e80457ac5fc1")
  67. include(resources/boost.cmake)
  68. unset(Boost_ZIPHASH)
  69. endif()
  70. print_resource_info("Boost" Boost_SHARED ${Boost_VERSION})
  71. ##### Eigen3
  72. if(NOT FORCE_SHIPPED_RESOURCES)
  73. load_library(carl EIGEN3 3.3)
  74. endif()
  75. if(NOT EIGEN3_FOUND)
  76. set(EIGEN3_VERSION "3.3.4")
  77. set(EIGEN3_ZIPHASH "e337acc279874bc6a56da4d973a723fb")
  78. include(resources/eigen3.cmake)
  79. unset(EIGEN3_ZIPHASH)
  80. endif()
  81. print_resource_info("Eigen3" EIGEN3 ${EIGEN3_VERSION})
  82. ##### bliss
  83. if(USE_BLISS)
  84. if(NOT FORCE_SHIPPED_RESOURCES)
  85. load_library(carl BLISS 0.73)
  86. endif()
  87. if(NOT BLISS_FOUND)
  88. set(BLISS_VERSION "0.73")
  89. include(resources/bliss.cmake)
  90. endif()
  91. print_resource_info("Bliss" BLISS_SHARED ${BLISS_VERSION})
  92. else()
  93. message(STATUS "Bliss is disabled")
  94. endif()
  95. ##### CLN
  96. if(USE_CLN_NUMBERS)
  97. if(NOT FORCE_SHIPPED_RESOURCES)
  98. load_library(carl CLN 1.3)
  99. endif()
  100. if(NOT CLN_FOUND)
  101. set(CLN_VERSION "1.3.4")
  102. include(resources/cln.cmake)
  103. endif()
  104. set_target_properties(CLN_STATIC PROPERTIES LINK_INTERFACE_LIBRARIES "GMP_STATIC")
  105. print_resource_info("CLN" CLN_SHARED ${CLN_VERSION})
  106. else()
  107. message(STATUS "CLN is disabled")
  108. endif()
  109. ##### CoCoALib
  110. if(USE_COCOA)
  111. if(NOT FORCE_SHIPPED_RESOURCES)
  112. load_library(carl CoCoA 0.99564)
  113. endif()
  114. if(NOT COCOA_FOUND)
  115. set(COCOA_VERSION "0.99564")
  116. set(COCOA_TGZHASH "1cfc3b6ff549ea01e1bffaf3bc9600a8")
  117. include(resources/cocoa.cmake)
  118. unset(COCOA_TGZHASH)
  119. endif()
  120. print_resource_info("CoCoA" COCOA_SHARED ${COCOA_VERSION})
  121. else()
  122. message(STATUS "CoCoA is disabled")
  123. endif()
  124. ##### GiNaC
  125. if(USE_GINAC)
  126. if(NOT FORCE_SHIPPED_RESOURCES)
  127. load_library(carl GINAC 1.6.2)
  128. endif()
  129. if(NOT GINAC_FOUND)
  130. set(GINAC_VERSION "1.7.2")
  131. include(resources/ginac.cmake)
  132. endif()
  133. print_resource_info("GiNaC" GINAC_SHARED ${GINAC_VERSION})
  134. else()
  135. message(STATUS "GiNaC is disabled")
  136. endif()
  137. ##### GTest
  138. if(NOT GTEST_FOUND)
  139. set(GTEST_VERSION "1.8.0")
  140. set(GTEST_ZIPHASH "adfafc8512ab65fd3cf7955ef0100ff5")
  141. include(resources/gtest.cmake)
  142. unset(GTEST_ZIPHASH)
  143. endif()
  144. print_resource_info("GTest" GTESTMAIN_STATIC ${GTEST_VERSION})
  145. ##### MPFR
  146. IF(USE_MPFR_FLOAT)
  147. load_library(carl MPFR 0.0 REQUIRED)
  148. endif()
  149. ##### Z3
  150. if(COMPARE_WITH_Z3)
  151. load_library(carl Z3 4.0)
  152. endif()
  153. ##### Doxygen
  154. find_package(Doxygen 1.8.9 QUIET)
  155. if(DOXYGEN_FOUND AND ${CMAKE_VERSION} VERSION_LESS "3.9.0")
  156. add_executable(Doxygen::doxygen IMPORTED GLOBAL)
  157. set_target_properties(Doxygen::doxygen PROPERTIES IMPORTED_LOCATION "${DOXYGEN_EXECUTABLE}")
  158. endif()
  159. if(NOT DOXYGEN_FOUND AND BUILD_DOXYGEN)
  160. set(DOXYGEN_VERSION "1.8.14")
  161. include(resources/doxygen.cmake)
  162. add_custom_target(doxygen-build DEPENDS Doxygen::doxygen Doxygen-EP)
  163. else()
  164. add_custom_target(doxygen-build DEPENDS Doxygen::doxygen)
  165. endif()
  166. print_resource_info("Doxygen" Doxygen::doxygen "${DOXYGEN_VERSION}")