Jump to content

Building with Ninja: Difference between revisions

From Weissblatt Wiki
Created page with "[https://ninja-build.org/manual.html Ninja] is a build system [https://neugierig.org/software/chromium/notes/2011/02/ninja.html originally developed for Google Chrome] and designed towards low build times for complex projects. It was designed with three # Ninja files are meant to be computer-generated using higher order build systems such as [https://cmake.org/ CMake] # Ninja itself is "painfully simple". There is "very little policy" in the build process and Ninja req..."
 
No edit summary
Line 1: Line 1:
[https://ninja-build.org/manual.html Ninja] is a build system [https://neugierig.org/software/chromium/notes/2011/02/ninja.html originally developed for Google Chrome] and designed towards low build times for complex projects. It was designed with three  
[https://ninja-build.org/manual.html Ninja] is a build system [https://neugierig.org/software/chromium/notes/2011/02/ninja.html originally developed for Google Chrome] and designed towards low build times for complex projects. It was designed with three goals in-mind:


# Ninja is supposed to be ''fast''. Build processes are heavily parallelized where possibe.
# Ninja files are meant to be computer-generated using higher order build systems such as [https://cmake.org/ CMake]
# Ninja files are meant to be computer-generated using higher order build systems such as [https://cmake.org/ CMake]
# Ninja itself is "painfully simple". There is "very little policy" in the build process and Ninja requires comparatively explicit build definitions.
# Ninja itself is "painfully simple". There is "very little policy" in the build process and Ninja requires comparatively explicit build definitions.


This article explores the possibility for an alternative build system for Weissblatt based on Ninja
This article explores the possibility for an alternative build system for Weissblatt based on Ninja to hopefully simplify and future-proof the engine's overall build process - especially in regards to multi-platform support and Windows builds.


== Ninja compared to Make for building Weissblatt ==
== Ninja compared to Make for building Weissblatt ==

Revision as of 18:34, 19 May 2025

Ninja is a build system originally developed for Google Chrome and designed towards low build times for complex projects. It was designed with three goals in-mind:

  1. Ninja is supposed to be fast. Build processes are heavily parallelized where possibe.
  2. Ninja files are meant to be computer-generated using higher order build systems such as CMake
  3. Ninja itself is "painfully simple". There is "very little policy" in the build process and Ninja requires comparatively explicit build definitions.

This article explores the possibility for an alternative build system for Weissblatt based on Ninja to hopefully simplify and future-proof the engine's overall build process - especially in regards to multi-platform support and Windows builds.

Ninja compared to Make for building Weissblatt

Traditionally Weissblatt's engine used to be built using Make, the traditional UNIX build system for C/C++ programs. However, there are multiple reasons to consider migrating to a more modern build system:

  1. The engine's Makefile has grown large, complex and hard to maintain over the years. Ninja is both brutally simple in it's architecture and doesn't assume human authorship from the get-go. As long as a good higher-level build system is used to generate Ninja files, maintenance of the build system should be trivial.
  2. Although building with a working Makefile is simple on UNIX-like systems, Make's dependency on a UNIX-like environment makes cross-platform development difficult. Letting a higher-order build system generate system-appropriate Ninja files may both abstract the system's build tooling to developers and better tailor the build process towards each individual system.
  3. To alleviate the problem described in 2), the Windows build system already relies on CMake separately of the Makefile for UNIX builds. Since CMake already supports generating Ninja files and is generally considered standard tooling in modern C/C++ development, a simple adaptation of Weissblatt's CMake toolchain could render a Ninja-based build toolchain easy to implement.

CMake in action - Generating Ninja files

Building with Ninja on Windows

TBA

Building with Ninja on Linux

TBA

Results

Discussion