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