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