#build #cc #toml #header #directory #linker #cum

build cum-build

Yet Another C/C++ Build Tool

2 releases

new 0.1.1 Feb 5, 2025
0.1.0 Feb 5, 2025

#85 in Build Utils

37 downloads per month

GPL-3.0-or-later

3.5MB
3K SLoC

Vim Script 2K SLoC Rust 1K SLoC // 0.1% comments Shell 2 SLoC

Contains (ELF exe/lib, 715KB) examples/game/build/joysticks.o, (ELF exe/lib, 710KB) examples/game/build/gamma.o, (ELF exe/lib, 710KB) examples/game/build/inputlag.o, (static library, 430KB) examples/game/deps/glfw/build/libglfw3.a, (Mach-o exe, 415KB) examples/game/game, (ELF exe/lib, 145KB) examples/game/build/events.o and 111 more.

Cross Unified Multiplexer (C.U.M)

A more sensible build system for C/C++ Projects

Explained

Each CUM project is specified by a Project.toml file Each Project has dependencies (typically specified in deps/) specified by a Project.toml file Each project is expected to have a sources and headers directory in the same directory as the Project.toml

All .c/.cpp files are compiled into .o files All .h/.hpp files are included as -isystem system headers (which has a functionality super-set of the -I argument) Dependencies that provide at least one *.a will have their libraries linked into the Project executable binary Dependencies that DO NOT provide at least one *.a will have their *.o files linked into the Project executable binary

Project.toml files contain Project metadata and compiler & linker arguments that can vary depending on the Platform. - They may also contain build instructions for their Dependencies Dependency.toml files contain Dependency metadata, *.a outputs, and *.o outputs. - They may also contain build instructions. These build instructions will be overriden by those specified in Project.toml if defined.

Usage

Assuming the binary is in your PATH...

cum init <project_name> - Crate a CUM project (binary/library) cum build <project_root> - Build a debug binary cum clean - Remove the buildcache/ folder cum run [debug/release] <binary> - Build and Run the specified binary

Project.toml

# Required Variables
compiler = <compiler executable path>
linker = <linker executable path>
# Optional Variables
build_dir = <default: "buildcache/">
debug_flags = [<override the default debug compiler flags>]
release_flags = [<override the default release compiler flags]
release_script = <release .sh/.bat script/executable>
no_confirm = <true/false>           # Enable or disable the splash confirmation dialog

Install Dependencies

git/hg clone <repoistory> into the same directory as your Project.toml

[Dependency]
path = "./sdl2"

[Dependency]
path = "./glfw"

[Dependency]
path = "./glad"

Remove Dependencies

rm -rf <repository> lol Also remove the [Dependency] from your .toml

Targets

You can build either libraries or executable binaries. If you chose to build a library you can choose to link your library dynamically. Do note that this is a security risk and should only be done if you intend to provide your end-users with modding support or are trying to create your own bloaty Java/NodeJS alternative

[Target]
type = <lib/bin>
lib = <static/dynamic>
entrypoint = *.cpp/.c
name = <binary name>
libs = [...]

Platform Support

CUM supports Windows/OSX/Linux

Contributing

Install the .vimrc from ... vim -S session.vim

Dependencies

~0.8–7.5MB
~56K SLoC