From 9d2f4ace081dd3e24fae81d42e4d2971dfae996a Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Wed, 7 Dec 2016 22:15:17 +0100 Subject: [PATCH] additional dependent targets as imported libs created --- resources/3rdparty/CMakeLists.txt | 60 ++++++++++++-------- resources/3rdparty/include_cpptemplate.cmake | 4 +- resources/3rdparty/include_cudd.cmake | 2 +- src/storm/CMakeLists.txt | 3 +- 4 files changed, 41 insertions(+), 28 deletions(-) diff --git a/resources/3rdparty/CMakeLists.txt b/resources/3rdparty/CMakeLists.txt index 632c7a56d..7c4f23c93 100644 --- a/resources/3rdparty/CMakeLists.txt +++ b/resources/3rdparty/CMakeLists.txt @@ -4,14 +4,6 @@ add_custom_target(test-resources) set(STORM_3RDPARTY_SOURCE_DIR ${PROJECT_SOURCE_DIR}/resources/3rdparty) set(STORM_3RDPARTY_BINARY_DIR ${PROJECT_BINARY_DIR}/resources/3rdparty) -if (STORM_PYTHON) - find_package(PythonInterp 3 REQUIRED QUIET) - find_package(PythonLibs 3 REQUIRED QUIET) - - message(STATUS "Python executable: ${PYTHON_EXECUTABLE}") - message(STATUS "Python include: ${PYTHON_INCLUDE_DIRS}") - message(STATUS "Python include: ${PYTHON_LIBRARIES}") -endif() ############################################################# ## @@ -200,35 +192,56 @@ if(USE_CARL) message(STATUS "Storm - Linking with carl ${carl_VERSION} (CARL_USE_CLN_NUMBERS: ${CARL_USE_CLN_NUMBERS}).") set(STORM_HAVE_CLN ${CARL_USE_CLN_NUMBERS}) else() + # The first external project will be built at *configure stage* + message("START CARL CONFIG PROCESS") + file(MAKE_DIRECTORY ${STORM_3RDPARTY_BINARY_DIR}/carl_download) + execute_process( + COMMAND ${CMAKE_COMMAND} ${STORM_3RDPARTY_SOURCE_DIR}/carl "-DSTORM_3RDPARTY_BINARY_DIR=${STORM_3RDPARTY_BINARY_DIR}" + WORKING_DIRECTORY ${STORM_3RDPARTY_BINARY_DIR}/carl_download + OUTPUT_VARIABLE carlconfig_out + RESULT_VARIABLE carlconfig_result + ) + + + if(NOT carlconfig_result) + message("${carlconfig_out}") + endif() + execute_process( + COMMAND ${CMAKE_COMMAND} --build . --target carl-config + WORKING_DIRECTORY ${STORM_3RDPARTY_BINARY_DIR}/carl_download + OUTPUT_VARIABLE carlconfig_out + RESULT_VARIABLE carlconfig_result + ) + if(NOT carlconfig_result) + message("${carlconfig_out}") + endif() + message("END CARL CONFIG PROCESS") + message(STATUS "Storm - Using shipped version of carl.") set(CARL_BUILD_COMMAND make lib_carl) - if(STORM_PYTHON) - set(CARL_BUILD_COMMAND ${CARL_BUILD_COMMAND} PythonBindingsDevelop) - endif() ExternalProject_Add( carl - GIT_REPOSITORY https://github.com/smtrat/carl - GIT_TAG master - INSTALL_DIR ${STORM_3RDPARTY_BINARY_DIR}/carl - SOURCE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/carl - CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DBOOST_INCLUDEDIR=${Boost_INCLUDE_DIRS} -DBOOST_LIBRARYDIR=${Boost_LIBRARY_DIRS} -DBoost_NO_SYSTEM_PATHS=1 -DEXPORT_TO_CMAKE=0 -DUSE_CLN_NUMBERS=1 -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=1 -DCMAKE_INSTALL_PREFIX:PATH=${STORM_3RDPARTY_BINARY_DIR}/carl - BUILD_IN_SOURCE 0 - BUILD_COMMAND ${CARL_BUILD_COMMAND} + SOURCE_DIR ${STORM_3RDPARTY_BINARY_DIR}/carl + CONFIGURE_COMMAND "" + BUILD_IN_SOURCE 1 + BUILD_COMMAND make lib_carl INSTALL_COMMAND "" - LOG_UPDATE ON - LOG_CONFIGURE ON LOG_BUILD ON BUILD_BYPRODUCTS ${STORM_3RDPARTY_BINARY_DIR}/carl/lib/libcarl${DYNAMIC_EXT} ) include(${STORM_3RDPARTY_BINARY_DIR}/carl/carlConfig.cmake) message("CARL_USE_CLN_NUMBERS: ${CARL_USE_CLN_NUMBERS}") set(STORM_HAVE_CLN ${CARL_USE_CLN_NUMBERS}) - add_dependencies(resources carl) - set(carl_INCLUDE_DIR "${STORM_3RDPARTY_BINARY_DIR}/carl/include") + add_dependencies(resources carl) + set(carl_INCLUDE_DIR "${STORM_3RDPARTY_BINARY_DIR}/carl/build/include") set(STORM_HAVE_CARL ON) endif() + if(STORM_USE_CLN_NUMBERS AND NOT STORM_HAVE_CLN) + message(FATAL_ERROR "Cannot use CLN numbers if carl is build without") + endif() + + list(APPEND STORM_DEP_IMP_TARGETS lib_carl) - list(APPEND STORM_DEP_TARGETS lib_carl) endif() @@ -355,6 +368,7 @@ if(${OPERATING_SYSTEM} MATCHES "Linux") if(HWLOC_FOUND) message(STATUS "Storm - Linking with hwloc ${HWLOC_VERSION}.") add_imported_library(hwloc "" ${Hwloc_LIBRARIES}) + list(APPEND STORM_DEP_TARGETS hwloc) else() message(FATAL_ERROR "HWLOC is required but was not found.") endif() diff --git a/resources/3rdparty/include_cpptemplate.cmake b/resources/3rdparty/include_cpptemplate.cmake index 138965f15..e6f341b31 100644 --- a/resources/3rdparty/include_cpptemplate.cmake +++ b/resources/3rdparty/include_cpptemplate.cmake @@ -22,8 +22,8 @@ ExternalProject_Add( set(CPPTEMPLATE_INCLUDE_DIR ${STORM_3RDPARTY_SOURCE_DIR}/cpptemplate) set(CPPTEMPLATE_STATIC_LIBRARY ${STORM_3RDPARTY_BINARY_DIR}/cpptemplate/cpptemplate${STATIC_EXT}) -list(APPEND STORM_LINK_LIBRARIES ${CPPTEMPLATE_STATIC_LIBRARY}) add_dependencies(resources cpptemplate) message(STATUS "Storm - Linking with cpptemplate.") -include_directories(${CPPTEMPLATE_INCLUDE_DIR}) +add_imported_library(cpptempl STATIC ${CPPTEMPLATE_STATIC_LIBRARY} ${CPPTEMPLATE_INCLUDE_DIR}) +list(APPEND STORM_DEP_TARGETS cpptempl_STATIC) \ No newline at end of file diff --git a/resources/3rdparty/include_cudd.cmake b/resources/3rdparty/include_cudd.cmake index b08adfdc6..731758830 100644 --- a/resources/3rdparty/include_cudd.cmake +++ b/resources/3rdparty/include_cudd.cmake @@ -46,7 +46,7 @@ add_dependencies(resources cudd3) if(BUILD_SHARED_LIBS) list(APPEND STORM_DEP_TARGETS cudd_SHARED) else() - list(APPEND STORM_LINK_LIBRARIES cudd_STATIC) + list(APPEND STORM_DEP_TARGETS cudd_STATIC) endif() message(STATUS "Storm - Linking with CUDD ${CUDD_VERSION_STRING}.") \ No newline at end of file diff --git a/src/storm/CMakeLists.txt b/src/storm/CMakeLists.txt index d3bed9c52..4fba35749 100644 --- a/src/storm/CMakeLists.txt +++ b/src/storm/CMakeLists.txt @@ -39,8 +39,7 @@ add_library(storm SHARED ${STORM_LIB_SOURCES} ${STORM_LIB_HEADERS}) # Remove define symbol for shared libstorm. set_target_properties(storm PROPERTIES DEFINE_SYMBOL "") add_dependencies(storm resources) -message("STORM_DEP_TARGETS: ${STORM_DEP_TARGETS}") -target_link_libraries(storm PUBLIC ${STORM_DEP_TARGETS} ${STORM_LINK_LIBRARIES}) +target_link_libraries(storm PUBLIC ${STORM_DEP_TARGETS} ${STORM_DEP_IMP_TARGETS} ${STORM_LINK_LIBRARIES}) list(APPEND STORM_TARGETS storm) set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE)