This PR would add an option to only build the CVC4 library and not the parser or executable. This can be used for projects that only intend to use CVC4 through the API.
It seems to be working now, but it's not necessarily the cleanest solution. In particular, if you'd like the polarity to be different I'm happy to change that. Polarity meaning something like "${WITH_BINARY}" STREQUAL "YES" instead of NOT "${LIB_ONLY} STREQUAL "YES" which is admittedly a little strange.
option(BUILD_BINDINGS_PYTHON "Build Python bindings based on new C++ API ")
option(BUILD_BINDINGS_JAVA "Build Java bindings based on new C++ API ")
+# Build limitations
+option(BUILD_LIB_ONLY "Only build the library")
+
#-----------------------------------------------------------------------------#
# Internal cmake variables
print_config("Kissat :" USE_KISSAT)
print_config("LFSC :" USE_LFSC)
print_config("LibPoly :" USE_POLY)
+message("")
+print_config("BUILD_LIB_ONLY :" BUILD_LIB_ONLY)
if(CVC4_USE_CLN_IMP)
message("MP library : cln")
--poly-dir=PATH path to top level of LibPoly source tree
--symfpu-dir=PATH path to top level of SymFPU source tree
+Build limitations:
+ --lib-only only build the library, but not the executable or
+ the parser (default: off)
+
EOF
exit 0
}
poly_dir=default
symfpu_dir=default
+lib_only=default
+
#--------------------------------------------------------------------------#
while [ $# -gt 0 ]
--symfpu-dir) die "missing argument to $1 (try -h)" ;;
--symfpu-dir=*) symfpu_dir=${1##*=} ;;
+ --lib-only) lib_only=ON ;;
+
-*) die "invalid option '$1' (try -h)";;
*) case $1 in
&& cmake_opts="$cmake_opts -DPOLY_DIR=$poly_dir"
[ "$symfpu_dir" != default ] \
&& cmake_opts="$cmake_opts -DSYMFPU_DIR=$symfpu_dir"
+[ "$lib_only" != default ] \
+ && cmake_opts="$cmake_opts -DBUILD_LIB_ONLY=$lib_only"
[ "$install_prefix" != default ] \
&& cmake_opts="$cmake_opts -DCMAKE_INSTALL_PREFIX=$install_prefix"
[ -n "$program_prefix" ] \
add_subdirectory(base)
add_subdirectory(expr)
add_subdirectory(options)
-add_subdirectory(parser)
+if (NOT BUILD_LIB_ONLY)
+ add_subdirectory(parser)
+endif()
add_subdirectory(theory)
add_subdirectory(util)
# target_link_libraries(...) with object libraries for cmake versions <= 3.12.
# Thus, we can only visit main as soon as all dependencies for cvc4 are set up.
-add_subdirectory(main)
+if (NOT BUILD_LIB_ONLY)
+ add_subdirectory(main)
+endif()
#-----------------------------------------------------------------------------#
# Note:
#-----------------------------------------------------------------------------#
# Add subdirectories
-add_subdirectory(regress)
+if (NOT BUILD_LIB_ONLY)
+ add_subdirectory(regress)
+endif()
add_subdirectory(system EXCLUDE_FROM_ALL)
if(ENABLE_UNIT_TESTING)