-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
171 lines (156 loc) · 5.11 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
cmake_minimum_required(VERSION 3.5)
project(elvex VERSION 2.27.0)
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_CXX_STANDARD 11)
include_directories(src)
find_package(BISON)
if (BISON_FOUND)
BISON_TARGET(rulesyacc src/rulesyacc.y ${CMAKE_CURRENT_BINARY_DIR}/src/rulesyacc.cc
DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/src/rulesyacc.hpp
COMPILE_FLAGS "-p rules")
else()
message("bison not found")
endif()
find_package(FLEX)
if (FLEX_FOUND)
FLEX_TARGET(ruleslex src/ruleslex.l ${CMAKE_CURRENT_BINARY_DIR}/src/ruleslex.cc
COMPILE_FLAGS "-Prules")
else()
message("flex not found")
endif()
ADD_FLEX_BISON_DEPENDENCY(ruleslex rulesyacc)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(ELVEX_COMMON_SOURCES
${BISON_rulesyacc_OUTPUTS}
${FLEX_ruleslex_OUTPUTS}
src/bitset.cc
src/bitset.hpp
src/compacted-lexicon-buffer.cc
src/compacted-lexicon-buffer.hpp
src/compacted-lexicon-fsa.cc
src/compacted-lexicon-fsa.hpp
src/compacted-lexicon-info.cc
src/compacted-lexicon-info.hpp
src/compacted-lexicon-tree.cc
src/compacted-lexicon-tree.hpp
src/compacted-lexicon.cc
src/compacted-lexicon.hpp
src/config.hpp
src/entries.cc
src/entries.hpp
src/entry.cc
src/entry.hpp
src/environment.cc
src/environment.hpp
src/facade.cc
src/facade.hpp
src/fatal_exception.cc
src/fatal_exception.hpp
src/feature.cc
src/feature.hpp
src/features.cc
src/features.hpp
src/flags.cc
src/flags.hpp
src/forest.cc
src/forest.hpp
src/forestidentifier.cc
src/forestidentifier.hpp
src/forestmap.cc
src/forestmap.hpp
src/generator.cc
src/generator.hpp
src/item.cc
src/item.hpp
src/itemset.cc
src/itemset.hpp
src/lexicon.cc
src/lexicon.hpp
src/listfeatures.cc
src/listfeatures.hpp
src/memoization-map.cc
src/memoization-map.hpp
src/memoization-value.cc
src/memoization-value.hpp
src/messages.hpp
src/node.cc
src/node.hpp
src/pairp.cc
src/pairp.hpp
src/parser.cc
src/parser.hpp
src/parser_exception.cc
src/parser_exception.hpp
src/rule.cc
src/rule.hpp
src/rules.cc
src/rules.hpp
src/serializable.cc
src/serializable.hpp
src/shared_ptr.hpp
src/statement.cc
src/statement.hpp
src/statements.cc
src/statements.hpp
src/terms.cc
src/terms.hpp
src/uniq-id.cc
src/uniq-id.hpp
src/usage_exception.cc
src/usage_exception.hpp
src/value.cc
src/value.hpp
src/variableflag.cc
src/variableflag.hpp
src/vartable.cc
src/vartable.hpp)
configure_file(
src/config.hpp.in
src/config.hpp
@ONLY)
add_executable(elvex ${ELVEX_COMMON_SOURCES} src/elvex.cc src/fatal_exception.cc src/fatal_exception.hpp)
target_compile_options(elvex PUBLIC -O4 -Wall -Wextra -Wno-deprecated -Wno-sign-compare -Wno-missing-field-initializers
#target_compile_options(elvex PUBLIC -g -Wall -Wextra -Wno-deprecated -Wno-sign-compare -Wno-missing-field-initializers
#-DDEBUGYACC\(x\)=x
#-DDEBUGLEX\(x\)=x
)
find_package(LibXml2 REQUIRED)
if (LibXml2_FOUND)
target_compile_definitions(elvex PUBLIC
MAXFLAGS=16
OUTPUT_XML
MAXBITS=512
MAXLENGTH=12000
MAXUSAGES=12000
MAXITEMS=12000
MAXATTEMPTS=1200
#TRACE_ENVIRONMENT
#TRACE_BUILD_ENVIRONMENT
#TRACE_ENABLE_STATEMENT
#TRACE_APPLY_STATEMENT
#TRACE_FEATURES
#TRACE_STEP
#TRACE_PASS
#TRACE_UNFOLD
#TRACE_MEMOIZATION
#TRACE_LEXICON
)
target_link_libraries(elvex PUBLIC ${LIBXML2_LIBRARIES})
target_include_directories(elvex PUBLIC ${LIBXML2_INCLUDE_DIR})
else()
message("libxml2 not found")
endif()
add_executable(elvexlexicon ${ELVEX_COMMON_SOURCES} src/buildlexicon.cc)
target_compile_options(elvexlexicon PUBLIC -O4 -Wall -Wextra -Wno-deprecated -Wno-sign-compare -Wno-missing-field-initializers)
target_compile_definitions(elvexlexicon PUBLIC
#TRACE_DIFF
)
FLEX_TARGET(postedition_en src/postedition_en.l ${CMAKE_CURRENT_BINARY_DIR}/src/postedition_en.cc)
add_executable(elvexpostedition_en ${FLEX_postedition_en_OUTPUTS})
target_compile_options(elvexpostedition_en PUBLIC -O4 -Wall -Wextra -Wno-deprecated -Wno-sign-compare -Wno-missing-field-initializers)
FLEX_TARGET(postedition_fr src/postedition_fr.l ${CMAKE_CURRENT_BINARY_DIR}/src/postedition_fr.cc)
add_executable(elvexpostedition_fr ${FLEX_postedition_fr_OUTPUTS})
target_compile_options(elvexpostedition_fr PUBLIC -O4 -Wall -Wextra -Wno-deprecated -Wno-sign-compare -Wno-missing-field-initializers)
install(TARGETS elvex elvexlexicon elvexpostedition_en elvexpostedition_fr
RUNTIME DESTINATION bin)