-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
193 lines (150 loc) · 3.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
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
cmake_minimum_required(VERSION 3.12)
set(CPPM_VERSION 0.0.13)
include(cmake/cppm_loader.cmake)
cppm_project()
project(serdepp VERSION 0.1.4 LANGUAGES C CXX)
cppm_setting()
cppm_cxx_standard(17)
cppm_compiler_option(
DEBUG
CLANG "-fprofile-instr-generate -fcoverage-mapping --coverage"
)
find_cppkg(Catch2 3.5.0 MODULE Catch2::Catch2WithMain TYPE lib OPTIONAL OFF)
find_cppkg(RapidJSON 1.1.1 MODULE rapidjson TYPE lib OPTIONAL OFF)
find_cppkg(benchmark 1.5.2 MODULE benchmark::benchmark TYPE lib OPTIONAL OFF)
find_cppkg(fmt 10.2.0 MODULE fmt::fmt-header-only TYPE lib OPTIONAL OFF)
find_cppkg(magic_enum 0.9.5 MODULE magic_enum::magic_enum TYPE lib)
find_cppkg(nameof 0.10.3 MODULE nameof::nameof TYPE lib)
find_cppkg(nlohmann_json 3.11.3 MODULE nlohmann_json::nlohmann_json TYPE lib OPTIONAL OFF)
find_cppkg(toml11 3.7.1 MODULE toml11::toml11 TYPE lib OPTIONAL OFF)
find_cppkg(yaml-cpp 0.6.3 MODULE yaml-cpp TYPE lib OPTIONAL OFF)
cppm_target_define(serdepp STATIC
SOURCES
src/to_static.cpp
)
cppm_examples_area()
if(SERDEPP_BUILD_EXAMPLES)
cppm_target_define(serde_example1 BINARY
SOURCES
examples/example1.cpp
)
cppm_target_define(serde_example BINARY
SOURCES
examples/example.cpp
)
cppm_target_define(simple_example BINARY
SOURCES
examples/simple_example.cpp
)
cppm_target_define(flatten_example BINARY
SOURCES
examples/flatten.cpp
)
cppm_target_define(variant_example BINARY
SOURCES
examples/variant.cpp
)
cppm_target_define(parse_file_example BINARY
SOURCES
examples/parse_file.cpp
)
cppm_target_define(struct_attribute_example BINARY
SOURCES
examples/struct_attribute.cpp
)
cppm_target_define(sugar BINARY
SOURCES
examples/sugar.cpp
)
cppm_target_define(reflection BINARY
SOURCES
examples/reflection.cpp
)
cppm_target_define(print BINARY
SOURCES
examples/print.cpp
)
cppm_target_define(pointer BINARY
SOURCES
examples/pointer.cpp
)
endif()
cppm_unit_test_area()
if(SERDEPP_BUILD_TESTING)
cppm_target_define(unittest BINARY
SOURCES
tests/serializer.cpp
tests/rapid_json.cpp
tests/yaml_cpp.cpp
tests/toml11.cpp
tests/reflection.cpp
tests/nlohmann_json.cpp
tests/test_struct.hpp
)
endif()
end_cppm_unit_test_area()
if(SERDEPP_BUILD_BENCHMARKS)
cppm_target_define(benchmark BINARY
SOURCES
benchmark/benchmark.cpp
)
cppm_target_define(data_type_benchmark BINARY
SOURCES
benchmark/data_type_benchmark.cpp
)
cppm_target_define(syntax_sugar_benchmark BINARY
SOURCES
benchmark/syntax_benchmark.cpp
)
endif()
set(serdepp_global_deps
PRIVATE benchmark Catch2
PUBLIC RapidJSON nlohmann_json toml11 yaml-cpp fmt magic_enum nameof)
cppm_target_dependencies(serdepp
${serdepp_global_deps})
cppm_target_dependencies(serde_example1
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(serde_example
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(simple_example
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(flatten_example
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(variant_example
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(parse_file_example
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(struct_attribute_example
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(sugar
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(reflection
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(print
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(pointer
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(unittest
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(benchmark
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(data_type_benchmark
${serdepp_global_deps}
serdepp)
cppm_target_dependencies(syntax_sugar_benchmark
${serdepp_global_deps}
serdepp)
cppm_target_install(serdepp)