This PR refactors the contrib script to download SymFPU to a cmake external project.
if: steps.restore-deps.outputs.cache-hit != 'true'
run: |
./contrib/get-poly
- ./contrib/get-symfpu
./contrib/get-cadical
./contrib/get-cryptominisat
./contrib/get-lfsc-checker
## directory for licensing information.
##
# Find SymFPU
-# SymFPU_FOUND - system has SymFPU lib
-# SymFPU_INCLUDE_DIR - the SymFPU include directory
+# SymFPU_FOUND - should always be true
+# SymFPU - interface target for the SymFPU headers
find_path(SymFPU_INCLUDE_DIR NAMES symfpu/core/unpackedFloat.h)
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(SymFPU DEFAULT_MSG SymFPU_INCLUDE_DIR)
+if(SymFPU_INCLUDE_DIR)
+ # Found SymFPU to be installed system-wide
+ set(SymFPU_FOUND_SYSTEM TRUE)
+else()
+ set(SymFPU_FOUND_SYSTEM FALSE)
+ include(ExternalProject)
+ include(deps-helper)
+ set(SymFPU_COMMIT "8fbe139bf0071cbe0758d2f6690a546c69ff0053")
+
+ ExternalProject_Add(
+ SymFPU-EP
+ PREFIX ${DEPS_PREFIX}
+ URL https://github.com/martin-cs/symfpu/archive/${SymFPU_COMMIT}.tar.gz
+ URL_HASH SHA1=9e00045130b93e3c2a46ce73a1b5b6451340dc46
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/core
+ <INSTALL_DIR>/include/symfpu/core
+ COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/utils
+ <INSTALL_DIR>/include/symfpu/utils
+ )
+
+ set(SymFPU_INCLUDE_DIR "${DEPS_BASE}/include/")
+endif()
+
+set(SymFPU_FOUND TRUE)
+
+add_library(SymFPU INTERFACE IMPORTED GLOBAL)
+set_target_properties(
+ SymFPU PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SymFPU_INCLUDE_DIR}"
+)
+
+mark_as_advanced(SymFPU_FOUND)
+mark_as_advanced(SymFPU_FOUND_SYSTEM)
mark_as_advanced(SymFPU_INCLUDE_DIR)
+
+if(SymFPU_FOUND_SYSTEM)
+ message(STATUS "Found SymFPU: ${SymFPU_INCLUDE_DIR}")
+else()
+ message(STATUS "Building SymFPU: ${SymFPU_INCLUDE_DIR}")
+ add_dependencies(SymFPU SymFPU-EP)
+endif()
+++ /dev/null
-#!/usr/bin/env bash
-#
-source "$(dirname "$0")/get-script-header.sh"
-
-SYMFPU_DIR="$DEPS_DIR/symfpu-CVC4"
-commit="8fbe139bf0071cbe0758d2f6690a546c69ff0053"
-
-setup_dep \
- "https://github.com/martin-cs/symfpu/archive/$commit.tar.gz" "$SYMFPU_DIR"
-cd "$SYMFPU_DIR"
-install_includes core symfpu
-install_includes utils symfpu
-
-echo
-echo "Using symfpu commit $commit"
-echo
-echo ===================== Now configure CVC4 with =====================
-echo ./configure.sh --symfpu
target_include_directories(cvc4 PRIVATE ${Valgrind_INCLUDE_DIR})
endif()
if(USE_ABC)
- target_link_libraries(cvc4 ${ABC_LIBRARIES})
+ target_link_libraries(cvc4 PRIVATE ${ABC_LIBRARIES})
target_include_directories(cvc4 PRIVATE ${ABC_INCLUDE_DIR})
endif()
if(USE_CADICAL)
- target_link_libraries(cvc4 ${CaDiCaL_LIBRARIES})
+ target_link_libraries(cvc4 PRIVATE ${CaDiCaL_LIBRARIES})
target_include_directories(cvc4 PRIVATE ${CaDiCaL_INCLUDE_DIR})
endif()
if(USE_CLN)
- target_link_libraries(cvc4 ${CLN_LIBRARIES})
- target_include_directories(cvc4 PUBLIC $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
+ target_link_libraries(cvc4 PRIVATE ${CLN_LIBRARIES})
+ target_include_directories(cvc4 PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
endif()
if(USE_CRYPTOMINISAT)
- target_link_libraries(cvc4 ${CryptoMiniSat_LIBRARIES})
+ target_link_libraries(cvc4 PRIVATE ${CryptoMiniSat_LIBRARIES})
target_include_directories(cvc4 PRIVATE ${CryptoMiniSat_INCLUDE_DIR})
endif()
if(USE_KISSAT)
- target_link_libraries(cvc4 ${Kissat_LIBRARIES})
+ target_link_libraries(cvc4 PRIVATE ${Kissat_LIBRARIES})
target_include_directories(cvc4 PRIVATE ${Kissat_INCLUDE_DIR})
endif()
if(USE_GLPK)
- target_link_libraries(cvc4 ${GLPK_LIBRARIES})
+ target_link_libraries(cvc4 PRIVATE ${GLPK_LIBRARIES})
target_include_directories(cvc4 PRIVATE ${GLPK_INCLUDE_DIR})
endif()
if(USE_POLY)
- target_link_libraries(cvc4 ${POLY_LIBRARIES})
+ target_link_libraries(cvc4 PRIVATE ${POLY_LIBRARIES})
target_include_directories(cvc4 PRIVATE ${POLY_INCLUDE_DIR})
endif()
if(USE_SYMFPU)
- target_include_directories(cvc4
- PUBLIC $<BUILD_INTERFACE:${SymFPU_INCLUDE_DIR}>)
+ target_link_libraries(cvc4 PRIVATE SymFPU)
endif()
# Note: When linked statically GMP needs to be linked after CLN since CLN
# depends on GMP.
-target_link_libraries(cvc4 ${GMP_LIBRARIES})
-target_include_directories(cvc4 PUBLIC $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>)
+target_link_libraries(cvc4 PRIVATE ${GMP_LIBRARIES})
+target_include_directories(cvc4 PRIVATE $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>)
# Add rt library
# Note: For glibc < 2.17 we have to additionally link against rt (man clock_gettime).
# RT_LIBRARIES should be empty for glibc >= 2.17
-target_link_libraries(cvc4 ${RT_LIBRARIES})
+target_link_libraries(cvc4 PRIVATE ${RT_LIBRARIES})
#-----------------------------------------------------------------------------#
# Visit main subdirectory after creating target cvc4. For target main, we have
add_library(main-test driver_unified.cpp $<TARGET_OBJECTS:main>)
target_compile_definitions(main-test PRIVATE -D__BUILDING_CVC4DRIVER)
target_link_libraries(main-test cvc4 cvc4parser)
+if(USE_CLN)
+ target_link_libraries(main-test ${CLN_LIBRARIES})
+ target_include_directories(main-test PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
+endif()
+target_link_libraries(main-test ${GMP_LIBRARIES})
+target_include_directories(main-test PRIVATE $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>)
#-----------------------------------------------------------------------------#
# cvc4 binary configuration
OUTPUT_NAME cvc4
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
target_link_libraries(cvc4-bin cvc4 cvc4parser)
+if(USE_CLN)
+ target_link_libraries(cvc4-bin ${CLN_LIBRARIES})
+ target_include_directories(cvc4-bin PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
+endif()
+target_link_libraries(cvc4-bin ${GMP_LIBRARIES})
+target_include_directories(cvc4-bin PRIVATE $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>)
if(PROGRAM_PREFIX)
install(PROGRAMS
$<TARGET_FILE:cvc4-bin>
target_compile_definitions(cvc4parser PRIVATE -D__BUILDING_CVC4PARSERLIB)
target_link_libraries(cvc4parser PUBLIC cvc4)
target_link_libraries(cvc4parser PRIVATE ANTLR3)
+
+if(USE_CLN)
+ target_link_libraries(cvc4parser PRIVATE ${CLN_LIBRARIES})
+ target_include_directories(cvc4parser PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
+endif()
+target_link_libraries(cvc4parser PRIVATE ${GMP_LIBRARIES})
+target_include_directories(cvc4parser PRIVATE $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>)
+
install(TARGETS cvc4parser
EXPORT cvc4-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR})
add_executable(${name} ${name}.cpp)
target_link_libraries(${name} main-test)
target_compile_definitions(${name} PRIVATE ${CVC4_API_TEST_FLAGS})
+ if(USE_CLN)
+ target_link_libraries(${name} ${CLN_LIBRARIES})
+ target_include_directories(${name} PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
+ endif()
+ target_link_libraries(${name} ${GMP_LIBRARIES})
+ target_include_directories(${name} PRIVATE $<BUILD_INTERFACE:${GMP_INCLUDE_DIR}>)
set_target_properties(${name}
PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${test_bin_dir})
add_test(api/${name} ${test_bin_dir}/${name})
target_link_libraries(${name} main-test)
target_link_libraries(${name} GTest::Main)
target_link_libraries(${name} GTest::GTest)
+
+ if(USE_CLN)
+ target_link_libraries(${name} ${CLN_LIBRARIES})
+ target_include_directories(${name} PRIVATE $<BUILD_INTERFACE:${CLN_INCLUDE_DIR}>)
+ endif()
if(USE_POLY)
- # We don't link against libpoly, because CVC4 is already linked against it.
+ target_link_libraries(${name} ${POLY_LIBRARIES})
target_include_directories(${name} PRIVATE ${POLY_INCLUDE_DIR})
endif()
+ target_link_libraries(${name} ${GMP_LIBRARIES})
+ target_include_directories(${name} PRIVATE ${GMP_INCLUDE_DIR})
if(${is_white})
target_compile_options(${name} PRIVATE -fno-access-control)
endif()