Skip to main content

Pilot Light Build

The pl-build tool is a lightweight utility used to generate batch/bash build scripts.

Background

The pl-build tool is a part of the larger Pilot Light project. In this larger project, we do not have a "build system" per se. Instead we prefer to write batch/bash scripts that directly call the compiler (in a manner similar to Casey Muratori's Handmade Hero). If this project was an end user product, this would be the end of it. However, this is not the case. It is meant to be easily extended through adding additional extensions and being used as a "pilot light" to start new projects. With this comes a couple issues. Extensions are meant to be cross platform so users need the ability to easily add new binaries for all target platforms with minimal duplication. Users shouldn't need to be bash or batch scripting experts to build new targets for all platforms and shouldn't need to test the build scripts continuously on each platform.

Another way of putting it, is we want to focus on what matters to build binaries. Ultimately this is just compiler & linker settings. We don't want to think about the differences in bash/batch syntax.

The idea is simple:

flowchart LR

    gen_build.py --> build_win32.bat

    gen_build.py --> build_linux.sh

    gen_build.py --> build_macos.sh

Features

  • entire system can be understood in an hour

  • minimizes duplicated information

  • generates standalone simple build scripts

  • fine-grained control over compilation & linker settings

  • supports hot reloading

  • easily extended to add new platforms & compilers

  • extremely light weight

  • no preference on editor/IDE

  • doesn't pretend different platforms don't exist

Documentation

Documentation can be found here.

Examples

Real World

Complete & more advanced examples can be found here:

Basic Example

This is just an example of the what an input and output scripts look like (this will not actually run).

input - gen_build.py

import pl_build.core as pl

import pl_build.backend_win32 as win32

import pl_build.backend_linux as linux

import pl_build.backend_macos as macos



with pl.project("tutorial"):



    pl.set_hot_reload_target("../out/pilot_light")



    with pl.target("example", pl.TargetType.EXECUTABLE):



        # shared across configs

        pl.set_output_directory("out")

        pl.set_output_binary("example")

        pl.add_source_files("main.c")



        with pl.configuration("debug"):



            with pl.platform("Windows"):

                with pl.compiler("msvc"):

                    pl.add_compiler_flags("-Od")



            with pl.platform("Linux"):

                with pl.compiler("gcc"):

                    pl.add_compiler_flags("-g")

                    pl.add_linker_flags("-ldl")



            with pl.platform("Darwin"):

                with pl.compiler("clang"):

                    pl.add_compiler_flags("-g", "--debug")

                    pl.add_link_directories("/usr/local/lib")

                    

win32.generate_build("build_win32.bat")

linux.generate_build("build_linux.sh")

macos.generate_build("build_macos.sh")

Release files for pl-build 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pl-build 2.0.0
File Size Uploaded
pl_build-2.0.0.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pl-build 2.0.0
File Interpreter ABI Platform
pl_build-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.1 kB

Release files / pl_build-2.0.0.tar.gz

Download URL pl_build-2.0.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
65ccb72a44355ea78d1d12da2a99e807f34c4acc00c3cdf6af9e3d1c2d926324
BLAKE2b-256 checksum
How to use checksums
7b98bc5252c1751f8fec957e1900903f2dee07acc8d427040c2d17457c63445f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / pl_build-2.0.0-py3-none-any.whl

Download URL pl_build-2.0.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05f27bda59c5d5cbf3cbc9dd8598d1b5d07d5ede397e589b56d0ca056806c165
BLAKE2b-256 checksum
How to use checksums
0a69fad78c568c17c781139754e4b41994b9b6f0f3e4182082112883418bdf08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.10

1 release file

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

1 release file

1.0.2

1 release file

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page