Skip to main content

Pilot Light Build

Project description

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")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pl_build-1.1.1.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pl_build-1.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file pl_build-1.1.1.tar.gz.

File metadata

  • Download URL: pl_build-1.1.1.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for pl_build-1.1.1.tar.gz
Algorithm Hash digest
SHA256 698dcb754950a5e6e16852c755c0c7ba519921adcaaa8ecce71ae38e78b42474
MD5 0a4aabd1d93068add3a3466ce16fcf88
BLAKE2b-256 49314818968cda15cd658db8d46cbfa7c3f8fd0f95fc85945e7ac9d1276d7bef

See more details on using hashes here.

File details

Details for the file pl_build-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pl_build-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for pl_build-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf5c25e795350b8b1a641f9e4d692773a182df0dc818a72486e99154db7bf07e
MD5 6bafda76ad639a09d24301994837e4e9
BLAKE2b-256 c23bf8990110918364d074765c2d478010563348f81d70cd1b10235d7f2723d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page