forked from SRI-CSL/sally
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
89 lines (73 loc) · 2.7 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
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project(sally CXX)
enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall")
# If ENABLE_COVERAGE is defined, try to set coverage flags.
if (ENABLE_COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
endif()
# Default is release with debug info
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
# Add the target for the check
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
# Find the Boost libraries
find_package(Boost 1.53.0 COMPONENTS program_options iostreams thread system REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
# Come settings based on word size
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ANTLR_CONFIG_FLAG "--enable-64bit")
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ANTLR_CONFIG_FLAG "")
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
# Find the GMP number library
if (SALLY_STATIC_BUILD)
find_library(GMP_LIBRARY libgmp.a gmp)
else()
find_library(GMP_LIBRARY gmp)
endif()
if (GMP_LIBRARY)
message(STATUS "GMP library: " ${GMP_LIBRARY})
else()
message(FATAL_ERROR "Could not the GMP number library (sudo apt-get install libgmp-dev)")
endif()
# Find Yices
SET(YICES2_HOME CACHE STRING "Yices2 installation directory")
find_package(Yices2 2.3.0)
if (YICES2_FOUND)
add_definitions(-DWITH_YICES2)
include_directories(${YICES2_INCLUDE_DIR})
endif()
# Find MathSAT5
SET(MATHSAT5_HOME CACHE STRING "MathSAT5 installation directory")
find_package(MathSAT5 5.3.3)
if (MATHSAT5_FOUND)
add_definitions(-DWITH_MATHSAT5)
include_directories(${MATHSAT5_INCLUDE_DIR})
endif()
# Make sure antlr C runtime is here
include(ExternalProject)
ExternalProject_Add(
libantlr3c-3.4
URL "${sally_SOURCE_DIR}/antlr/libantlr3c-3.4.tar.gz"
URL_MD5 08b1420129d5dccd0f4461cedf2a0d7d
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${ANTLR_CONFIG_FLAG} --enable-debuginfo --disable-antlrdebug --prefix=<INSTALL_DIR>
BUILD_IN_SOURCE 1
)
ExternalProject_Get_Property(libantlr3c-3.4 INSTALL_DIR)
set(ANTLR3C_INCLUDE_DIR "${INSTALL_DIR}/include")
set(ANTLR3C_LIBRARY_DIR "${INSTALL_DIR}/lib")
set(ANTLR3C_LIBRARY "antlr3c")
link_directories(${ANTLR3C_LIBRARY_DIR})
# The antl3 binary
set(ANTLR "${sally_SOURCE_DIR}/antlr/antlr3")
# Add includes
include_directories(${sally_SOURCE_DIR}/src ${ANTLR3C_INCLUDE_DIR})
# Configure the subdirectories
add_subdirectory(src)
# Add the test project
add_subdirectory(test)