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.

37 lines
1.6 KiB

  1. find_package(GLPK QUIET)
  2. if(GLPK_FOUND)
  3. message (STATUS "Storm - Using system version of glpk.")
  4. else()
  5. message (STATUS "Storm - Using shipped version of glpk.")
  6. set(GLPK_LIB_DIR ${STORM_3RDPARTY_BINARY_DIR}/glpk-4.65/lib)
  7. # Set sysroot to circumvent problems in macOS "Mojave" (or higher) where the header files are no longer in /usr/include
  8. set(GLPK_INCLUDE_FLAGS "")
  9. if (CMAKE_OSX_SYSROOT)
  10. set(GLPK_INCLUDE_FLAGS "CPPFLAGS=--sysroot=${CMAKE_OSX_SYSROOT}")
  11. endif()
  12. ExternalProject_Add(glpk_ext
  13. DOWNLOAD_COMMAND ""
  14. PREFIX ${STORM_3RDPARTY_BINARY_DIR}/glpk-4.65
  15. SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/glpk-4.65
  16. CONFIGURE_COMMAND ${STORM_3RDPARTY_SOURCE_DIR}/glpk-4.65/configure --prefix=${STORM_3RDPARTY_BINARY_DIR}/glpk-4.65 --libdir=${GLPK_LIB_DIR} CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} ${GLPK_INCLUDE_FLAGS}
  17. BUILD_COMMAND make "CFLAGS=-O3 -w"
  18. INSTALL_COMMAND make install -j${STORM_RESOURCES_BUILD_JOBCOUNT}
  19. BUILD_IN_SOURCE 0
  20. LOG_CONFIGURE ON
  21. LOG_BUILD ON
  22. LOG_INSTALL ON
  23. BUILD_BYPRODUCTS ${GLPK_LIB_DIR}/libglpk${DYNAMIC_EXT} ${GLPK_LIB_DIR}/libglpk${STATIC_EXT}
  24. )
  25. set(GLPK_LIBRARIES ${GLPK_LIB_DIR}/libglpk${DYNAMIC_EXT})
  26. set(GLPK_INCLUDE_DIR ${STORM_3RDPARTY_BINARY_DIR}/glpk-4.65/include)
  27. set(GLPK_VERSION_STRING 4.65)
  28. add_dependencies(resources glpk_ext)
  29. endif()
  30. # Since there is a shipped version, always use GLPK
  31. set(STORM_HAVE_GLPK ON)
  32. message (STATUS "Storm - Linking with glpk ${GLPK_VERSION_STRING}")
  33. add_imported_library(glpk SHARED ${GLPK_LIBRARIES} ${GLPK_INCLUDE_DIR})
  34. list(APPEND STORM_DEP_TARGETS glpk_SHARED)