-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
150 lines (125 loc) · 4.58 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
#
# This file is part of Lydia.
#
# Lydia is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Lydia is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with Lydia. If not, see <https://www.gnu.org/licenses/>.
#
# CMake build : global project
cmake_minimum_required(VERSION 3.10)
project (Lydia
LANGUAGES CXX
HOMEPAGE_URL https://github.com/whitemech/lydia.git
DESCRIPTION "Lydia is a tool for LDLf translation to DFA and for LDLf synthesis.")
set(PROJECT_VERSION "0.1.3")
set(${PROJECT_NAME}_VERSION ${PROJECT_VERSION})
add_definitions( -DLYDIA_VERSION="${PROJECT_VERSION}" )
set_property (GLOBAL PROPERTY USE_FOLDERS ON)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 4.8
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
message(FATAL_ERROR "GCC version must be at least 8!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# require at least clang 3.2
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)
message(FATAL_ERROR "Clang version must be at least 6!")
endif()
else()
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
endif()
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
message("-- Using build type ${CMAKE_BUILD_TYPE}")
# TODO introduce '-Werror', eventually
#set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wpedantic")
# these cannot be added due to Flex/Bison
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -fno-exceptions")
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -fno-rtti")
if ((ENABLE_COVERAGE) AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
message("-- Code coverage enabled")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ftest-coverage")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
endif()
if (PROFILE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
endif()
# TODO include this eventually
#set(CMAKE_CXX_CLANG_TIDY
# clang-tidy;
# -header-filter=.;
# -checks=*;
# -warnings-as-errors=*;)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}"
"${CMAKE_ROOT_DIR}/cmake/Modules"
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
set (CMAKE_SKIP_INSTALL_ALL_DEPENDENCY TRUE)
# by default, Syft is enabled
if (NOT DEFINED WITH_SYFT)
set(WITH_SYFT ON)
endif()
# by default, tests are enabled
if (NOT DEFINED LYDIA_ENABLE_TESTS)
set(LYDIA_ENABLE_TESTS ON)
endif()
# by default, benchmark are enabled
if (NOT DEFINED LYDIA_ENABLE_BENCHMARK)
set(LYDIA_ENABLE_BENCHMARK ON)
endif()
# by default, dynamic linking is configured
# handle CUDD configuration for static/dynamic linking
if (NOT DEFINED CUDD_USE_STATIC_LIBS)
set(CUDD_USE_STATIC_LIBS OFF)
endif()
if (CUDD_USE_STATIC_LIBS)
message("-- CUDD configured to be linked statically")
else()
message("-- CUDD configured to be linked dynamically")
endif()
# handle MONA configuration for static/dynamic linking
if (NOT DEFINED MONA_USE_STATIC_LIBS)
set(MONA_USE_STATIC_LIBS OFF)
endif()
if (MONA_USE_STATIC_LIBS)
message("-- MONA configured to be linked statically")
else()
message("-- MONA configured to be linked dynamically")
endif()
set (THREADS_PREFER_PTHREAD_FLAG ON)
find_package (Threads REQUIRED)
find_package(CUDD REQUIRED)
find_package(MONA REQUIRED)
find_package(Graphviz REQUIRED)
find_package(BISON 3.0 REQUIRED)
find_package(FLEX 2.6 REQUIRED)
if (WITH_SYFT)
find_package(Syft REQUIRED)
endif()
add_subdirectory (third_party EXCLUDE_FROM_ALL)
add_subdirectory (lib)
add_subdirectory (app)
if (LYDIA_ENABLE_BENCHMARK)
add_subdirectory (benchmark)
else()
message("-- Benchmarks have been disabled because LYDIA_ENABLE_BENCHMARK was set to false.")
endif()
if (NOT LYDIA_ENABLE_TESTS)
enable_testing ()
endif()