Add CI workflow to test different cmake versions (#7254)
[cvc5.git] / CMakeLists.txt
1 ###############################################################################
2 # Top contributors (to current version):
3 # Aina Niemetz, Mathias Preiner, Gereon Kremer
4 #
5 # This file is part of the cvc5 project.
6 #
7 # Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 # in the top-level source directory and their institutional affiliations.
9 # All rights reserved. See the file COPYING in the top-level source
10 # directory for licensing information.
11 # #############################################################################
12 #
13 # The build system configuration.
14 ##
15
16 cmake_minimum_required(VERSION 3.9)
17
18 #-----------------------------------------------------------------------------#
19 # Project configuration
20
21 project(cvc5)
22
23 include(CheckIPOSupported)
24 include(GNUInstallDirs)
25 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
26
27 include(version)
28
29 set(CMAKE_C_STANDARD 99)
30 set(CMAKE_CXX_STANDARD 17)
31 set(CMAKE_CXX_EXTENSIONS OFF)
32 set(CMAKE_CXX_STANDARD_REQUIRED ON)
33 set(CMAKE_CXX_VISIBILITY_PRESET hidden)
34 set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
35
36 # Generate compile_commands.json, which can be used for various code completion
37 # plugins.
38 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
39
40 #-----------------------------------------------------------------------------#
41 # Policies
42
43 # Required for FindGLPK since it sets CMAKE_REQUIRED_LIBRARIES
44 if(POLICY CMP0075)
45 cmake_policy(SET CMP0075 NEW)
46 endif()
47
48 #-----------------------------------------------------------------------------#
49 # Tell CMake where to find our dependencies
50
51 if(ABC_DIR)
52 list(APPEND CMAKE_PREFIX_PATH "${ABC_DIR}")
53 endif()
54 if(GLPK_DIR)
55 list(APPEND CMAKE_PREFIX_PATH "${GLPK_DIR}")
56 endif()
57
58 # By default the contrib/get-* scripts install dependencies to deps/install.
59 list(APPEND CMAKE_PREFIX_PATH "${PROJECT_SOURCE_DIR}/deps/install")
60
61 #-----------------------------------------------------------------------------#
62
63 include(Helpers)
64
65 #-----------------------------------------------------------------------------#
66 # User options
67
68 # License
69 option(ENABLE_GPL "Enable GPL dependencies")
70
71 # General build options
72 #
73 # >> 3-valued: IGNORE ON OFF
74 # > allows to detect if set by user (default: IGNORE)
75 # > only necessary for options set for build types
76 cvc5_option(ENABLE_ASAN "Enable ASAN build")
77 cvc5_option(ENABLE_UBSAN "Enable UBSan build")
78 cvc5_option(ENABLE_TSAN "Enable TSan build")
79 cvc5_option(ENABLE_ASSERTIONS "Enable assertions")
80 cvc5_option(ENABLE_COMP_INC_TRACK
81 "Enable optimizations for incremental SMT-COMP tracks")
82 cvc5_option(ENABLE_DEBUG_SYMBOLS "Enable debug symbols")
83 cvc5_option(ENABLE_DUMPING "Enable dumping")
84 cvc5_option(ENABLE_MUZZLE "Suppress ALL non-result output")
85 cvc5_option(ENABLE_STATISTICS "Enable statistics")
86 cvc5_option(ENABLE_TRACING "Enable tracing")
87 cvc5_option(ENABLE_UNIT_TESTING "Enable unit testing")
88 cvc5_option(ENABLE_VALGRIND "Enable valgrind instrumentation")
89 cvc5_option(ENABLE_STATIC_LIBRARY "Enable building static library")
90 cvc5_option(ENABLE_STATIC_BINARY
91 "Build static binaries with statically linked system libraries")
92 cvc5_option(ENABLE_AUTO_DOWNLOAD "Enable automatic download of dependencies")
93 cvc5_option(ENABLE_IPO "Enable interprocedural optimization")
94 # >> 2-valued: ON OFF
95 # > for options where we don't need to detect if set by user (default: OFF)
96 option(ENABLE_BEST "Enable dependencies known to give best performance")
97 option(ENABLE_COVERAGE "Enable support for gcov coverage testing")
98 option(ENABLE_DEBUG_CONTEXT_MM "Enable the debug context memory manager")
99 option(ENABLE_PROFILING "Enable support for gprof profiling")
100
101 # Optional dependencies
102 #
103 # >> 3-valued: IGNORE ON OFF
104 # > allows to detect if set by user (default: IGNORE)
105 # > only necessary for options set for ENABLE_BEST
106 cvc5_option(USE_ABC "Use ABC for AIG bit-blasting")
107 cvc5_option(USE_CLN "Use CLN instead of GMP")
108 cvc5_option(USE_CRYPTOMINISAT "Use CryptoMiniSat SAT solver")
109 cvc5_option(USE_GLPK "Use GLPK simplex solver")
110 cvc5_option(USE_KISSAT "Use Kissat SAT solver")
111 cvc5_option(USE_EDITLINE "Use Editline for better interactive support")
112 # >> 2-valued: ON OFF
113 # > for options where we don't need to detect if set by user (default: OFF)
114 option(USE_POLY "Use LibPoly for polynomial arithmetic")
115 option(USE_COCOA "Use CoCoALib for further polynomial operations")
116 option(USE_PYTHON2 "Force Python 2 (deprecated)")
117
118 # Custom install directories for dependencies
119 # If no directory is provided by the user, we first check if the dependency was
120 # installed via the corresponding contrib/get-* script and if not found, we
121 # check the intalled system version. If the user provides a directory we
122 # immediately fail if the dependency was not found at the specified location.
123 set(ABC_DIR "" CACHE STRING "Set ABC install directory")
124 set(GLPK_DIR "" CACHE STRING "Set GLPK install directory")
125
126 # Prepend binaries with prefix on make install
127 set(PROGRAM_PREFIX "" CACHE STRING "Program prefix on make install")
128
129 # Supported language bindings based on new C++ API
130 option(BUILD_BINDINGS_PYTHON "Build Python bindings based on new C++ API ")
131 option(BUILD_BINDINGS_JAVA "Build Java bindings based on new C++ API ")
132
133 # Api documentation
134 option(BUILD_DOCS "Build Api documentation")
135
136 #-----------------------------------------------------------------------------#
137 # Internal cmake variables
138
139 set(OPTIMIZATION_LEVEL 3)
140 set(GPL_LIBS "")
141
142 #-----------------------------------------------------------------------------#
143 # Determine number of threads available, used to configure (default) parallel
144 # execution of custom test targets (can be overriden with ARGS=-jN).
145
146 include(ProcessorCount)
147 ProcessorCount(CTEST_NTHREADS)
148 if(CTEST_NTHREADS EQUAL 0)
149 set(CTEST_NTHREADS 1)
150 endif()
151
152 #-----------------------------------------------------------------------------#
153 # Build types
154
155 # Note: Module CodeCoverage requires the name of the debug build to conform
156 # to cmake standards (first letter uppercase).
157 set(BUILD_TYPES Production Debug Testing Competition)
158
159 if(ENABLE_ASAN OR ENABLE_UBSAN OR ENABLE_TSAN)
160 set(CMAKE_BUILD_TYPE Debug)
161 endif()
162
163 # Set the default build type to Production
164 if(NOT CMAKE_BUILD_TYPE)
165 set(CMAKE_BUILD_TYPE
166 Production CACHE STRING "Options are: ${BUILD_TYPES}" FORCE)
167 # Provide drop down menu options in cmake-gui
168 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${BUILD_TYPES})
169 endif()
170
171 # Check if specified build type is valid.
172 list(FIND BUILD_TYPES ${CMAKE_BUILD_TYPE} FOUND_BUILD_TYPE)
173 if(${FOUND_BUILD_TYPE} EQUAL -1)
174 message(FATAL_ERROR
175 "'${CMAKE_BUILD_TYPE}' is not a valid build type. "
176 "Available builds are: ${BUILD_TYPES}")
177 endif()
178
179 message(STATUS "Building ${CMAKE_BUILD_TYPE} build")
180 include(Config${CMAKE_BUILD_TYPE})
181
182 #-----------------------------------------------------------------------------#
183 # Compiler flags
184
185 add_check_c_cxx_flag("-O${OPTIMIZATION_LEVEL}")
186 add_check_c_cxx_flag("-Wall")
187 add_check_c_cxx_flag("-Wno-unused-private-field")
188 add_check_c_flag("-fexceptions")
189 add_check_cxx_flag("-Wsuggest-override")
190 add_check_cxx_flag("-Wnon-virtual-dtor")
191 add_check_c_cxx_flag("-Wimplicit-fallthrough")
192 add_check_c_cxx_flag("-Wshadow")
193
194 # Assume no dynamic initialization of thread-local variables in non-defining
195 # translation units. This option should result in better performance and works
196 # around crashing issues with our Windows build.
197 add_check_cxx_flag("-fno-extern-tls-init")
198
199 # Temporarily disable -Wclass-memaccess to suppress 'no trivial copy-assignment'
200 # cdlist.h warnings. Remove when fixed.
201 add_check_cxx_flag("-Wno-class-memaccess")
202
203 if (WIN32)
204 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--stack,100000000")
205 endif ()
206
207 #-----------------------------------------------------------------------------#
208 # Use ld.gold if available
209
210 execute_process(COMMAND ${CMAKE_C_COMPILER}
211 -fuse-ld=gold
212 -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
213 if ("${LD_VERSION}" MATCHES "GNU gold")
214 string(APPEND CMAKE_EXE_LINKER_FLAGS " -fuse-ld=gold")
215 string(APPEND CMAKE_SHARED_LINKER_FLAGS " -fuse-ld=gold")
216 string(APPEND CMAKE_MODULE_LINKER_FLAGS " -fuse-ld=gold")
217 message(STATUS "Using GNU gold linker.")
218 endif ()
219
220 #-----------------------------------------------------------------------------#
221 # Use interprocedural optimization if requested
222
223 if(ENABLE_IPO)
224 set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
225 endif()
226
227
228 #-----------------------------------------------------------------------------#
229 # Option defaults (three-valued options (cvc5_option(...)))
230 #
231 # These options are only set if their value is IGNORE. Otherwise, the user
232 # already set the option, which we don't want to overwrite.
233
234 if(ENABLE_STATIC_BINARY)
235 message(STATUS "Enable static library for static binary build.")
236 cvc5_set_option(ENABLE_STATIC_LIBRARY ON)
237 endif()
238
239 #-----------------------------------------------------------------------------#
240
241 # Only enable unit testing if assertions are enabled. Otherwise, unit tests
242 # that expect AssertionException to be thrown will fail.
243 if(NOT ENABLE_ASSERTIONS)
244 message(STATUS "Disabling unit tests since assertions are disabled.")
245 set(ENABLE_UNIT_TESTING OFF)
246 endif()
247
248 #-----------------------------------------------------------------------------#
249 # Shared/static libraries
250
251 # Embed the installation prefix as an RPATH in the executable such that the
252 # linker can find our libraries (such as libcvc5parser) when executing the
253 # cvc5 binary. This is for example useful when installing cvc5 with a custom
254 # prefix on macOS (e.g. when using homebrew in a non-standard directory). If
255 # we do not set this option, then the linker will not be able to find the
256 # required libraries when trying to run cvc5.
257 #
258 # Also embed the installation prefix of the installed contrib libraries as an
259 # RPATH. This allows to install a dynamically linked binary that depends on
260 # dynamically linked libraries. This is dangerous, as the installed binary
261 # breaks if the contrib library is removed or changes in other ways, we thus
262 # print a big warning and only allow if installing to a custom installation
263 # prefix.
264 #
265 # More information on RPATH in CMake:
266 # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
267 set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR};${PROJECT_SOURCE_DIR}/deps/install/lib")
268
269 # Set visibility to default if unit tests are enabled
270 if(ENABLE_UNIT_TESTING)
271 set(CMAKE_CXX_VISIBILITY_PRESET default)
272 set(CMAKE_VISIBILITY_INLINES_HIDDEN 0)
273 endif()
274
275 #-----------------------------------------------------------------------------#
276 # Enable the ctest testing framework
277
278 # This needs to be enabled here rather than in subdirectory test in order to
279 # allow calling ctest from the root build directory.
280 enable_testing()
281
282 #-----------------------------------------------------------------------------#
283 # Check options, find packages and configure build.
284
285 if(USE_PYTHON2)
286 find_package(PythonInterp 2.7 REQUIRED)
287 else()
288 find_package(PythonInterp 3 REQUIRED)
289 endif()
290
291 find_package(GMP 6.1 REQUIRED)
292
293 if(ENABLE_ASAN)
294 # -fsanitize=address requires CMAKE_REQUIRED_FLAGS to be explicitely set,
295 # otherwise the -fsanitize=address check will fail while linking.
296 set(CMAKE_REQUIRED_FLAGS -fsanitize=address)
297 add_required_c_cxx_flag("-fsanitize=address")
298 unset(CMAKE_REQUIRED_FLAGS)
299 add_required_c_cxx_flag("-fno-omit-frame-pointer")
300 add_check_c_cxx_flag("-fsanitize-recover=address")
301 endif()
302
303 if(ENABLE_UBSAN)
304 add_required_c_cxx_flag("-fsanitize=undefined")
305 add_definitions(-DCVC5_USE_UBSAN)
306 endif()
307
308 if(ENABLE_TSAN)
309 # -fsanitize=thread requires CMAKE_REQUIRED_FLAGS to be explicitely set,
310 # otherwise the -fsanitize=thread check will fail while linking.
311 set(CMAKE_REQUIRED_FLAGS -fsanitize=thread)
312 add_required_c_cxx_flag("-fsanitize=thread")
313 unset(CMAKE_REQUIRED_FLAGS)
314 endif()
315
316 if(ENABLE_ASSERTIONS)
317 add_definitions(-DCVC5_ASSERTIONS)
318 else()
319 add_definitions(-DNDEBUG)
320 endif()
321
322 if(ENABLE_COVERAGE)
323 include(CodeCoverage)
324 APPEND_COVERAGE_COMPILER_FLAGS()
325 add_definitions(-DCVC5_COVERAGE)
326 # Note: The ctest command returns a non-zero exit code if tests fail or run
327 # into a timeout. As a consequence, the coverage report is not generated. To
328 # prevent this we always return with exit code 0 after the ctest command has
329 # finished.
330 setup_target_for_coverage_gcovr_html(
331 NAME coverage-test
332 EXECUTABLE
333 ctest -j${CTEST_NTHREADS} -LE "example"
334 --output-on-failure $$ARGS || exit 0
335 DEPENDS
336 build-tests)
337
338 # Adds targets `coverage` and `coverage-reset` for manually generating
339 # coverage reports for specific executions.
340 #
341 # Target coverage-reset resets all the coverage counters to zero, while
342 # target coverage will generate a coverage report for all executions since
343 # the last coverage-reset.
344 setup_target_for_coverage_lcov_no_executable(
345 NAME coverage
346 DEPENDENCIES cvc5-bin)
347 endif()
348
349 if(ENABLE_DEBUG_CONTEXT_MM)
350 add_definitions(-DCVC5_DEBUG_CONTEXT_MEMORY_MANAGER)
351 endif()
352
353 if(ENABLE_DEBUG_SYMBOLS)
354 add_check_c_cxx_flag("-ggdb3")
355 endif()
356
357 if(ENABLE_COMP_INC_TRACK)
358 add_definitions(-DCVC5_SMTCOMP_APPLICATION_TRACK)
359 endif()
360
361 if(ENABLE_MUZZLE)
362 add_definitions(-DCVC5_MUZZLE)
363 endif()
364
365 if(ENABLE_DUMPING)
366 add_definitions(-DCVC5_DUMPING)
367 endif()
368
369 if(ENABLE_PROFILING)
370 add_definitions(-DCVC5_PROFILING)
371 add_check_c_cxx_flag("-pg")
372 endif()
373
374 if(ENABLE_TRACING)
375 add_definitions(-DCVC5_TRACING)
376 endif()
377
378 if(ENABLE_STATISTICS)
379 add_definitions(-DCVC5_STATISTICS_ON)
380 endif()
381
382 if(ENABLE_VALGRIND)
383 find_package(Valgrind REQUIRED)
384 add_definitions(-DCVC5_VALGRIND)
385 endif()
386
387 if(USE_ABC)
388 find_package(ABC REQUIRED)
389 add_definitions(-DCVC5_USE_ABC ${ABC_ARCH_FLAGS})
390 endif()
391
392 find_package(CaDiCaL REQUIRED)
393
394 if(USE_CLN)
395 set(GPL_LIBS "${GPL_LIBS} cln")
396 find_package(CLN 1.2.2 REQUIRED)
397 set(CVC5_USE_CLN_IMP 1)
398 set(CVC5_USE_GMP_IMP 0)
399 else()
400 set(CVC5_USE_CLN_IMP 0)
401 set(CVC5_USE_GMP_IMP 1)
402 endif()
403
404 if(USE_CRYPTOMINISAT)
405 # CryptoMiniSat requires pthreads support
406 set(THREADS_PREFER_PTHREAD_FLAG ON)
407 find_package(Threads REQUIRED)
408 if(THREADS_HAVE_PTHREAD_ARG)
409 add_c_cxx_flag(-pthread)
410 endif()
411 find_package(CryptoMiniSat 5.8 REQUIRED)
412 add_definitions(-DCVC5_USE_CRYPTOMINISAT)
413 endif()
414
415 if(USE_GLPK)
416 set(GPL_LIBS "${GPL_LIBS} glpk")
417 find_package(GLPK REQUIRED)
418 add_definitions(-DCVC5_USE_GLPK)
419 endif()
420
421 if(USE_KISSAT)
422 find_package(Kissat REQUIRED)
423 add_definitions(-DCVC5_USE_KISSAT)
424 endif()
425
426 if(USE_POLY)
427 find_package(Poly REQUIRED)
428 add_definitions(-DCVC5_USE_POLY)
429 set(CVC5_USE_POLY_IMP 1)
430 else()
431 set(CVC5_USE_POLY_IMP 0)
432 endif()
433
434 if(USE_COCOA)
435 find_package(CoCoA REQUIRED 0.99711)
436 add_definitions(-DCVC5_USE_COCOA)
437 endif()
438
439 if(USE_EDITLINE)
440 find_package(Editline REQUIRED)
441 set(HAVE_LIBEDITLINE 1)
442 if(Editline_COMPENTRY_FUNC_RETURNS_CHARPTR)
443 set(EDITLINE_COMPENTRY_FUNC_RETURNS_CHARP 1)
444 endif()
445 endif()
446
447 find_package(SymFPU REQUIRED)
448
449 if(GPL_LIBS)
450 if(NOT ENABLE_GPL)
451 message(FATAL_ERROR
452 "Bad configuration detected: BSD-licensed code only, but also requested "
453 "GPLed libraries: ${GPL_LIBS}")
454 endif()
455 set(CVC5_GPL_DEPS 1)
456 endif()
457
458 #-----------------------------------------------------------------------------#
459 # Provide targets to inspect iwyu suggestions
460
461 include(IWYU)
462
463 #-----------------------------------------------------------------------------#
464
465 include(ConfigureCvc5)
466 if(ENABLE_STATIC_BINARY)
467 set(CVC5_STATIC_BUILD ON)
468 endif()
469
470 #-----------------------------------------------------------------------------#
471 # Add subdirectories
472
473 add_subdirectory(src)
474
475 if(BUILD_BINDINGS_PYTHON)
476 set(BUILD_BINDINGS_PYTHON_VERSION ${PYTHON_VERSION_MAJOR})
477 add_subdirectory(src/api/python)
478 endif()
479
480 if(BUILD_BINDINGS_JAVA)
481 add_subdirectory(src/api/java)
482 message(WARNING "Java API is currently under development.")
483 endif()
484
485 if(BUILD_DOCS)
486 add_subdirectory(docs)
487 endif()
488
489 add_subdirectory(test)
490
491 #-----------------------------------------------------------------------------#
492 # Package configuration
493 #
494 # Export cvc5 targets to support find_package(cvc5) in other cmake projects.
495
496 include(CMakePackageConfigHelpers)
497
498 # If we install a dynamically linked binary that also uses dynamically used
499 # libraries from deps/install/lib, we need to be cautious. Changing these
500 # shared libraries from deps/install/lib most probably breaks the binary.
501 # We only allow such an installation for custom installation prefixes
502 # (in the assumption that only reasonably experienced users use this and
503 # also that custom installation prefixes are not used for longer periods of
504 # time anyway). Also, we print a big warning with further instructions.
505 if(NOT ENABLE_STATIC_BINARY)
506 # Get the libraries that cvc5 links against
507 get_target_property(libs cvc5-shared INTERFACE_LINK_LIBRARIES)
508 set(LIBS_SHARED_FROM_DEPS "")
509 foreach(lib ${libs})
510 # Filter out those that are linked dynamically and come from deps/install
511 if(lib MATCHES ".*/deps/install/lib/.*\.so")
512 list(APPEND LIBS_SHARED_FROM_DEPS ${lib})
513 endif()
514 endforeach()
515 list(LENGTH LIBS_SHARED_FROM_DEPS list_len)
516 # Check if we actually use such "dangerous" libraries
517 if(list_len GREATER 0)
518 # Print a generic warning
519 install(CODE "message(WARNING \"You are installing a dynamically linked \
520 binary of cvc5 which may be a problem if you are using any dynamically \
521 linked third-party library that you obtained through one of the \
522 contrib/get-xxx scripts. The binary uses the rpath mechanism to find these \
523 locally, hence executing such a contrib script removing the \
524 \\\"deps/install\\\" folder most probably breaks the installed binary! \
525 Consider installing the dynamically linked dependencies on your system \
526 manually or link cvc5 statically.\")")
527 # Print the libraries in question
528 foreach(lib ${LIBS_SHARED_FROM_DEPS})
529 install(CODE "message(WARNING \"The following library is used by the cvc5 binary: ${lib}\")")
530 endforeach()
531 # Check if we use a custom installation prefix
532 if(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
533 install(CODE "message(FATAL_ERROR \"To avoid installing a \
534 soon-to-be-broken binary, system-wide installation is disabled if the \
535 binary depends on locally-built shared libraries.\")")
536 else()
537 install(CODE "message(WARNING \"You have selected a custom install \
538 directory ${CMAKE_INSTALL_PREFIX}, so we expect you understood the \
539 previous warning and know what you are doing.\")")
540 endif()
541 endif()
542 endif()
543
544 install(EXPORT cvc5-targets
545 FILE cvc5Targets.cmake
546 NAMESPACE cvc5::
547 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cvc5)
548
549 configure_package_config_file(
550 ${CMAKE_SOURCE_DIR}/cmake/cvc5Config.cmake.in
551 ${CMAKE_BINARY_DIR}/cmake/cvc5Config.cmake
552 INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cvc5
553 PATH_VARS CMAKE_INSTALL_LIBDIR
554 )
555
556 write_basic_package_version_file(
557 ${CMAKE_CURRENT_BINARY_DIR}/cvc5ConfigVersion.cmake
558 VERSION ${CVC5_VERSION}
559 COMPATIBILITY ExactVersion
560 )
561
562 install(FILES
563 ${CMAKE_BINARY_DIR}/cmake/cvc5Config.cmake
564 ${CMAKE_BINARY_DIR}/cvc5ConfigVersion.cmake
565 DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/cvc5
566 )
567
568
569 #-----------------------------------------------------------------------------#
570 # Print build configuration
571
572 # Set colors.
573 if(NOT WIN32)
574 string(ASCII 27 Esc)
575 set(Green "${Esc}[32m")
576 set(Blue "${Esc}[1;34m")
577 set(ResetColor "${Esc}[m")
578 endif()
579
580 # Convert build type to lower case.
581 string(TOLOWER ${CMAKE_BUILD_TYPE} CVC5_BUILD_PROFILE_STRING)
582
583 # Get all definitions added via add_definitions.
584 get_directory_property(CVC5_DEFINITIONS COMPILE_DEFINITIONS)
585 string(REPLACE ";" " " CVC5_DEFINITIONS "${CVC5_DEFINITIONS}")
586
587 message("")
588 print_info("cvc5 ${CVC5_VERSION}")
589 message("")
590 if(ENABLE_COMP_INC_TRACK)
591 print_config("Build profile " "${CVC5_BUILD_PROFILE_STRING} (incremental)")
592 else()
593 print_config("Build profile " "${CVC5_BUILD_PROFILE_STRING}")
594 endif()
595 message("")
596 print_config("GPL " ${ENABLE_GPL})
597 print_config("Best configuration " ${ENABLE_BEST})
598 message("")
599 print_config("Assertions " ${ENABLE_ASSERTIONS})
600 print_config("Debug symbols " ${ENABLE_DEBUG_SYMBOLS})
601 print_config("Debug context mem mgr " ${ENABLE_DEBUG_CONTEXT_MM})
602 message("")
603 print_config("Dumping " ${ENABLE_DUMPING})
604 print_config("Muzzle " ${ENABLE_MUZZLE})
605 print_config("Statistics " ${ENABLE_STATISTICS})
606 print_config("Tracing " ${ENABLE_TRACING})
607 message("")
608 print_config("ASan " ${ENABLE_ASAN})
609 print_config("UBSan " ${ENABLE_UBSAN})
610 print_config("TSan " ${ENABLE_TSAN})
611 print_config("Coverage (gcov) " ${ENABLE_COVERAGE})
612 print_config("Profiling (gprof) " ${ENABLE_PROFILING})
613 print_config("Unit tests " ${ENABLE_UNIT_TESTING})
614 print_config("Valgrind " ${ENABLE_VALGRIND})
615 message("")
616 print_config("Static library " ${ENABLE_STATIC_LIBRARY})
617 print_config("Static binary " ${ENABLE_STATIC_BINARY})
618 print_config("Python bindings " ${BUILD_BINDINGS_PYTHON})
619 print_config("Java bindings " ${BUILD_BINDINGS_JAVA})
620 print_config("Python2 " ${USE_PYTHON2})
621 print_config("Interprocedural opt. " ${ENABLE_IPO})
622 message("")
623 print_config("ABC " ${USE_ABC})
624 print_config("CryptoMiniSat " ${USE_CRYPTOMINISAT} FOUND_SYSTEM ${CryptoMiniSat_FOUND_SYSTEM})
625 print_config("GLPK " ${USE_GLPK})
626 print_config("Kissat " ${USE_KISSAT} FOUND_SYSTEM ${Kissat_FOUND_SYSTEM})
627 print_config("LibPoly " ${USE_POLY} FOUND_SYSTEM ${Poly_FOUND_SYSTEM})
628 print_config("CoCoALib " ${USE_COCOA} FOUND_SYSTEM ${CoCoA_FOUND_SYSTEM})
629
630 if(CVC5_USE_CLN_IMP)
631 print_config("MP library " "cln" FOUND_SYSTEM ${CLN_FOUND_SYSTEM})
632 else()
633 print_config("MP library " "gmp" FOUND_SYSTEM ${GMP_FOUND_SYSTEM})
634 endif()
635 print_config("Editline " ${USE_EDITLINE})
636 message("")
637 print_config("Api docs " ${BUILD_DOCS})
638 message("")
639 if(ABC_DIR)
640 print_config("ABC dir " ${ABC_DIR})
641 endif()
642 if(GLPK_DIR)
643 print_config("GLPK dir " ${GLPK_DIR})
644 endif()
645 message("")
646 print_config("CPPLAGS (-D...)" "${CVC5_DEFINITIONS}")
647 print_config("CXXFLAGS " "${CMAKE_CXX_FLAGS}")
648 print_config("CFLAGS " "${CMAKE_C_FLAGS}")
649 print_config("Linker flags " "${CMAKE_EXE_LINKER_FLAGS}")
650 message("")
651 print_config("Install prefix " "${CMAKE_INSTALL_PREFIX}")
652 message("")
653
654 if(GPL_LIBS)
655 message(
656 "${Blue}cvc5 license: "
657 "${Yellow}GPLv3 (due to optional libraries; see below)${ResetColor}"
658 "\n"
659 "\n"
660 "Please note that cvc5 will be built against the following GPLed libraries:"
661 "\n"
662 "${GPL_LIBS}"
663 "\n"
664 "As these libraries are covered under the GPLv3, so is this build of cvc5."
665 "\n"
666 "cvc5 is also available to you under the terms of the (modified) BSD license."
667 "\n"
668 "If you prefer to license cvc5 under those terms, please configure cvc5 to"
669 "\n"
670 "disable all optional GPLed library dependencies (-DENABLE_BSD_ONLY=ON)."
671 )
672 else()
673 message(
674 "${Blue}cvc5 license:${ResetColor} modified BSD"
675 "\n"
676 "\n"
677 "Note that this configuration is NOT built against any GPL'ed libraries, so"
678 "\n"
679 "it is covered by the (modified) BSD license. To build against GPL'ed"
680 "\n"
681 "libraries which can improve cvc5's performance on arithmetic and bitvector"
682 "\n"
683 "logics, re-configure with '-DENABLE_GPL -DENABLE_BEST'."
684 )
685 endif()
686
687 if("${CMAKE_GENERATOR}" STREQUAL "Ninja")
688 set(BUILD_COMMAND_NAME "ninja")
689 else()
690 set(BUILD_COMMAND_NAME "make")
691 endif()
692
693 message("")
694 message("Now just type '${BUILD_COMMAND_NAME}', "
695 "followed by '${BUILD_COMMAND_NAME} check' "
696 "or '${BUILD_COMMAND_NAME} install'.")
697 message("")