-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
75 lines (61 loc) · 2.84 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
cmake_minimum_required(VERSION 3.14)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0069 NEW)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif (NOT CMAKE_BUILD_TYPE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(PDAAAL_VERSION 1.1.0)
project(pdaaal VERSION ${PDAAAL_VERSION} LANGUAGES CXX)
# MAIN_PROJECT CHECK
# Determine if pdaaal is built as a subproject (using add_subdirectory) or if it is the main project
set(PDAAAL_MAIN_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(PDAAAL_MAIN_PROJECT ON)
endif()
option(PDAAAL_BuildTests "Build the unit tests of PDAAAL." ${PDAAAL_MAIN_PROJECT})
option(PDAAAL_Build_Main "Build the stand-alone PDAAAL binary." ${PDAAAL_MAIN_PROJECT})
option(PDAAAL_AddressSanitizer "Enables address sanitization during compilation." OFF)
option(PDAAAL_GetDependencies "Fetch external dependencies from web." ON)
option(PDAAAL_BuildBundle "Includes all but system libraries within the binary." OFF)
if (PDAAAL_BuildBundle)
set(BUILD_SHARED_LIBS OFF)
set(Boost_USE_STATIC_LIBS ON)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
endif (PDAAAL_BuildBundle)
option(PDAAAL_BuildStatic "Includes all (incl. system libraries) within the binary." OFF)
if (PDAAAL_BuildStatic)
set(BUILD_SHARED_LIBS OFF)
set(Boost_USE_STATIC_LIBS ON)
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "-static")
endif (PDAAAL_BuildStatic)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
if(PDAAAL_AddressSanitizer)
add_compile_options(-fno-omit-frame-pointer -fsanitize=address)
endif(PDAAAL_AddressSanitizer)
find_package(Boost 1.70 REQUIRED COMPONENTS program_options unit_test_framework)
#actual library
add_subdirectory(src)
if(PDAAAL_BuildTests)
#benchmark
add_subdirectory(benchmark)
#testing
add_subdirectory(test)
enable_testing()
add_test(NAME Weight_test COMMAND Weight_test)
add_test(NAME PDA_test COMMAND PDA_test)
add_test(NAME PAutomaton_test COMMAND PAutomaton_test)
add_test(NAME Solver_test COMMAND Solver_test)
add_test(NAME Reducer_test COMMAND Reducer_test)
add_test(NAME PDAFactory_test COMMAND PDAFactory_test)
add_test(NAME fut_set_test COMMAND fut_set_test)
add_test(NAME NFA_test COMMAND NFA_test)
add_test(NAME ParsingPDAFactory_test COMMAND ParsingPDAFactory_test)
add_test(NAME NfaParser_test COMMAND NfaParser_test)
add_test(NAME AutomatonPath_test COMMAND AutomatonPath_test)
if (PDAAAL_Build_Main) # We need the dependencies for pdaaal-bin to test it.
add_test(NAME Parser_test COMMAND Parser_test)
add_test(NAME Verification_test COMMAND Verification_test)
endif()
endif()