-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
135 lines (110 loc) · 2.54 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
#
# Copyright (C) 2020-2021, Thomas Maier-Komor
#
# This file belongs to Wire-Format-Compiler.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
cmake_minimum_required(VERSION 3.8.0)
project(wfc)
# version determination
find_package(Hg)
# flex/bison
find_package(BISON 3.0 REQUIRED)
find_package(FLEX 2.6 REQUIRED)
BISON_TARGET(xproto_y
src/xproto.y
src/xproto.cc
#${CMAKE_CURRENT_BINARY_DIR}/xproto_y.cpp
COMPILE_FLAGS "-Lc++ --defines=xproto.h"
DEFINES_FILE src/xproto.h
)
FLEX_TARGET(xproto_l
src/xproto.l
${CMAKE_CURRENT_BINARY_DIR}/xproto_l.cpp
COMPILE_FLAGS "-F -R --bison-locations"
)
ADD_FLEX_BISON_DEPENDENCY(xproto_l xproto_y)
# generic stuff
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -Isrc")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
include_directories(${CAMKE_CURRENT_BINARY_DIR} src)
add_custom_target(
version_h
COMMAND bash mkversion.sh
OUTPUT src/version.h
WORKING_DIRECTORY src
)
add_custom_command(
OUTPUT src/template_lib.cc
COMMAND bash genlib.sh
WORKING_DIRECTORY src
)
add_executable(wfc
src/CodeGenerator.cc
src/CodeLibrary.cc
src/CodeTemplate.cc
src/CppGenerator.cc
src/Decoder.cc
src/Enum.cc
src/Evaluator.cc
src/Field.cc
src/FoldCompounds.cc
src/Generator.cc
src/Indenter.cc
src/io.cc
src/keywords.cc
src/log.cc
src/Message.cc
src/Options.cc
src/PBFile.cc
src/ProtoDriver.cc
src/template_lib.cc
src/wfc.cc
src/wirefuncs.cc
src/XmlGenerator.cc
${BISON_xproto_y_OUTPUTS}
${FLEX_xproto_l_OUTPUTS}
)
target_compile_features(wfc
PRIVATE cxx_std_11
)
add_dependencies(wfc
version_h
)
file(GLOB SHAREDFILES
share/*.cc
share/*.cct
)
file(GLOB HEADERS
include/*.h
)
install(
FILES bin/wfc
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(
FILES doc/wfc.1
DESTINATION man/man1
)
install(
FILES ${HEADERS}
DESTINATION include
)
install(
FILES ${SHAREDFILES}
DESTINATION share
)