summaryrefslogtreecommitdiffstats
path: root/api/logic/CMakeLists.txt
blob: 0a65c6e2188d09547af030e46bf372512ccf2995 (plain)
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
project(MultiMC_logic)

include (UnitTest)

set(CORE_SOURCES
	# LOGIC - Base classes and infrastructure
	BaseInstaller.h
	BaseInstaller.cpp
	BaseVersionList.h
	BaseVersionList.cpp
	InstanceCreationTask.h
	InstanceCreationTask.cpp
	InstanceCopyTask.h
	InstanceCopyTask.cpp
	InstanceImportTask.h
	InstanceImportTask.cpp
	InstanceList.h
	InstanceList.cpp
	LoggedProcess.h
	LoggedProcess.cpp
	MessageLevel.cpp
	MessageLevel.h
	BaseInstanceProvider.h
	FolderInstanceProvider.h
	FolderInstanceProvider.cpp
	BaseVersion.h
	BaseInstance.h
	BaseInstance.cpp
	NullInstance.h
	MMCZip.h
	MMCZip.cpp
	MMCStrings.h
	MMCStrings.cpp

	# Use tracking separate from memory management
	Usable.h

	# Prefix tree where node names are strings between separators
	SeparatorPrefixTree.h

	# WARNING: globals live here
	Env.h
	Env.cpp

	# JSON parsing helpers
	Json.h
	Json.cpp

	FileSystem.h
	FileSystem.cpp

	Exception.h

	# RW lock protected map
	RWStorage.h

	# A variable that has an implicit default value and keeps track of changes
	DefaultVariable.h

	# a smart pointer wrapper intended for safer use with Qt signal/slot mechanisms
	QObjectPtr.h

	# Compression support
	GZip.h
	GZip.cpp

	# Command line parameter parsing
	Commandline.h
	Commandline.cpp

	# Version number string support
	Version.h
	Version.cpp

	# A Recursive file system watcher
	RecursiveFileSystemWatcher.h
	RecursiveFileSystemWatcher.cpp
)

add_unit_test(FileSystem
	SOURCES FileSystem_test.cpp
	LIBS MultiMC_logic
	DATA testdata
	)

add_unit_test(GZip
	SOURCES GZip_test.cpp
	LIBS MultiMC_logic
	)

set(PATHMATCHER_SOURCES
	# Path matchers
	pathmatcher/FSTreeMatcher.h
	pathmatcher/IPathMatcher.h
	pathmatcher/MultiMatcher.h
	pathmatcher/RegexpMatcher.h
)

set(NET_SOURCES
	# network stuffs
	net/ByteArraySink.h
	net/ChecksumValidator.h
	net/Download.cpp
	net/Download.h
	net/FileSink.cpp
	net/FileSink.h
	net/HttpMetaCache.cpp
	net/HttpMetaCache.h
	net/MetaCacheSink.cpp
	net/MetaCacheSink.h
	net/NetAction.h
	net/NetJob.cpp
	net/NetJob.h
	net/PasteUpload.cpp
	net/PasteUpload.h
	net/Sink.h
	net/URLConstants.cpp
	net/URLConstants.h
	net/Validator.h
)

# Game launch logic
set(LAUNCH_SOURCES
	launch/steps/PostLaunchCommand.cpp
	launch/steps/PostLaunchCommand.h
	launch/steps/PreLaunchCommand.cpp
	launch/steps/PreLaunchCommand.h
	launch/steps/TextPrint.cpp
	launch/steps/TextPrint.h
	launch/steps/Update.cpp
	launch/steps/Update.h
	launch/LaunchStep.cpp
	launch/LaunchStep.h
	launch/LaunchTask.cpp
	launch/LaunchTask.h
	launch/LogModel.cpp
	launch/LogModel.h
)

# Old update system
set(UPDATE_SOURCES
	updater/GoUpdate.h
	updater/GoUpdate.cpp
	updater/UpdateChecker.h
	updater/UpdateChecker.cpp
	updater/DownloadTask.h
	updater/DownloadTask.cpp
)

add_unit_test(UpdateChecker
	SOURCES updater/UpdateChecker_test.cpp
	LIBS MultiMC_logic
	DATA updater/testdata
	)

add_unit_test(DownloadTask
	SOURCES updater/DownloadTask_test.cpp
	LIBS MultiMC_logic
	DATA updater/testdata
	)

# Rarely used notifications
set(NOTIFICATIONS_SOURCES
	# Notifications - short warning messages
	notifications/NotificationChecker.h
	notifications/NotificationChecker.cpp
)

# Backend for the news bar... there's usually no news.
set(NEWS_SOURCES
	# News System
	news/NewsChecker.h
	news/NewsChecker.cpp
	news/NewsEntry.h
	news/NewsEntry.cpp
)

# Icon interface
set(ICONS_SOURCES
	# News System
	icons/IIconList.h
	icons/IIconList.cpp
)

# Minecraft services status checker
set(STATUS_SOURCES
	# Status system
	status/StatusChecker.h
	status/StatusChecker.cpp
)

# Support for Minecraft instances and launch
set(MINECRAFT_SOURCES
	# Minecraft support
	minecraft/auth/AuthSession.h
	minecraft/auth/AuthSession.cpp
	minecraft/auth/MojangAccountList.h
	minecraft/auth/MojangAccountList.cpp
	minecraft/auth/MojangAccount.h
	minecraft/auth/MojangAccount.cpp
	minecraft/auth/YggdrasilTask.h
	minecraft/auth/YggdrasilTask.cpp
	minecraft/auth/flows/AuthenticateTask.h
	minecraft/auth/flows/AuthenticateTask.cpp
	minecraft/auth/flows/RefreshTask.cpp
	minecraft/auth/flows/RefreshTask.cpp
	minecraft/auth/flows/ValidateTask.h
	minecraft/auth/flows/ValidateTask.cpp
	minecraft/update/AssetUpdateTask.h
	minecraft/update/AssetUpdateTask.cpp
	minecraft/update/FMLLibrariesTask.cpp
	minecraft/update/FMLLibrariesTask.h
	minecraft/update/FoldersTask.cpp
	minecraft/update/FoldersTask.h
	minecraft/update/LibrariesTask.cpp
	minecraft/update/LibrariesTask.h
	minecraft/launch/ClaimAccount.cpp
	minecraft/launch/ClaimAccount.h
	minecraft/launch/CreateServerResourcePacksFolder.cpp
	minecraft/launch/CreateServerResourcePacksFolder.h
	minecraft/launch/ModMinecraftJar.cpp
	minecraft/launch/ModMinecraftJar.h
	minecraft/launch/DirectJavaLaunch.cpp
	minecraft/launch/DirectJavaLaunch.h
	minecraft/launch/ExtractNatives.cpp
	minecraft/launch/ExtractNatives.h
	minecraft/launch/LauncherPartLaunch.cpp
	minecraft/launch/LauncherPartLaunch.h
	minecraft/launch/PrintInstanceInfo.cpp
	minecraft/launch/PrintInstanceInfo.h
	minecraft/legacy/LegacyModList.h
	minecraft/legacy/LegacyModList.cpp
	minecraft/legacy/LegacyInstance.h
	minecraft/legacy/LegacyInstance.cpp
	minecraft/legacy/LegacyMigrationTask.h
	minecraft/legacy/LegacyMigrationTask.cpp
	minecraft/GradleSpecifier.h
	minecraft/MinecraftInstance.cpp
	minecraft/MinecraftInstance.h
	minecraft/MinecraftProfile.cpp
	minecraft/MinecraftProfile.h
	minecraft/MinecraftUpdate.h
	minecraft/MinecraftUpdate.cpp
	minecraft/MojangVersionFormat.cpp
	minecraft/MojangVersionFormat.h
	minecraft/Rule.cpp
	minecraft/Rule.h
	minecraft/OneSixVersionFormat.cpp
	minecraft/OneSixVersionFormat.h
	minecraft/OpSys.cpp
	minecraft/OpSys.h
	minecraft/ParseUtils.cpp
	minecraft/ParseUtils.h
	minecraft/ProfileUtils.cpp
	minecraft/ProfileUtils.h
	minecraft/Library.cpp
	minecraft/Library.h
	minecraft/MojangDownloadInfo.h
	minecraft/VersionFile.cpp
	minecraft/VersionFile.h
	minecraft/ProfilePatch.cpp
	minecraft/ProfilePatch.h
	minecraft/VersionFilterData.h
	minecraft/VersionFilterData.cpp
	minecraft/Mod.h
	minecraft/Mod.cpp
	minecraft/ModList.h
	minecraft/ModList.cpp
	minecraft/World.h
	minecraft/World.cpp
	minecraft/WorldList.h
	minecraft/WorldList.cpp

	# Flame
	minecraft/flame/PackManifest.h
	minecraft/flame/PackManifest.cpp
	minecraft/flame/FileResolvingTask.h
	minecraft/flame/FileResolvingTask.cpp

	# Assets
	minecraft/AssetsUtils.h
	minecraft/AssetsUtils.cpp

	# Forge and all things forge related
	minecraft/forge/ForgeXzDownload.h
	minecraft/forge/ForgeXzDownload.cpp

	# Skin upload utilities
	minecraft/SkinUpload.cpp
	minecraft/SkinUpload.h
	)

add_unit_test(GradleSpecifier
	SOURCES minecraft/GradleSpecifier_test.cpp
	LIBS MultiMC_logic
	)

add_unit_test(MojangVersionFormat
	SOURCES minecraft/MojangVersionFormat_test.cpp
	LIBS MultiMC_logic
	DATA minecraft/testdata
	)

add_unit_test(Library
	SOURCES minecraft/Library_test.cpp
	LIBS MultiMC_logic
	)

# FIXME: shares data with FileSystem test
add_unit_test(ModList
	SOURCES minecraft/ModList_test.cpp
	DATA testdata
	LIBS MultiMC_logic
	)

add_unit_test(ParseUtils
	SOURCES minecraft/ParseUtils_test.cpp
	LIBS MultiMC_logic
	)

# the screenshots feature
set(SCREENSHOTS_SOURCES
	screenshots/Screenshot.h
	screenshots/ImgurUpload.h
	screenshots/ImgurUpload.cpp
	screenshots/ImgurAlbumCreation.h
	screenshots/ImgurAlbumCreation.cpp
)

set(TASKS_SOURCES
	# Tasks
	tasks/Task.h
	tasks/Task.cpp
	tasks/SequentialTask.h
	tasks/SequentialTask.cpp
)

set(SETTINGS_SOURCES
	# Settings
	settings/INIFile.cpp
	settings/INIFile.h
	settings/INISettingsObject.cpp
	settings/INISettingsObject.h
	settings/OverrideSetting.cpp
	settings/OverrideSetting.h
	settings/PassthroughSetting.cpp
	settings/PassthroughSetting.h
	settings/Setting.cpp
	settings/Setting.h
	settings/SettingsObject.cpp
	settings/SettingsObject.h
)

add_unit_test(INIFile
	SOURCES settings/INIFile_test.cpp
	LIBS MultiMC_logic
	)

set(JAVA_SOURCES
	# Java related code
	java/launch/CheckJava.cpp
	java/launch/CheckJava.h
	java/JavaChecker.h
	java/JavaChecker.cpp
	java/JavaCheckerJob.h
	java/JavaCheckerJob.cpp
	java/JavaInstall.h
	java/JavaInstall.cpp
	java/JavaInstallList.h
	java/JavaInstallList.cpp
	java/JavaUtils.h
	java/JavaUtils.cpp
	java/JavaVersion.h
	java/JavaVersion.cpp
)

add_unit_test(JavaVersion
	SOURCES java/JavaVersion_test.cpp
	LIBS MultiMC_logic
	)

set(TRANSLATIONS_SOURCES
	translations/TranslationsModel.h
	translations/TranslationsModel.cpp
)

set(TOOLS_SOURCES
	# Tools
	tools/BaseExternalTool.cpp
	tools/BaseExternalTool.h
	tools/BaseProfiler.cpp
	tools/BaseProfiler.h
	tools/JProfiler.cpp
	tools/JProfiler.h
	tools/JVisualVM.cpp
	tools/JVisualVM.h
	tools/MCEditTool.cpp
	tools/MCEditTool.h
)

set(META_SOURCES
	# Metadata sources
	meta/JsonFormat.cpp
	meta/JsonFormat.h
	meta/BaseEntity.cpp
	meta/BaseEntity.h
	meta/VersionList.cpp
	meta/VersionList.h
	meta/Version.cpp
	meta/Version.h
	meta/Index.cpp
	meta/Index.h
)

add_unit_test(Index
	SOURCES meta/Index_test.cpp
	LIBS MultiMC_logic
	)

################################ COMPILE ################################

# we need zlib
find_package(ZLIB REQUIRED)

set(LOGIC_SOURCES
	${CORE_SOURCES}
	${PATHMATCHER_SOURCES}
	${NET_SOURCES}
	${LAUNCH_SOURCES}
	${UPDATE_SOURCES}
	${NOTIFICATIONS_SOURCES}
	${NEWS_SOURCES}
	${STATUS_SOURCES}
	${MINECRAFT_SOURCES}
	${SCREENSHOTS_SOURCES}
	${TASKS_SOURCES}
	${SETTINGS_SOURCES}
	${JAVA_SOURCES}
	${TRANSLATIONS_SOURCES}
	${TOOLS_SOURCES}
	${META_SOURCES}
	${ICONS_SOURCES}
)

add_library(MultiMC_logic SHARED ${LOGIC_SOURCES})
set_target_properties(MultiMC_logic PROPERTIES CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN 1)

generate_export_header(MultiMC_logic)

# Link
target_link_libraries(MultiMC_logic xz-embedded MultiMC_unpack200 systeminfo MultiMC_quazip ${NBT_NAME} ${ZLIB_LIBRARIES})
qt5_use_modules(MultiMC_logic Core Xml Network Concurrent)

# Mark and export headers
target_include_directories(MultiMC_logic PUBLIC "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" PRIVATE "${ZLIB_INCLUDE_DIRS}")