Merge pull request #69 from 4jcraft/refactor/optional-llvm-toolchain

refactor(build): make `lld` optional and recommend clang/llvm in README
This commit is contained in:
JuiceyDev 2026-03-06 18:35:19 +01:00 committed by GitHub
commit a875a6ef98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 23 deletions

View file

@ -9,7 +9,7 @@
4JCraft is a modified version of the Minecraft Console Legacy Edition aimed on porting old Minecraft to different platforms (such as Linux, Android, Emscripten, etc.)
Join our community:
* Discord (Not currently available): https://discord.gg/zFCwRWkkUg
* Discord: https://discord.gg/zFCwRWkkUg
* Steam: https://steamcommunity.com/groups/4JCraft
## Planned platforms to be supported:
@ -57,29 +57,13 @@ docker run -it -v $(pwd):/workspaces/4jcraft -w /workspaces/4jcraft 4jcraft-dev
### Configure & Build
> [!IMPORTANT]
> GCC 15 or newer is currently *required* to build this project. Ubuntu installations in particular may have older versions preinstalled, so verify your compiler version with `gcc --version`.
> If you are using GCC, then GCC 15 or newer is currently *required* to build this project. Ubuntu installations in particular may have older versions preinstalled, so verify your compiler version with `gcc --version`.
This project uses the [Meson](https://mesonbuild.com/) (with [Ninja](https://ninja-build.org/)) as a build system and [lld](https://lld.llvm.org/) as a linker.
This project uses the [Meson](https://mesonbuild.com/) build system (with [Ninja](https://ninja-build.org/)).
#### Install Tooling
1. Follow [this Quickstart guide](https://mesonbuild.com/Quick-guide.html) for installing or building Meson and Ninja on your respective distro.
2. Install the `lld` linker using your distro's package manager. This may be distributed as part of an [LLVM toolchain](https://llvm.org/).
Debian/Ubuntu:
```bash
sudo apt-get install lld
```
RedHat/Fedora:
```bash
sudo dnf install lld
```
Arch/Manjaro:
```bash
sudo pacman -S lld
```
Follow [this Quickstart guide](https://mesonbuild.com/Quick-guide.html) for installing or building Meson and Ninja on your respective distro.
#### Configure & Build
@ -91,6 +75,20 @@ meson setup build
meson compile -C build
```
> [!TIP]
>
> For the fastest compilation speeds, you may want to use the compilers and linkers provided by an [LLVM toolchain](https://llvm.org/) (`clang`/`lld`) over your system compiler and linker. To do this, install `clang` and `lld`, and configure your build using the `llvm_native.txt` nativescript in `/scripts`:
>
> ```bash
> meson setup --native-file ./scripts/llvm_native.txt build
> ```
>
> ...or if you've already configured a build directory:
>
> ```bash
> meson setup --native-file ./scripts/llvm_native.txt build --reconfigure
> ```
The binary is output to:
```

View file

@ -12,9 +12,6 @@ project('4jcraft-chucklegrounds', ['cpp', 'c'],
cc = meson.get_compiler('cpp')
# Use LLD for dramatically faster linking (ld.lld must be installed)
add_project_link_arguments('-fuse-ld=lld', language : ['c', 'cpp'])
# system deps
gl_dep = dependency('gl')
glu_dep = dependency('glu')

5
scripts/llvm_native.txt Normal file
View file

@ -0,0 +1,5 @@
[binaries]
c = 'clang'
cpp = 'clang++'
c_ld = 'lld'
cpp_ld = 'lld'