Skip to content
Molto

v0.54.0 · Linux, Windows and macOS

MoltoBuild-System, for C and C++.

One manifest, one command, no build script. Molto discovers your sources, resolves your dependencies at exact versions and drives the toolchain your project actually needs.

$ curl -fsSL https://moltobuild.dev/install.sh | sh
your first project

    
                $
                curl -fsSL https://moltobuild.dev/install.sh | sh
            
                
                  ==> pickup 0.11.0  checksum verified
            
                
                  ==> molto 0.54.0   checksum verified
            
                $
                molto new my_app && cd my_app
            
                $
                molto run
            
                
                Hello, world!
            

What you stop maintaining

Every feature below replaces something you would otherwise hand-write in a Makefile, a CMakeLists.txt or a CI script.

No file lists

Every .c, .cpp and .cc file under src/ and tests/ is compiled automatically. You never enumerate sources again — but your build settings stay explicit in the manifest, so nothing is ever guessed.

Exact dependencies

molto add fetches a package and pins it at an exact version. Ranges are refused, not interpreted: no release enters your build without a diff. Molto.lock records the whole graph with checksums.

Toolchains, resolved

Your manifest states the capabilities your code needs. pickup answers which local compiler provides them, and the answer is cached in the workspace — asked once, not on every build.

Format and lint included

molto fmt and molto lint drive clang-format and clang-tidy from two JSON files. No .clang-format to copy between repositories, and no linter installed is still not an error.

A bill of materials

molto metadata writes a CycloneDX 1.6 document Dependency-Track, Grype and Trivy read untranslated. No timestamp, no serial number: two runs over one graph produce identical bytes.

Incremental, and honest about it

Only what changed is rebuilt, dependency objects are cached across projects, and every build writes compile_commands.json so clangd sees the flags the build actually used.

System libraries, without a package manager

molto add gtk uses the GTK your system already has. Where it has none, Molto downloads that platform's own packages — Homebrew bottles, MSYS2, the Ubuntu, Fedora or Arch development packages — verifies every SHA-256 and keeps them in its cache. No apt, no brew, no root.

Programs and libraries

artifact = "static" or "shared" builds a library instead of a program, with the soname and the version links each platform expects. The same manifest, one key apart.

Linux, Windows and macOS

Every release ships an x86-64 Linux, an x86-64 Windows and an arm64 macOS binary. molto build --target <triple> builds your project for another platform than the one you are on.

The whole configuration

This is a complete project. There is no second file, no generator step and no fallback to a Makefile.

Project.toml

        
                            [package]
                        
                        name
                        =
                        "my_app"
                    
                        version
                        =
                        "0.1.0"
                     
                            [target]
                        
                        std
                        =
                        "c17"
                    
                        include
                        =
                        ["include"]
                    
                        link
                        =
                        ["m"]
                     
                            [deps]
                        
                        sqlite
                        =
                        "3.53.4"
                     
                            [profile.release]
                        
                        opt_level
                        =
                        3
                    
                        debug_info
                        =
                        false
                    
    

Molto discovers your sources; it does not discover your build settings.

Sources are found for you. Include paths, defines, link libraries and test layout are only ever what the manifest says — which is why a build behaves the same on your machine and in CI.

The commands

Every one of them finds your project by walking up from where you stand.

Testing, built in

molto test builds the suite and runs it. Coverage, fakes and sanitizers are a profile or a manifest key away — never a second build system for the tests.

One binary per file, or one suite

By default every file under tests/ is its own executable, linked against your code minus src/main.c. A framework that owns main() — moltest — links everything into one suite with mode = "single".

Coverage is a profile

molto test --profile coverage instruments src/ and tests/ itself; the manifest needs nothing. Dependencies are left out, so the figure is your code's. A suite of many executables is measured as one run.

Fakes that replace real code

A [[test.isolated]] file is linked alone, without the sources it names, so a fake it defines stands in for the real function — the error a disk or a network cannot be made to give on demand.

Sanitizers in a profile

Flags in a profile reach both the compile and the link line, so a [profile.custom] with -fsanitize=address,undefined runs the whole suite under AddressSanitizer and UBSan. Molto's own CI does exactly that.

Project.toml — the test half

        
                            [test]
                        
                        mode
                        =
                        "single"
                     
                            # Isolated: linked alone, without what it replaces
                        
                            [[test.isolated]]
                        
                        file
                        =
                        "tests/test_store_failures.c"
                    
                        replaces
                        =
                        ["src/disk.c"]
                     
                            # The [dev-deps.<name>] table is [dev-deps] spelled long
                        
                            [dev-deps.moltest]
                        
                        git
                        =
                        "https://github.com/moltobuild/moltest"
                    
                        tag
                        =
                        "v0.3.0"
                     
                            [dev-deps.moltest_coverage]
                        
                        git
                        =
                        "https://github.com/moltobuild/moltest-coverage"
                    
                        tag
                        =
                        "v0.2.1"
                     
                            [dev-deps.moltest_mock]
                        
                        git
                        =
                        "https://github.com/moltobuild/moltest-mock"
                    
                        tag
                        =
                        "v0.4.0"
                    
    

Development packages

Taken under [dev-deps]: they reach the test build and never the program you ship.

moltest
The test framework: DESCRIBE, EXPECT and ASSERT, and it owns main().
moltest_coverage
Line, branch and function coverage of src/ after a coverage run, lcov and JSON, and a fail_under floor read from moltest-coverage.toml.
moltest_mock
MOCK_VALUE_FUNC and MOCK_VOID_FUNC: fakes that count their calls, remember their arguments and return what the test says.

The registry

Where a coordinate becomes bytes. One protocol serves toolchains to pickup and packages to molto, so a build fetches what it needs instead of a full compiler release.

Coordinates never change meaning

One blob per name, version and target, forever. Nothing is deleted: a withdrawn artifact is yanked, so the builds that already pinned it keep resolving.

Checksums measured, not declared

The SHA-256 is computed from the stored archive and travels with the download, so a client verifies the bytes it got rather than the bytes a recipe claimed.

Trimmed to what a build uses

A published clang is 77 MB where the upstream release is 11 GB: the sanitizers nobody linked, the debugger and the development kit stay out.

The registry

    
                $
                pickup install clang@22.1.8
            
                
                  ==> clang 22.1.8   checksum verified
            
                $
                molto add sqlite@3.53.4
            
                
                  added sqlite 3.53.4 to [deps]
            
                $
                molto add gtk
            
                
                  added gtk 4.14.0 to [deps]
            
Browse the registry

Search it, or read what a recipe declares.

Read a real project

Five small, complete projects, each one a Project.toml, its sources and its tests. Clone the repository and molto run any of them.

wordcount

A wc clone with no dependencies: a C23 executable whose compiler pickup chooses from requires, and tests that bring their own main().

calculator

A GTK 4 desktop calculator: gtk from the registry as each platform's own packages, and its rules tested with moltest, apart from the window.

todo

A GTK 4 to-do list kept in SQLite: two kinds of dependency side by side, and a store tested against a real database, in memory and on disk.

hello_api

A REST API that answers in JSON: libwebsockets configured by its own CMake, with OpenSSL as a dependency, and routes tested without a server.

piano

A piano played with the mouse or keyboard: SDL 3 for the window and sound, FFmpeg to read samples and record what you play, both built from source recipes.

Browse the examples

github.com/moltobuild/molto-examples

Build it with one command

Molto is written in C and builds itself. Clone the repository, read the docs and try it on a project you already have.

Open the repository

Or read the documentation first — it states what the binary does today.