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.

82 lines
3.2 KiB

3 months ago
  1. ####
  2. #### Find autoreconf for cudd update step
  3. find_program(AUTORECONF autoreconf)
  4. find_program(ACLOCAL aclocal)
  5. mark_as_advanced(AUTORECONF)
  6. mark_as_advanced(ACLOCAL)
  7. if (NOT AUTORECONF)
  8. message(FATAL_ERROR "Cannot find autoreconf, cannot compile cudd3.")
  9. endif()
  10. if (NOT ACLOCAL)
  11. message(FATAL_ERROR "Cannot find aclocal, cannot compile cudd3.")
  12. endif()
  13. set(CUDD_LIB_DIR ${STORM_3RDPARTY_BINARY_DIR}/cudd-3.0.0/lib)
  14. # create CUDD compilation flags
  15. if (NOT STORM_DEBUG_CUDD)
  16. set(STORM_CUDD_FLAGS "-O3")
  17. else()
  18. message(WARNING "Building CUDD in DEBUG mode.")
  19. set(STORM_CUDD_FLAGS "-O0 -g")
  20. endif()
  21. set(STORM_CUDD_FLAGS "CFLAGS=${STORM_CUDD_FLAGS} -w -DPIC -DHAVE_IEEE_754 -fno-common -ffast-math -fno-finite-math-only")
  22. if (NOT STORM_PORTABLE)
  23. set(STORM_CUDD_FLAGS "${STORM_CUDD_FLAGS} -march=native")
  24. endif()
  25. # Set sysroot to circumvent problems in macOS "Mojave" (or higher) where the header files are no longer in /usr/include
  26. set(CUDD_INCLUDE_FLAGS "")
  27. if (CMAKE_OSX_SYSROOT)
  28. set(CUDD_INCLUDE_FLAGS "CPPFLAGS=--sysroot=${CMAKE_OSX_SYSROOT}")
  29. endif()
  30. set(CUDD_CXX_COMPILER "${CMAKE_CXX_COMPILER}")
  31. if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
  32. if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12.0.0.12000032)
  33. if (CMAKE_HOST_SYSTEM_VERSION VERSION_GREATER_EQUAL 20.1.0)
  34. message(WARNING "There are some known issues compiling CUDD on some setups. We implemented a workaround that mostly works, but if you still have problems compiling CUDD, especially if you do not use the default compiler of your system, please contact the Storm developers.")
  35. # The issue is known to occur using the Command Line Tools for XCode 12.2. Apparently, it is fixed in the beta for XCode 12.3.
  36. set(CUDD_CXX_COMPILER "c++")
  37. endif()
  38. endif()
  39. endif()
  40. ExternalProject_Add(
  41. cudd3
  42. DOWNLOAD_COMMAND ""
  43. SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/cudd-3.0.0
  44. PREFIX ${STORM_3RDPARTY_BINARY_DIR}/cudd-3.0.0
  45. PATCH_COMMAND ${AUTORECONF}
  46. CONFIGURE_COMMAND ${STORM_3RDPARTY_SOURCE_DIR}/cudd-3.0.0/configure --enable-shared --enable-obj --with-pic=yes --prefix=${STORM_3RDPARTY_BINARY_DIR}/cudd-3.0.0 --libdir=${CUDD_LIB_DIR} CC=${CMAKE_C_COMPILER} CXX=${CUDD_CXX_COMPILER} ${CUDD_INCLUDE_FLAGS}
  47. BUILD_COMMAND make ${STORM_CUDD_FLAGS}
  48. INSTALL_COMMAND make install -j${STORM_RESOURCES_BUILD_JOBCOUNT}
  49. BUILD_IN_SOURCE 0
  50. LOG_CONFIGURE ON
  51. LOG_BUILD ON
  52. LOG_INSTALL ON
  53. BUILD_BYPRODUCTS ${CUDD_LIB_DIR}/libcudd${DYNAMIC_EXT} ${CUDD_LIB_DIR}/libcudd${STATIC_EXT}
  54. )
  55. # Do not use system CUDD, StoRM has a modified version
  56. set(CUDD_INCLUDE_DIR ${STORM_3RDPARTY_BINARY_DIR}/cudd-3.0.0/include)
  57. set(CUDD_SHARED_LIBRARY ${CUDD_LIB_DIR}/libcudd${DYNAMIC_EXT})
  58. set(CUDD_STATIC_LIBRARY ${CUDD_LIB_DIR}/libcudd${STATIC_EXT})
  59. set(CUDD_VERSION_STRING 3.0.0)
  60. add_imported_library(cudd SHARED ${CUDD_SHARED_LIBRARY} ${CUDD_INCLUDE_DIR})
  61. add_imported_library(cudd STATIC ${CUDD_STATIC_LIBRARY} ${CUDD_INCLUDE_DIR})
  62. add_dependencies(resources cudd3)
  63. if(BUILD_SHARED_LIBS)
  64. list(APPEND STORM_DEP_TARGETS cudd_SHARED)
  65. else()
  66. list(APPEND STORM_DEP_TARGETS cudd_STATIC)
  67. endif()
  68. message(STATUS "Storm - Linking with CUDD ${CUDD_VERSION_STRING}.")