forked from esbmc/esbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
152 lines (124 loc) · 4.5 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
#################################
# Project Information #
#################################
cmake_minimum_required (VERSION 3.18)
# HACK: This msvc policy needs to be setted before project()
# This can be removed when we move to CMake >= 3.15
cmake_policy(SET CMP0091 NEW)
project (ESBMC)
set (ESBMC_VERSION_MAJOR 7)
set (ESBMC_VERSION_MINOR 6)
set (ESBMC_VERSION_PATCH 1)
set (ESBMC_VERSION "${ESBMC_VERSION_MAJOR}.${ESBMC_VERSION_MINOR}.${ESBMC_VERSION_PATCH}")
# The only default solver available is smtlib
set (ESBMC_AVAILABLE_SOLVERS "smtlib")
#################################
# Configuration #
#################################
# Adds custom modules from ESBMC and default Options
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/scripts/cmake/")
# Set a default build type if none was specified
set(default_build_type "RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
endif()
# Set the possible values of build type for cmake-gui
set(CMAKE_CXX_FLAGS_DEBUGOPT "-O2 -g" CACHE STRING "C++ compiler flags for DebugOpt build" FORCE)
set(CMAKE_C_FLAGS_DEBUGOPT "-O2 -g" CACHE STRING "C compiler flags for DebugOpt build" FORCE)
#set(CMAKE_EXE_LINKER_FLAGS_DEBUGOPT "")
#set(CMAKE_SHARED_LINKER_FLAGS_DEBUGOPT "")
mark_as_advanced(
CMAKE_CXX_FLAGS_DEBUGOPT
CMAKE_C_FLAGS_DEBUGOPT
#CMAKE_EXE_LINKER_FLAGS_DEBUGOPT
#CMAKE_SHARED_LINKER_FLAGS_DEBUGOPT
)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo" "Sanitizer" "DebugOpt")
set(ESBMC_CXX_Clang_DEFAULTS -Wall -Wextra -pipe)
set(ESBMC_CXX_GNU_DEFAULTS -Wall -Wextra -pipe)
add_compile_options(${ESBMC_CXX_${CMAKE_CXX_COMPILER_ID}_DEFAULTS})
include(CheckIncludeFile)
check_include_file(unistd.h HAVE_UNISTD)
include(Utils)
include(OSConfiguration)
include(Options)
include(SendFileHack)
include(AppleConfiguration)
include(InstallFiles)
include(Sanitizers)
include(ClangTidy)
include(Coverage)
if(BUILD_STATIC)
include(BuildStatic)
endif()
# Copied from https://stackoverflow.com/questions/53877344/cannot-configure-cmake-to-look-for-homebrew-installed-version-of-bison
# On macOS, search Homebrew for keg-only versions of Bison and Flex. Xcode does
# not provide new enough versions for us to use.
if (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
execute_process(
COMMAND brew --prefix bison
RESULT_VARIABLE BREW_BISON
OUTPUT_VARIABLE BREW_BISON_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (BREW_BISON EQUAL 0 AND EXISTS "${BREW_BISON_PREFIX}")
message(STATUS "Found Bison keg installed by Homebrew at ${BREW_BISON_PREFIX}")
set(BISON_EXECUTABLE "${BREW_BISON_PREFIX}/bin/bison")
endif()
execute_process(
COMMAND brew --prefix flex
RESULT_VARIABLE BREW_FLEX
OUTPUT_VARIABLE BREW_FLEX_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (BREW_FLEX EQUAL 0 AND EXISTS "${BREW_FLEX_PREFIX}")
message(STATUS "Found Flex keg installed by Homebrew at ${BREW_FLEX_PREFIX}")
set(FLEX_EXECUTABLE "${BREW_FLEX_PREFIX}/bin/flex")
endif()
endif()
# This MUST be executed after BuildStatic since it sets Boost Static flags
find_package(Boost REQUIRED COMPONENTS filesystem system date_time program_options iostreams)
include(FindLocalLLVM)
include(ExternalDependencies)
# Optimization
include(OptimizationCCache)
include(WError)
if(ENABLE_OLD_FRONTEND)
find_package(BISON 2.6.1 REQUIRED)
find_package(FLEX 2.6.1 REQUIRED)
add_definitions(-DENABLE_OLD_FRONTEND)
endif()
if(ENABLE_SOLIDITY_FRONTEND)
add_definitions(-DENABLE_SOLIDITY_FRONTEND)
endif()
if(ENABLE_JIMPLE_FRONTEND)
add_definitions(-DENABLE_JIMPLE_FRONTEND)
endif()
if(ENABLE_PYTHON_FRONTEND)
add_definitions(-DENABLE_PYTHON_FRONTEND)
endif()
if(ENABLE_GOTO_CONTRACTOR)
add_compile_options(-DENABLE_GOTO_CONTRACTOR)
endif()
add_subdirectory(src)
include(Irep2Optimization)
# Generate ac_config.h. This must be generated after solvers
configure_file (
"${PROJECT_SOURCE_DIR}/scripts/cmake/cmake_config.in"
"${PROJECT_BINARY_DIR}/src/ac_config.h"
)
# This should be added after all source files
include(Docs)
include(CTest)
if(BUILD_TESTING)
enable_testing()
include_directories(src)
add_subdirectory(unit)
endif()
if(ENABLE_REGRESSION)
add_subdirectory(regression)
endif()
include(FindCsmith)