forked from porla/porla
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
242 lines (213 loc) · 6.94 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
cmake_minimum_required(VERSION 3.12)
set(VCPKG_OVERLAY_TRIPLETS ${CMAKE_CURRENT_SOURCE_DIR}/vendor/vcpkg-triplets)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vendor/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
project(porla)
set(CMAKE_CXX_STANDARD 20)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(antlr4-runtime CONFIG REQUIRED)
find_package(Boost REQUIRED COMPONENTS log program_options system)
find_package(CURL CONFIG REQUIRED)
find_package(GTest CONFIG REQUIRED)
find_package(libzip CONFIG REQUIRED)
find_package(LibtorrentRasterbar CONFIG REQUIRED)
find_package(Lua REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(tomlplusplus CONFIG REQUIRED)
find_package(unofficial-sodium CONFIG REQUIRED)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(uriparser CONFIG REQUIRED)
find_path(JWT_CPP_INCLUDE_DIRS "jwt-cpp/base.h")
include_directories(${ANTLR4_INCLUDE_DIR})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.cpp
${CMAKE_CURRENT_BINARY_DIR}/_version.cpp
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_SOURCE_DIR}/cmake/GenerateVersion.cmake)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/webui.cpp
${CMAKE_CURRENT_BINARY_DIR}/_webui.cpp
COMMAND ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FileEmbed.cmake)
add_library(
${PROJECT_NAME}_utils
src/utils/ratio.cpp
)
target_link_libraries(
${PROJECT_NAME}_utils
PRIVATE
LibtorrentRasterbar::torrent-rasterbar
)
add_library(
${PROJECT_NAME}_query
STATIC
src/query/_aux/PorlaQueryLangBaseVisitor.cpp
src/query/_aux/PorlaQueryLangLexer.cpp
src/query/_aux/PorlaQueryLangParser.cpp
src/query/_aux/PorlaQueryLangVisitor.cpp
src/query/pql.cpp
)
target_link_libraries(
${PROJECT_NAME}_query
PRIVATE
${PROJECT_NAME}_utils
antlr4_static
LibtorrentRasterbar::torrent-rasterbar
)
add_library(
${PROJECT_NAME}_core
STATIC
${CMAKE_CURRENT_BINARY_DIR}/version.cpp
${CMAKE_CURRENT_BINARY_DIR}/webui.cpp
src/authinithandler.cpp
src/authloginhandler.cpp
src/buildinfo.cpp
src/cmdargs.cpp
src/config.cpp
src/embeddedwebuihandler.cpp
src/logger.cpp
src/httpclient.cpp
src/httpeventstream.cpp
src/httpjwtauth.cpp
src/httpserver.cpp
src/httpsession.cpp
src/jsonrpchandler.cpp
src/metricshandler.cpp
src/session.cpp
src/systemhandler.cpp
src/uri.cpp
src/utils/eta.cpp
src/utils/secretkey.cpp
src/utils/string.cpp
src/data/migrate.cpp
src/data/migrations/0001_initialsetup.cpp
src/data/migrations/0002_addsessionsettings.cpp
src/data/migrations/0003_users.cpp
src/data/migrations/0004_removesessionparams.cpp
src/data/migrations/0005_metadata.cpp
src/data/migrations/0006_clientdata.cpp
src/data/migrations/0007_removesessionsettings.cpp
src/data/models/addtorrentparams.cpp
src/data/models/users.cpp
src/data/statement.cpp
src/lua/usertypes/lttorrenthandle.cpp
src/lua/usertypes/torrent.cpp
src/lua/usertypes/workflow.cpp
src/lua/usertypes/workflowactionexec.cpp
src/lua/usertypes/workflowactionhttprequest.cpp
src/lua/usertypes/workflowactionlog.cpp
src/lua/usertypes/workflowactionpushdiscord.cpp
src/lua/usertypes/workflowactionpushntfy.cpp
src/lua/usertypes/workflowactionsleep.cpp
src/lua/usertypes/workflowactiontorrentflags.cpp
src/lua/usertypes/workflowactiontorrentmove.cpp
src/lua/usertypes/workflowactiontorrentpause.cpp
src/lua/usertypes/workflowactiontorrentreannounce.cpp
src/lua/usertypes/workflowactiontorrentremove.cpp
src/lua/usertypes/workflowtriggercron.cpp
src/lua/usertypes/workflowtriggerinterval.cpp
src/lua/usertypes/workflowtriggertorrentadded.cpp
src/lua/usertypes/workflowtriggertorrentfinished.cpp
src/lua/usertypes/workflowtriggertorrentmoved.cpp
src/lua/workflows/workflowengine.cpp
src/lua/workflows/workflowfilter.cpp
src/lua/workflows/workflowrunner.cpp
src/lua/workflows/actions/exec.cpp
src/lua/workflows/actions/function.cpp
src/lua/workflows/actions/httprequest.cpp
src/lua/workflows/actions/log.cpp
src/lua/workflows/actions/pushdiscord.cpp
src/lua/workflows/actions/pushntfy.cpp
src/lua/workflows/actions/sleep.cpp
src/lua/workflows/actions/torrentflags.cpp
src/lua/workflows/actions/torrentmove.cpp
src/lua/workflows/actions/torrentpause.cpp
src/lua/workflows/actions/torrentreannounce.cpp
src/lua/workflows/actions/torrentremove.cpp
src/lua/workflows/triggers/cron.cpp
src/lua/workflows/triggers/interval.cpp
src/lua/workflows/triggers/torrentadded.cpp
src/lua/workflows/triggers/torrentfinished.cpp
src/lua/workflows/triggers/torrentmoved.cpp
src/methods/fsspace.cpp
src/methods/presetslist.cpp
src/methods/sessionpause.cpp
src/methods/sessionresume.cpp
src/methods/sessionsettingslist.cpp
src/methods/sysversions.cpp
src/methods/torrentsadd.cpp
src/methods/torrentsfileslist.cpp
src/methods/torrentslist.cpp
src/methods/torrentsmetadatalist.cpp
src/methods/torrentsmove.cpp
src/methods/torrentspause.cpp
src/methods/torrentspeersadd.cpp
src/methods/torrentspeerslist.cpp
src/methods/torrentspropertiesget.cpp
src/methods/torrentsrecheck.cpp
src/methods/torrentsremove.cpp
src/methods/torrentsresume.cpp
src/methods/torrentspropertiesset.cpp
src/methods/torrentstrackerslist.cpp
src/tools/authtoken.cpp
src/tools/generatesecretkey.cpp
src/tools/versionjson.cpp
)
target_compile_definitions(
${PROJECT_NAME}_core
PUBLIC
-DSQLITE_CORE
)
target_include_directories(
${PROJECT_NAME}_core
PUBLIC
${JWT_CPP_INCLUDE_DIRS}
${LUA_INCLUDE_DIR}
vendor/croncpp/include
vendor/sol2/include
)
target_link_libraries(
${PROJECT_NAME}_core
${PROJECT_NAME}_query
${PROJECT_NAME}_utils
${LUA_LIBRARIES}
Boost::boost
Boost::log
Boost::program_options
CURL::libcurl
libzip::zip
LibtorrentRasterbar::torrent-rasterbar
unofficial-sodium::sodium
unofficial-sodium::sodium_config_public
unofficial::sqlite3::sqlite3
uriparser::uriparser
)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set(ARCH_NAME "x64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(ARCH_NAME "arm64")
else()
set(ARCH_NAME ${CMAKE_SYSTEM_PROCESSOR})
endif()
add_executable(
${PROJECT_NAME}_${ARCH_NAME}
src/main.cpp
)
target_link_libraries(
${PROJECT_NAME}_${ARCH_NAME}
${PROJECT_NAME}_core
)
add_executable(
${PROJECT_NAME}_tests
tests/inmemorysession.cpp
tests/main.cpp
tests/query/pql.cpp
tests/utils/string.cpp
)
target_link_libraries(
${PROJECT_NAME}_tests
${PROJECT_NAME}_core
${PROJECT_NAME}_query
GTest::gmock
GTest::gtest
GTest::gmock_main
)