include(deps-helper)
-find_program(ANTLR3_BINARY NAMES antlr3)
+find_file(ANTLR3_JAR NAMES antlr-3.4-complete.jar PATH_SUFFIXES share/java/)
find_path(ANTLR3_INCLUDE_DIR NAMES antlr3.h)
find_library(ANTLR3_RUNTIME NAMES antlr3c)
set(ANTLR3_FOUND_SYSTEM FALSE)
-if(ANTLR3_BINARY AND ANTLR3_INCLUDE_DIR AND ANTLR3_RUNTIME)
+if(ANTLR3_JAR AND ANTLR3_INCLUDE_DIR AND ANTLR3_RUNTIME)
set(ANTLR3_FOUND_SYSTEM TRUE)
# Parse ANTLR3 version
endif()
if(NOT ANTLR3_FOUND_SYSTEM)
+ check_auto_download("ANTLR3" "")
include(ExternalProject)
set(ANTLR3_VERSION "3.4")
BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libantlr3c.a
)
- find_package(Java COMPONENTS Runtime REQUIRED)
- set(ANTLR3_BINARY ${Java_JAVA_EXECUTABLE}
- -cp "${DEPS_BASE}/share/java/antlr-3.4-complete.jar" org.antlr.Tool)
+ set(ANTLR3_JAR "${DEPS_BASE}/share/java/antlr-3.4-complete.jar")
set(ANTLR3_INCLUDE_DIR "${DEPS_BASE}/include/")
set(ANTLR3_RUNTIME "${DEPS_BASE}/lib/libantlr3c.a")
endif()
+find_package(Java COMPONENTS Runtime REQUIRED)
+
set(ANTLR3_FOUND TRUE)
# This may not be a single binary: the EP has a whole commandline
# We thus do not make this an executable target.
# Just call ${ANTLR3_COMMAND} instead.
-set(ANTLR3_COMMAND ${ANTLR3_BINARY} CACHE STRING "run ANTLR3" FORCE)
+set(ANTLR3_COMMAND ${Java_JAVA_EXECUTABLE} -cp
+ "${DEPS_BASE}/share/java/antlr-3.4-complete.jar" org.antlr.Tool
+ CACHE STRING "run ANTLR3" FORCE)
add_library(ANTLR3 STATIC IMPORTED GLOBAL)
set_target_properties(ANTLR3 PROPERTIES IMPORTED_LOCATION "${ANTLR3_RUNTIME}")
)
endif()
+macro(check_auto_download name disable_option)
+ if(NOT ENABLE_AUTO_DOWNLOAD)
+ if (${name}_FIND_VERSION)
+ set(depname "${name} (>= ${${name}_FIND_VERSION})")
+ else()
+ set(depname "${name}")
+ endif()
+ if("${disable_option}" STREQUAL "")
+ message(FATAL_ERROR "Could not find the required dependency
+${depname} in the system. Please install it yourself or use --auto-download to \
+let us download and build it for you.")
+ else()
+ message(FATAL_ERROR "Could not find the optional dependency
+${depname} in the system. You can disable this dependency with \
+${disable_option}, install it yourself or use --auto-download to let us \
+download and build it for you.")
+ endif()
+ endif()
+endmacro(check_auto_download)
+
macro(check_system_version name)
# find_package sets this variable when called with a version
# https://cmake.org/cmake/help/latest/command/find_package.html#version-selection
--static build static libraries and binaries [default=no]
--static-binary statically link against system libraries
(must be disabled for static macOS builds) [default=yes]
+ --auto-download automatically download dependencies if necessary
--debug-symbols include debug symbols
--valgrind Valgrind instrumentation
--debug-context-mm use the debug context memory manager
--cln use CLN instead of GMP
--glpk use GLPK simplex solver
--abc use the ABC AIG library
- --cadical use the CaDiCaL SAT solver
+ --cadical use the CaDiCaL SAT solver [default=yes]
--cryptominisat use the CryptoMiniSat SAT solver
--kissat use the Kissat SAT solver
- --poly use the LibPoly library
- --symfpu use SymFPU for floating point solver
+ --poly use the LibPoly library [default=yes]
+ --symfpu use SymFPU for floating point solver [default=yes]
--editline support the editline library
Optional Path to Optional Packages:
--abc-dir=PATH path to top level of ABC source tree
- --cadical-dir=PATH path to top level of CaDiCaL source tree
- --cryptominisat-dir=PATH path to top level of CryptoMiniSat source tree
--glpk-dir=PATH path to top level of GLPK installation
- --gmp-dir=PATH path to top level of GMP installation
- --kissat-dir=PATH path to top level of Kissat source tree
- --poly-dir=PATH path to top level of LibPoly source tree
- --symfpu-dir=PATH path to top level of SymFPU source tree
+ --dep-path=PATH path to a dependency installation dir
Build limitations:
--lib-only only build the library, but not the executable or
abc=default
asan=default
assertions=default
-cadical=default
+auto_download=default
+cadical=ON
cln=default
comp_inc=default
coverage=default
glpk=default
gpl=default
kissat=default
-poly=default
+poly=ON
muzzle=default
ninja=default
profiling=default
shared=default
static_binary=default
statistics=default
-symfpu=default
+symfpu=ON
tracing=default
tsan=default
ubsan=default
werror=default
abc_dir=default
-cadical_dir=default
-cryptominisat_dir=default
glpk_dir=default
-gmp_dir=default
-kissat_dir=default
-poly_dir=default
-symfpu_dir=default
lib_only=default
--static-binary) static_binary=ON;;
--no-static-binary) static_binary=OFF;;
+ --auto-download) auto_download=ON;;
+ --no-auto-download) auto_download=OFF;;
+
--statistics) statistics=ON;;
--no-statistics) statistics=OFF;;
--abc-dir) die "missing argument to $1 (try -h)" ;;
--abc-dir=*) abc_dir=${1##*=} ;;
- --cadical-dir) die "missing argument to $1 (try -h)" ;;
- --cadical-dir=*) cadical_dir=${1##*=} ;;
-
- --cryptominisat-dir) die "missing argument to $1 (try -h)" ;;
- --cryptominisat-dir=*) cryptominisat_dir=${1##*=} ;;
-
--glpk-dir) die "missing argument to $1 (try -h)" ;;
--glpk-dir=*) glpk_dir=${1##*=} ;;
- --gmp-dir) die "missing argument to $1 (try -h)" ;;
- --gmp-dir=*) gmp_dir=${1##*=} ;;
-
- --kissat-dir) die "missing argument to $1 (try -h)" ;;
- --kissat-dir=*) kissat_dir=${1##*=} ;;
-
- --poly-dir) die "missing argument to $1 (try -h)" ;;
- --poly-dir=*) poly_dir=${1##*=} ;;
-
- --symfpu-dir) die "missing argument to $1 (try -h)" ;;
- --symfpu-dir=*) symfpu_dir=${1##*=} ;;
+ --dep-path) die "missing argument to $1 (try -h)" ;;
+ --dep-path=*) dep_path="${dep_path};${1##*=}" ;;
--lib-only) lib_only=ON ;;
[ $asan != default ] \
&& cmake_opts="$cmake_opts -DENABLE_ASAN=$asan"
+[ $auto_download != default ] \
+ && cmake_opts="$cmake_opts -DENABLE_AUTO_DOWNLOAD=$auto_download"
[ $ubsan != default ] \
&& cmake_opts="$cmake_opts -DENABLE_UBSAN=$ubsan"
[ $tsan != default ] \
&& cmake_opts="$cmake_opts -DUSE_SYMFPU=$symfpu"
[ "$abc_dir" != default ] \
&& cmake_opts="$cmake_opts -DABC_DIR=$abc_dir"
-[ "$cadical_dir" != default ] \
- && cmake_opts="$cmake_opts -DCADICAL_DIR=$cadical_dir"
-[ "$cryptominisat_dir" != default ] \
- && cmake_opts="$cmake_opts -DCRYPTOMINISAT_DIR=$cryptominisat_dir"
[ "$glpk_dir" != default ] \
&& cmake_opts="$cmake_opts -DGLPK_DIR=$glpk_dir"
-[ "$gmp_dir" != default ] \
- && cmake_opts="$cmake_opts -DGMP_DIR=$gmp_dir"
-[ "$kissat_dir" != default ] \
- && cmake_opts="$cmake_opts -DKISSAT=$kissat_dir"
-[ "$poly_dir" != default ] \
- && cmake_opts="$cmake_opts -DPOLY_DIR=$poly_dir"
-[ "$symfpu_dir" != default ] \
- && cmake_opts="$cmake_opts -DSYMFPU_DIR=$symfpu_dir"
+[ "$dep_path" != default ] \
+ && cmake_opts="$cmake_opts -DCMAKE_PREFIX_PATH=$dep_path"
[ "$lib_only" != default ] \
&& cmake_opts="$cmake_opts -DBUILD_LIB_ONLY=$lib_only"
[ "$install_prefix" != default ] \