mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-23 21:13:35 +00:00
refactor(build): make lld optional and recommend clang/llvm in README
This commit is contained in:
parent
44251492ff
commit
7c0bd2fbbd
36
README.md
36
README.md
|
|
@ -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:
|
||||
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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
5
scripts/llvm_native.txt
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
[binaries]
|
||||
c = 'clang'
|
||||
cpp = 'clang++'
|
||||
c_ld = 'lld'
|
||||
cpp_ld = 'lld'
|
||||
Loading…
Reference in a new issue