Skip to content
On this page

Build Guide

This guide covers building LeviLamina from source, including environment setup, build commands, dependencies, and version management.

Prerequisites

Required Tools

  • XMake 3.0.0+ — Build system (xmake.io)
  • LLVM/Clang — The Windows build uses the clang-cl toolchain
  • MSVC 2022+ — Provides the Windows SDK and standard library that clang-cl builds against
  • Git — For version control and version number generation
  • Windows 10/11 x64 — The main build platform. Server builds can also target Linux x86_64 (-p linux, which uses the clang toolchain); client builds are Windows-only

Exact tool and dependency versions are defined in xmake.lua; the CI workflow in .github/workflows/build.yml shows the combination that is actively tested.

Installing XMake

PowerShell
# Using PowerShell
Invoke-Expression (Invoke-Webrequest 'https://xmake.io/psget.text' -UseBasicParsing).Content

# Or using Scoop
scoop install xmake

Installing MSVC

Install Visual Studio 2022 with the "Desktop development with C++" workload, or install Build Tools for Visual Studio 2022.

Installing LLVM

Install LLVM from releases.llvm.org or via scoop install llvm, and make sure clang-cl is on PATH.

Build Commands

Basic Build

PowerShell
# Clone the repository
git clone https://github.com/LiteLDev/LeviLamina.git
cd LeviLamina

# Build for server (default)
xmake

# Or explicitly specify server
xmake f --target_type=server
xmake

Build for Client

PowerShell
xmake f --target_type=client
xmake

Build with Tests

PowerShell
xmake f --tests=y
xmake

Build for Release/Publish

PowerShell
xmake f --publish=y
xmake

Clean Build

PowerShell
xmake c
xmake

Build Options

OptionValuesDefaultDescription
--target_typeserver, clientserverBuild target type
--testsy, nnEnable GTest-based testing
--publishy, nnMark as published release (affects version string)
--levimc_repoURL-Custom xmake-repo URL

Examples

PowerShell
# Server build with tests
xmake f --target_type=server --tests=y
xmake

# Client release build
xmake f --target_type=client --publish=y
xmake

# Custom repo
xmake f --levimc_repo=https://custom.repo.url
xmake

Dependencies

LeviLamina depends on 25+ external libraries, all declared with add_requires in xmake.lua and downloaded automatically by XMake. xmake.lua is the single source of truth for versions, so this page lists only what each dependency is for. Run xmake require --list to see the versions resolved for your current configuration.

Core Libraries

LibraryPurpose
enttEntity component system
fmtString formatting
nlohmann_jsonJSON parsing
rapidjsonFast JSON parsing
leveldbKey-value database
gslGuidelines Support Library

Performance

LibraryPurpose
mimallocHigh-performance allocator
parallel-hashmapFast hash maps
concurrentqueueLock-free queue

Utilities

LibraryPurpose
ctreCompile-time regex
magic_enumEnum reflection
type_safeType safety utilities
expected-liteExpected/Result type
glmMath library
cprHTTP client
stbImage and font decode

LeviLamina-Specific

These come from the levimc-repo xmake repository, overridable with --levimc_repo.

LibraryPurpose
pcg_cppRandom number generation
pfrReflection
demanglerC++ name demangling
levibuildscriptBuild scripts
preloaderDLL preloading
symbolproviderSymbol resolution
trampolineFunction hooking

Platform-Specific

LibraryPlatformPurpose
libhatWindowsMemory manipulation
bedrockdataWindowsMC binaries and data, per --target_type
gtest-Test framework, only required when --tests=y

bedrockdata is version-locked to the Minecraft version LeviLamina currently targets, and its -server / -client variant is selected by --target_type. Bumping it is part of adapting to a new Minecraft release, not a routine dependency update.

Version Number Generation

LeviLamina's version is automatically generated from Git tags:

Version Format

Text Only
v{major}.{minor}.{patch}{-prerelease}+{commit_hash}

Examples

  • Release: v26.51.8
  • Pre-release: v26.51.8-rc.2
  • Development: v26.51.8-rc.2+ce09050f05 (includes commit hash when --publish=n)

Major and minor track the targeted Minecraft version. See tooth.json and CHANGELOG.md for the current one.

Version Source Priority

  1. Git tag — If the current commit has a tag matching v*.*.*
  2. tooth.json — Fallback to version field in tooth.json

Version Injection

The version is injected into src/ll/core/Version.h.in during build:

C++
// Generated Version.h
#define LL_VERSION_MAJOR 26
#define LL_VERSION_MINOR 51
#define LL_VERSION_PATCH 8
#define LL_VERSION_PRERELEASE "rc.2"
#define LL_VERSION_BUILD "ce09050f05"

Compiler Settings

C++ Standard

  • C++20 required
  • C++23 features enabled via _HAS_CXX23=1

Compiler Flags

The Windows build compiles with clang-cl using MSVC-compatible flags. See the target("LeviLamina") block in xmake.lua for the authoritative list.

  • Runtime: /MD (dynamic, non-debug)
  • Exceptions: /EHa and /EHs, with xmake-level exceptions disabled
  • Warnings: /W4 with specific upgrades:
  • /w44265 — Virtual function without override
  • /w44289 — Loop variable used outside loop
  • /w44296 — Expression always true/false
  • /w45263 — Calling std::move on temporary
  • /w44738 — Storing float in memory

Build Output

Directory Structure

Text Only
LeviLamina/
├── build/
│   └── windows/
│       └── x64/
│           └── release/
│               └── LeviLamina.dll
└── bin/
    └── LeviLamina/
        ├── LeviLamina.dll
        └── manifest.json

Artifacts

  • LeviLamina.dll — Main loader DLL
  • manifest.json — Mod metadata with version info

CI/CD

LeviLamina uses GitHub Actions for continuous integration:

Automated Builds

  • Trigger: Pushes to any branch and pull requests touching sources or xmake.lua
  • Platforms: Windows x64
  • Matrix: server and client, each in debug and release, with tests on and off

Release Process

  1. Tag commit with version: git tag v26.51.8
  2. Push tag: git push origin v26.51.8
  3. CI builds with --publish=y
  4. Artifacts uploaded to GitHub Releases

Troubleshooting

XMake Cache Issues

PowerShell
xmake c -a  # Clean all
xmake f -c  # Reconfigure

Dependency Download Failures

PowerShell
# Use mirror
xmake g --proxy_pac=github_mirror.lua

Toolchain Not Found

Ensure Visual Studio 2022 or Build Tools are installed for the Windows SDK, that LLVM is installed so clang-cl resolves on PATH, and run from "Developer Command Prompt for VS 2022".