-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
189 lines (154 loc) · 6.15 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
cmake_minimum_required(VERSION 3.3)
project(tychon CXX)
set(BUILD_TYPES debug opt optlto profgen proflto)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra -pedantic\
-Wno-write-strings -Wno-unused-parameter -Wno-unused-function\
-D__STDC_LIMIT_MACROS -DDISABLE_STATIC_BP"
CACHE STRING "Flags used by the C++ compiler for all builds."
FORCE)
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'debug' as none was specified.")
message(STATUS "Possible build types include ${BUILD_TYPES}")
set(CMAKE_BUILD_TYPE debug)
else()
message(STATUS "Current build type is ${CMAKE_BUILD_TYPE}")
endif()
###############################################################################
## dependencies ###############################################################
###############################################################################
find_package(Boost 1.36.0 REQUIRED COMPONENTS program_options system)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Boost was not found!! Please set variables BOOST_ROOT or"
" CMAKE_PREFIX_PATH to search for it. Alternatively, you can manually set variables"
" Boost_INCLUDE_DIRS and Boost_LIBRARY_DIRS")
endif()
###############################################################################
## compiler flags #########################################################
###############################################################################
set(libesolver_output_path ${CMAKE_SOURCE_DIR}/lib/${CMAKE_BUILD_TYPE})
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
if(CMAKE_PREFIX_PATH)
include_directories(${CMAKE_PREFIX_PATH}/include)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb3 -O0 -fno-inline -fno-omit-frame-pointer" CACHE STRING
"Flags used by the C++ compiler during debug builds."
FORCE)
set(CMAKE_CXX_FLAGS_OPT "-O2 -g" CACHE STRING
"Flags used by the C++ compiler during opt builds."
FORCE)
set(CMAKE_CXX_FLAGS_OPTLTO "-O3 -flto=n" CACHE STRING
"Flags used by the C++ compiler during optlto builds."
FORCE)
set(PROFILE_DIR "${CMAKE_SOURCE_DIR}/bin/prof")
set(CMAKE_CXX_FLAGS_PROFGEN "-O3 -fprofile-generate=${PROFILE_DIR}" CACHE STRING
"Flags used by the C++ compiler during prof builds."
FORCE)
set(CMAKE_CXX_FLAGS_PROFLTO "-O3 -flto=n -fprofile-use=${PROFILE_DIR}" CACHE STRING
"Flags used by the C++ compiler during proflto builds."
FORCE)
###############################################################################
## target definitions #########################################################
###############################################################################
set(tychon_source_files
src/descriptions/GrammarNodes.cpp
src/descriptions/Operators.cpp
src/descriptions/Grammar.cpp
src/descriptions/Builtins.cpp
src/descriptions/FunctorBase.cpp
src/descriptions/ESType.cpp
src/values/ValueManager.cpp
src/values/Signature.cpp
src/values/ConcreteValueBase.cpp
src/z3interface/Z3TheoremProver.cpp
src/z3interface/Z3Objects.cpp
src/z3interface/TheoremProver.cpp
src/main-solvers/SynthLib2Solver.cpp
src/scoping/ScopeManager.cpp
src/scoping/ESolverScope.cpp
src/partitions/PartitionGenerator.cpp
src/partitions/CrossProductGenerator.cpp
src/partitions/SymPartitionGenerator.cpp
src/external/spookyhash/SpookyHash.cpp
src/solverutils/ConcreteEvaluator.cpp
src/solverutils/TypeManager.cpp
src/solverutils/ConstManager.cpp
src/solverutils/EvalRule.cpp
src/logics/BVLogic.cpp
src/logics/ESolverLogic.cpp
src/logics/LIALogic.cpp
src/utils/Indent.cpp
src/utils/ResourceLimitManager.cpp
src/utils/UIDGenerator.cpp
src/utils/GNCostPair.cpp
src/utils/Logger.cpp
src/utils/TimeValue.cpp
src/utils/MemStats.cpp
src/enumerators/EnumeratorBase.cpp
src/enumerators/CFGEnumerator.cpp
src/exceptions/ESException.cpp
src/solvers/ESolver.cpp
src/solvers/CEGSolver.cpp
src/visitors/SpecRewriter.cpp
src/visitors/Gatherers.cpp
src/visitors/ExpCheckers.cpp
src/visitors/ExpressionVisitorBase.cpp
src/expressions/ExprManager.cpp
src/expressions/GenExpression.cpp
src/expressions/UserExpression.cpp
src/visitors/PBEConsequentsInitializer.cpp
src/visitors/DecisionTreeNodeLocator.cpp
src/solverutils/DecisionTreeExprBuilder.cpp
src/solverutils/DecisionTreeNode.cpp
src/visitors/ExpressionSizeCounter.cpp)
set(main_source_file src/main/ESolverSynthLib.cpp)
add_library(libsynthlib2parser STATIC IMPORTED)
find_library(libsynthlib2parser_path NAMES "libsynthlib2parser.a")
if(NOT libsynthlib2parser_path)
message(FATAL_EROR "Could not find synthlib2parser library!")
endif()
if(${CMAKE_BUILD_TYPE} MATCHES "lto")
add_library(libz3 STATIC IMPORTED)
find_library(libz3_path NAMES "libz3.a")
else()
add_library(libz3 SHARED IMPORTED)
find_library(libz3_path NAMES "libz3.so")
endif()
if(NOT libz3_path)
message(FATAL_EROR "Could not find z3 library!")
endif()
set_target_properties(libsynthlib2parser PROPERTIES
IMPORTED_LOCATION ${libsynthlib2parser_path})
set_target_properties(libz3 PROPERTIES
IMPORTED_LOCATION ${libz3_path})
add_library(libesolver_static STATIC ${tychon_source_files})
add_executable(tychon ${main_source_file})
set_target_properties(libesolver_static PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${libesolver_output_path})
set_target_properties(libesolver_static PROPERTIES
OUTPUT_NAME esolver
CLEAN_DIRECT_OUTPUT 1)
set_target_properties(tychon PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
target_link_libraries(tychon
libesolver_static
libsynthlib2parser
libz3
-fopenmp
rt
${Boost_LIBRARIES})
###############################################################################
## packaging ##################################################################
###############################################################################
# Install dir is relative to CMAKE_INSTALL_PREFIX which is /usr/local by default
# install(TARGETS esolverlib-static
# LIBRARY DESTINATION lib
# ARCHIVE DESTINATION lib
# )
# set(public-headers
# )
#
# # Install header files
# install(FILES ${public-headers} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/synthlib2parser/)
# for uninstalling use the following command
# $ xargs rm < install_manifest.txt