-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
162 lines (145 loc) · 6.88 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
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(regexperience VERSION 1.1 LANGUAGES C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(SOURCE_FILES
include/core/errors.h
include/core/match.h
include/core/regexperience.h
include/internal/common/helpers.h
include/internal/lexical_analysis/lexeme.h
include/internal/lexical_analysis/lexer.h
include/internal/lexical_analysis/token.h
include/internal/semantic_analysis/analyzer.h
include/internal/semantic_analysis/ast_node_factory.h
include/internal/semantic_analysis/ast_nodes/alternation.h
include/internal/semantic_analysis/ast_nodes/anchor.h
include/internal/semantic_analysis/ast_nodes/ast_node.h
include/internal/semantic_analysis/ast_nodes/binary_operator.h
include/internal/semantic_analysis/ast_nodes/concatenation.h
include/internal/semantic_analysis/ast_nodes/constant.h
include/internal/semantic_analysis/ast_nodes/empty.h
include/internal/semantic_analysis/ast_nodes/quantification.h
include/internal/semantic_analysis/ast_nodes/range.h
include/internal/semantic_analysis/ast_nodes/unary_operator.h
include/internal/state_machines/acceptors/acceptor_runnable.h
include/internal/state_machines/acceptors/dfa.h
include/internal/state_machines/acceptors/epsilon_nfa.h
include/internal/state_machines/acceptors/nfa.h
include/internal/state_machines/composite_state.h
include/internal/state_machines/fsm.h
include/internal/state_machines/fsm_convertible.h
include/internal/state_machines/fsm_initializable.h
include/internal/state_machines/fsm_modifiable.h
include/internal/state_machines/state.h
include/internal/state_machines/state_factory.h
include/internal/state_machines/transducers/mealy.h
include/internal/state_machines/transducers/transducer_runnable.h
include/internal/state_machines/transitions/deterministic_transition.h
include/internal/state_machines/transitions/mealy_transition.h
include/internal/state_machines/transitions/nondeterministic_transition.h
include/internal/state_machines/transitions/transition.h
include/internal/state_machines/transitions/transition_factory.h
include/internal/syntactic_analysis/derivation_item.h
include/internal/syntactic_analysis/grammar.h
include/internal/syntactic_analysis/occurrence.h
include/internal/syntactic_analysis/parser.h
include/internal/syntactic_analysis/parsing_table_key.h
include/internal/syntactic_analysis/production.h
include/internal/syntactic_analysis/rule.h
include/internal/syntactic_analysis/symbols/non_terminal.h
include/internal/syntactic_analysis/symbols/symbol.h
include/internal/syntactic_analysis/symbols/terminal.h
src/common/helpers.c
src/lexical_analysis/lexeme.c
src/lexical_analysis/lexer.c
src/lexical_analysis/token.c
src/match.c
src/regexperience.c
src/semantic_analysis/analyzer.c
src/semantic_analysis/ast_node_factory.c
src/semantic_analysis/ast_nodes/alternation.c
src/semantic_analysis/ast_nodes/anchor.c
src/semantic_analysis/ast_nodes/ast_node.c
src/semantic_analysis/ast_nodes/binary_operator.c
src/semantic_analysis/ast_nodes/concatenation.c
src/semantic_analysis/ast_nodes/constant.c
src/semantic_analysis/ast_nodes/empty.c
src/semantic_analysis/ast_nodes/quantification.c
src/semantic_analysis/ast_nodes/range.c
src/semantic_analysis/ast_nodes/unary_operator.c
src/state_machines/acceptors/acceptor_runnable.c
src/state_machines/acceptors/dfa.c
src/state_machines/acceptors/epsilon_nfa.c
src/state_machines/acceptors/nfa.c
src/state_machines/composite_state.c
src/state_machines/fsm.c
src/state_machines/fsm_convertible.c
src/state_machines/fsm_initializable.c
src/state_machines/fsm_modifiable.c
src/state_machines/state.c
src/state_machines/state_factory.c
src/state_machines/transducers/mealy.c
src/state_machines/transducers/transducer_runnable.c
src/state_machines/transitions/deterministic_transition.c
src/state_machines/transitions/mealy_transition.c
src/state_machines/transitions/nondeterministic_transition.c
src/state_machines/transitions/transition.c
src/state_machines/transitions/transition_factory.c
src/syntactic_analysis/derivation_item.c
src/syntactic_analysis/grammar.c
src/syntactic_analysis/occurrence.c
src/syntactic_analysis/parser.c
src/syntactic_analysis/parsing_table_key.c
src/syntactic_analysis/production.c
src/syntactic_analysis/rule.c
src/syntactic_analysis/symbols/non_terminal.c
src/syntactic_analysis/symbols/symbol.c
src/syntactic_analysis/symbols/terminal.c)
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
target_include_directories(${PROJECT_NAME} PRIVATE include)
target_include_directories(${PROJECT_NAME} PUBLIC include/core)
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
# GLib & GObject
pkg_check_modules(GLIB_GOBJECT glib-2.0>=2.54 gobject-2.0>=2.54)
if(GLIB_GOBJECT_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${GLIB_GOBJECT_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${GLIB_GOBJECT_LIBRARIES} ${GLIB_GOBJECT_LDFLAGS})
add_definitions(${GLIB_GOBJECT_CFLAGS} ${GLIB_GOBJECT_CFLAGS_OTHER})
message( STATUS "GLIB_GOBJECT_LIBRARIES: " ${GLIB_GOBJECT_LIBRARIES} )
message( STATUS "GLIB_GOBJECT_LIBRARY_DIRS: " ${GLIB_GOBJECT_LIBRARY_DIRS} )
message( STATUS "GLIB_GOBJECT_LDFLAGS: " ${GLIB_GOBJECT_LDFLAGS} )
message( STATUS "GLIB_GOBJECT_LDFLAGS_OTHER: " ${GLIB_GOBJECT_LDFLAGS_OTHER} )
message( STATUS "GLIB_GOBJECT_INCLUDE_DIRS: " ${GLIB_GOBJECT_INCLUDE_DIRS} )
message( STATUS "GLIB_GOBJECT_CFLAGS: " ${GLIB_GOBJECT_CFLAGS} )
message( STATUS "GLIB_GOBJECT_CFLAGS_OTHER: " ${GLIB_GOBJECT_CFLAGS_OTHER} )
else()
message( FATAL_ERROR "GLib & GObject >= 2.54 are required, exiting." )
endif()
# compiler-dependent options
# setting the desired linker explicitly on Unix systems (GNU linker is used on other systems, by default)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
target_compile_options (${PROJECT_NAME} PRIVATE -Wall -Wextra)
if(UNIX)
# linker (gold)
target_link_libraries(${PROJECT_NAME} -fuse-ld=gold)
endif()
elseif("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
target_compile_options (${PROJECT_NAME} PRIVATE -Weverything)
if(UNIX)
# linker (LLD)
target_link_libraries(${PROJECT_NAME} -fuse-ld=lld)
endif()
else()
message( FATAL_ERROR "Only Clang and GCC are supported, exiting." )
endif()
# common options
target_compile_options (${PROJECT_NAME} PRIVATE -pedantic)
# compiler being used
message( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
# build type
message( STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE} )