From 7c0bd2fbbde7042858ffeeae583cde3523b680fa Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:26:49 -0600 Subject: [PATCH] refactor(build): make `lld` optional and recommend clang/llvm in README --- README.md | 36 +++++++++++++++++------------------- meson.build | 3 --- scripts/llvm_native.txt | 5 +++++ 3 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 scripts/llvm_native.txt diff --git a/README.md b/README.md index 88d657dd3..9366801a5 100644 --- a/README.md +++ b/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: ``` diff --git a/meson.build b/meson.build index 2b78b43bb..14b94a2d1 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/scripts/llvm_native.txt b/scripts/llvm_native.txt new file mode 100644 index 000000000..17d5b1824 --- /dev/null +++ b/scripts/llvm_native.txt @@ -0,0 +1,5 @@ +[binaries] +c = 'clang' +cpp = 'clang++' +c_ld = 'lld' +cpp_ld = 'lld'