summaryrefslogtreecommitdiff
path: root/docs/handbook/meshmc/dependencies.md
blob: dda35337ec494196dbc54469d3297cdeb3f2cc99 (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
# Dependencies

## Overview

MeshMC depends on a mix of bundled libraries (shipped in the source tree under `libraries/`) and external libraries resolved at build time via the system package manager or vcpkg.

## Bundled Libraries

These libraries are included in the `libraries/` directory and built as part of the MeshMC CMake project:

| Library | Directory | Purpose | License |
|---|---|---|---|
| **ganalytics** | `libraries/ganalytics/` | Google Analytics integration for usage telemetry | MIT |
| **systeminfo** | `libraries/systeminfo/` | System information queries (OS, CPU, memory) | GPL-3.0-or-later |
| **hoedown** | `libraries/hoedown/` | Markdown rendering (changelogs, news) | ISC |
| **launcher** | `libraries/launcher/` | Java process launcher helper binary | GPL-3.0-or-later |
| **javacheck** | `libraries/javacheck/` | Java installation validator (JAR) | GPL-3.0-or-later |
| **xz-embedded** | `libraries/xz-embedded/` | XZ decompression (embedded, minimal) | Public Domain |
| **rainbow** | `libraries/rainbow/` | KDE-style color utilities | LGPL-2.1 |
| **iconfix** | `libraries/iconfix/` | Qt icon theme fixes | Apache-2.0 |
| **LocalPeer** | `libraries/LocalPeer/` | Single-instance IPC (based on QtSingleApplication) | LGPL-2.1 |
| **classparser** | `libraries/classparser/` | Java `.class` file parser (mod metadata) | GPL-3.0-or-later |
| **optional-bare** | `libraries/optional-bare/` | C++17 `std::optional` polyfill for older code | BSL-1.0 |
| **tomlc99** | `libraries/tomlc99/` | TOML parser (C99) | MIT |
| **katabasis** | `libraries/katabasis/` | OAuth2 library (MSA authentication) | BSD-2-Clause |
| **libnbtplusplus** | `libraries/libnbtplusplus/` | NBT (Named Binary Tag) parser for Minecraft data | LGPL-3.0 |
| **qdcss** | `libraries/qdcss/` | CSS-like parser for theme files | GPL-3.0-or-later |
| **murmur2** | `libraries/murmur2/` | MurmurHash2 implementation (CurseForge fingerprinting) | Public Domain |

### ganalytics

Provides opt-in usage analytics via Google Analytics Measurement Protocol. Tracks feature usage, not personal data. Can be disabled in settings.

### systeminfo

Cross-platform system info queries:
- Operating system name and version
- CPU architecture and model
- Available memory
- Used for analytics and crash reports

### launcher

A small native binary that acts as the actual Java process launcher:
- Handles process spawning on all platforms
- Supports wrapper commands
- Manages stdio piping

### javacheck

A minimal Java program (`JavaCheck.class`) that prints JVM system properties. Spawned by `JavaChecker` to validate Java installations without loading the full Minecraft runtime.

### classparser

Parses Java `.class` files to extract:
- Mod metadata (name, version, mod ID)
- Forge/Fabric/Quilt mod annotations
- Used by `LocalModParseTask` for mod discovery

### katabasis

OAuth2 implementation used for Microsoft Account authentication:
- Token storage structures (`Katabasis::Token`)
- Token validity tracking
- Refresh token management

### libnbtplusplus

Parses and writes Minecraft NBT (Named Binary Tag) format:
- Level.dat parsing for world metadata
- Server.dat parsing for server list
- Used by InstanceImportTask and world management

## External Dependencies

These are resolved at build time and must be installed on the system or via vcpkg:

| Library | CMake Target | Purpose | Required |
|---|---|---|---|
| **Qt6::Core** | `Qt6::Core` | Foundation (strings, containers, I/O, events) | Yes |
| **Qt6::Widgets** | `Qt6::Widgets` | GUI toolkit | Yes |
| **Qt6::Concurrent** | `Qt6::Concurrent` | Threading utilities | Yes |
| **Qt6::Network** | `Qt6::Network` | HTTP, SSL, proxy | Yes |
| **Qt6::NetworkAuth** | `Qt6::NetworkAuth` | OAuth2 (MSA authentication) | Yes |
| **Qt6::Test** | `Qt6::Test` | Unit testing framework | Optional |
| **Qt6::Xml** | `Qt6::Xml` | XML parsing | Yes |
| **libarchive** | `LibArchive::LibArchive` | Archive extraction (zip, tar, 7z) | Yes |
| **zlib** | `ZLIB::ZLIB` | Compression (used by libarchive, QuaZip) | Yes |
| **ECM** | `extra-cmake-modules` | KDE CMake macros (install dirs, icons) | Yes |
| **cmark** | `cmark` | CommonMark rendering (changelogs) | Yes |
| **tomlplusplus** | `tomlplusplus::tomlplusplus` | TOML parsing (C++17) | Yes |
| **libqrencode** | `qrencode` | QR code generation (MSA login) | Optional |
| **QuaZip** | `QuaZip::QuaZip` | Qt-based ZIP file I/O | Yes |
| **Sparkle** | `Sparkle.framework` | macOS auto-update framework | macOS only |

### Qt6

Minimum version: **Qt 6.7** (for full C++23 and NetworkAuth support).

Required Qt modules:
```cmake
find_package(Qt6 6.7 REQUIRED COMPONENTS
    Core
    Widgets
    Concurrent
    Network
    NetworkAuth
    Xml
)
find_package(Qt6 6.7 COMPONENTS Test)
```

### libarchive

Used for extracting:
- Minecraft archives (`.jar`, `.zip`)
- Modpack archives (`.mrpack`, `.zip`)
- Java runtime archives (`.tar.gz`, `.zip`)

### Extra CMake Modules (ECM)

KDE's CMake module collection provides:
- `KDEInstallDirs` — standardized install paths
- `ecm_install_icons` — icon theme installation
- `ECMQueryQt` — Qt path queries

### cmark

CommonMark rendering for:
- Changelogs and release notes
- CurseForge/Modrinth mod descriptions
- News feed content

The `cmark` source is included in the repository at `/cmark/` as a subproject.

### tomlplusplus

Modern C++ TOML parser used for:
- Fabric/Quilt mod metadata (`fabric.mod.json` alternative format)
- Configuration file parsing

The `tomlplusplus` source is included in the repository at `/tomlplusplus/`.

### QuaZip

Qt wrapper around zlib/minizip for ZIP I/O:
- Instance export (creating `.zip` files)
- Instance import (reading `.zip` modpacks)
- Mod file inspection

## vcpkg Integration

The build system supports vcpkg for dependency management:

```cmake
# CMakePresets.json
{
    "configurePresets": [
        {
            "name": "windows_msvc",
            "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
            "cacheVariables": {
                "VCPKG_TARGET_TRIPLET": "x64-windows"
            }
        }
    ]
}
```

### vcpkg.json

```json
{
    "dependencies": [
        "libarchive",
        "zlib",
        "quazip",
        "cmark",
        "tomlplusplus"
    ]
}
```

## Build vs Runtime Dependencies

### Build-Only Dependencies

| Dependency | Purpose |
|---|---|
| CMake 3.28+ | Build system generator |
| Ninja | Build tool |
| C++23 compiler | GCC 14+, Clang 18+, MSVC 17.10+ |
| ECM | CMake macros |
| Qt6 (all modules) | Framework headers and libs |

### Runtime Dependencies

| Dependency | Purpose |
|---|---|
| Qt6 shared libraries | Core framework runtime |
| libarchive | Archive operations |
| zlib | Compression |
| OpenSSL / Schannel | TLS for network operations |
| Java 8-21 | Minecraft runtime (user-managed) |

### Optional Runtime Dependencies

| Dependency | Purpose | Platform |
|---|---|---|
| libqrencode | QR code for MSA login | All (optional feature) |
| Sparkle | Auto-updates | macOS |
| xdg-utils | Open URLs/files | Linux |

## Dependency Graph

```
meshmc (executable)
├── Qt6::Core, Qt6::Widgets, Qt6::Concurrent, Qt6::Network, Qt6::NetworkAuth, Qt6::Xml
├── LibArchive::LibArchive
├── ZLIB::ZLIB
├── QuaZip::QuaZip
├── cmark
├── tomlplusplus::tomlplusplus
├── libraries/
│   ├── ganalytics (→ Qt6::Core, Qt6::Network)
│   ├── systeminfo (→ Qt6::Core)
│   ├── hoedown (C library, no Qt dependency)
│   ├── launcher (→ Qt6::Core)
│   ├── javacheck (Java, no C++ deps)
│   ├── xz-embedded (C library, no deps)
│   ├── rainbow (→ Qt6::Core, Qt6::Widgets)
│   ├── iconfix (→ Qt6::Core, Qt6::Widgets)
│   ├── LocalPeer (→ Qt6::Core, Qt6::Network)
│   ├── classparser (→ Qt6::Core)
│   ├── tomlc99 (C library, no deps)
│   ├── katabasis (→ Qt6::Core, Qt6::Network, Qt6::NetworkAuth)
│   ├── libnbtplusplus (→ ZLIB::ZLIB)
│   ├── qdcss (→ Qt6::Core)
│   └── murmur2 (C library, no deps)
└── optional: qrencode, Sparkle.framework
```