forked from seahorn/seahorn
-
Notifications
You must be signed in to change notification settings - Fork 27
/
CMakeLists.txt
171 lines (142 loc) · 4.76 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
cmake_minimum_required(VERSION 2.8.11)
project (AeVal)
set (AeVal_VERSION_MAJOR 1)
set (AeVal_VERSION_MINOR 0)
if (NOT PACKAGE_VERSION)
set(PACKAGE_VERSION
"${AeVal_VERSION_MAJOR}.${AeVal_VERSION_MINOR}.${AeVal_VERSION_PATCH}")
if (DEFINED AeVal_VERSION_TWEAK)
set (PACKAGE_VERSION "${PACKAGE_VERSION}-${AeVal_VERSION_TWEAK}")
endif()
set (AeVal_VERSION_INFO ${PACKAGE_VERSION})
endif()
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
message (FATAL_ERROR
"In-source builds are not allowed. Please clean your source tree and try again.")
endif()
enable_testing()
include (CTest)
# Add path for custom modules
list (APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option (AeVal_STATIC_EXE "Static executable." OFF)
set (CUSTOM_BOOST_ROOT "" CACHE PATH "Path to custom boost installation.")
if (CUSTOM_BOOST_ROOT)
set (BOOST_ROOT ${CUSTOM_BOOST_ROOT})
set (Boost_NO_SYSTEM_PATHS "ON")
endif()
# put static libraries first
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
set (Boost_USE_STATIC_LIBS ON)
set (BOOST_COMPONENTS system)
if (UNIT_TESTS)
set (BOOST_COMPONENTS ${BOOST_COMPONENTS} unit_test_framework)
endif()
find_package (Boost 1.71 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if (Boost_FOUND)
include_directories (${Boost_INCLUDE_DIRS})
endif ()
include(ExternalProject)
set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
set (Z3_TAG "z3-4.8.10" CACHE STRING "Z3 git tag to use")
set (Z3_REPO "https://github.com/Z3Prover/z3.git" CACHE STRING "Z3 repo")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set (Z3_DEBUG "-d")
else()
set (Z3_DEBUG "")
endif()
ExternalProject_Add(z3
GIT_REPOSITORY ${Z3_REPO}
GIT_TAG ${Z3_TAG}
BUILD_IN_SOURCE 1
INSTALL_DIR ${CMAKE_BINARY_DIR}/run
CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER}
./configure -p <INSTALL_DIR> -b build --staticlib ${Z3_DEBUG}
BUILD_COMMAND make -j3 -C build
INSTALL_COMMAND make -C build install
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_LIST_FILE}
LOG_CONFIGURE 1
LOG_INSTALL 1
LOG_BUILD 1)
find_package(Z3 4.8.10)
if (NOT Z3_FOUND)
ExternalProject_Get_Property (z3 INSTALL_DIR)
set(Z3_ROOT ${INSTALL_DIR} CACHE PATH "Forced location of Z3" FORCE)
message(WARNING "No Z3 found. Run \n\tcmake --build . && cmake ${CMAKE_SOURCE_DIR}")
return()
else()
set_target_properties(z3 PROPERTIES EXCLUDE_FROM_ALL ON)
include_directories(${Z3_INCLUDE_DIR})
message ("Found Z3 at ${Z3_EXECUTABLE}")
# indicate that we want z3 binary to be included in the binary distribution
install (PROGRAMS ${Z3_EXECUTABLE} DESTINATION bin)
endif()
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.md DESTINATION .)
# install all the licenses
install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/license.txt
DESTINATION share/doc/AeVal
RENAME AeVal_license.txt)
if (EXISTS z3-prefix/src/z3/LICENSE.txt)
install (
FILES
${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/LICENSE.txt
DESTINATION share/doc/AeVal
RENAME z3_license.txt)
endif()
if (EXISTS ${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/build)
file(GLOB z3py
${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/build/*.py?
${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/build/*.py?
${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/build/*.so
${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/build/*.dylib
${CMAKE_CURRENT_BINARY_DIR}/z3-prefix/src/z3/build/*.dll
)
install(FILES ${z3py} DESTINATION lib/z3py)
endif()
find_package(OpenMP)
if (OPENMP_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
endif()
find_package(Gmp REQUIRED)
if (GMP_FOUND)
include_directories (${GMP_INCLUDE_DIR})
include_directories (${GMPXX_INCLUDE_DIR})
else()
set(GMP_LIB "")
set(GMPXX_LIB "")
endif()
find_package(BISON 3.2 REQUIRED)
install(DIRECTORY src/
DESTINATION src
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.hh"
PATTERN "*.h"
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/src/
DESTINATION src
FILES_MATCHING
PATTERN "*.hpp"
PATTERN "*.hh"
PATTERN "*.h"
PATTERN "CMakeFiles" EXCLUDE
PATTERN ".svn" EXCLUDE
)
set(CMAKE_CXX_EXTENSIONS ON)
add_definitions(-Wno-redeclared-class-member -Wno-sometimes-uninitialized)
add_definitions(-Wno-covered-switch-default)
add_definitions(-Wno-inconsistent-missing-override)
set(CMAKE_CXX_STANDARD 11)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
add_definitions( -Wno-unused-local-typedefs)
endif ()
### add our include directories to the front, overriding directories
### specified by external packages.
include_directories(BEFORE
${CMAKE_CURRENT_SOURCE_DIR}/src)
# add the include directory from the build tree
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/src)
add_subdirectory(src)
add_subdirectory(tools)