Sign in Sign up
kretrod/lodestone-cpp Public
Branches
main
PreviewCode52 lines (40 loc) · 1.7 KB Raw
# Building

The output is `build/lodestone_client.dll` (the client, injected into Minecraft)
and `build/lodestone-inject.exe` (the loader), both 64-bit Windows binaries built
with **mingw-w64 g++**.

## The easy way (Windows): build.exe

Double-click **`build.exe`** in this folder. The first run downloads a portable
toolchain (w64devkit, ~73 MB) into a `w64devkit\` subfolder — nothing is
installed system-wide and no admin rights are needed — then compiles everything.
Later runs skip the download and just recompile. No JDK required: `jni.h` is
vendored under `third_party/jni`.

When it finishes you'll have `build\lodestone_client.dll` and
`build\lodestone-inject.exe`, and it prints the DLL's imports so you can see it
depends only on system libraries.

## With make

If you'd rather use make (or you're on Linux), you need mingw-w64 g++ and GNU
make; no JDK. Then:

**Linux (cross-compile):**
```
sudo apt install g++-mingw-w64-x86-64 make    # Debian/Ubuntu
make
```

**Windows, MSYS2 MINGW64 shell:**
```
pacman -S mingw-w64-x86_64-toolchain make
make CXX=g++ CC=gcc OBJDUMP=objdump
```

**Windows, WinLibs + make from cmd.exe** (put WinLibs' `bin` on `PATH`):
```
make
```

To build against a specific JDK's headers instead of the vendored `jni.h`, pass
`JAVA_INC`, e.g. `make JAVA_INC="C:/Program Files/Java/jdk-25/include"`.

## Checking the result

The DLL must import **only** `KERNEL32`, `USER32`, `GDI32`, `OPENGL32` and
`msvcrt` — never `libstdc++-6.dll`, or it fails to inject with "a dependency is
missing". `build.exe` and the `make` build both print this list; check it any
time with:
```
w64devkit\bin\objdump -p build\lodestone_client.dll | findstr "DLL Name"
```