A simple to use JSON based C++ build system for Linux wihout the headaches of cmake.
Find a file
2025-03-30 00:07:39 +01:00
.github/workflows workflow fix 2025-02-03 22:22:32 +01:00
.gitignore added license 2024-12-29 01:04:33 +01:00
build.sh march, flags, and git dependencies 2025-02-03 22:06:54 +01:00
Crafter.Build-Configuration.cpp added specfic git commit or branch dependency 2025-03-29 22:36:43 +01:00
Crafter.Build-Configuration.cppm march, flags, and git dependencies 2025-02-03 22:06:54 +01:00
Crafter.Build-Dependency.cpp added specfic git commit or branch dependency 2025-03-29 22:36:43 +01:00
Crafter.Build-Dependency.cppm added specfic git commit or branch dependency 2025-03-29 22:36:43 +01:00
Crafter.Build-ModuleFile.cpp bugfixes 2025-02-12 21:35:25 +01:00
Crafter.Build-ModuleFile.cppm multithreaded module compilation 2024-12-31 20:32:00 +01:00
Crafter.Build-Project.cpp added specfic git commit or branch dependency 2025-03-29 22:36:43 +01:00
Crafter.Build-Project.cppm added additional_files 2025-01-02 02:53:39 +01:00
Crafter.Build.cppm multithreaded module compilation 2024-12-31 20:32:00 +01:00
json.hpp initial commit 2024-12-28 21:00:12 +01:00
LICENSE multithreaded module compilation 2024-12-31 20:32:00 +01:00
main.cpp march, flags, and git dependencies 2025-02-03 22:06:54 +01:00
project.json multithreaded module compilation 2024-12-31 20:32:00 +01:00
README.md test 2025-03-30 00:07:39 +01:00

About

This is a simple and easy to use C++ build system for Linux designed for use with C++20 modules in mind, it uses JSON based project files.

Install

Prerequisites:

lld
clang 18>
git

Download Release

Please view the latest x86 version in the releases

Build from source

git clone https://github.com/Catcrafts/Crafter.Build.git
cd Crafter.Build
./build.sh

(optionally add to path)

How to use

Quickstart

create a project.json in an empty folder, open it in your preferred text editor. Create a basic project file, with a base configuration and debug and release configuration

{
    "name": "hello-world",
    "configurations": [
        {
            "name": "base",
            "standard": "c++26",
            "source_files": ["main"],
            "module_files": [],
            "build_dir": "./build",
            "output_dir": "./bin"
        },
        {
            "name": "debug",
            "extends": ["base"],
            "optimization_level": "0"
        }
        {
            "name": "release",
            "extends": ["base"],
            "optimization_level": "3"
        }
    ]
}

Save and close the file, create a main.cpp

#include <print>
int main() {
  std::println("Hello World!");
}

Save and close, then run crafter-build -c debug. Now you can run the hello-world executable that has appeared in the bin folder

CLI arguments

--help Displays a help message.

-c The name of the configuration to build.

-p The path to the project file, defaults to project.json.

-o Overrides the output folder.

-r Runs the executable after building.

configuration properties

name Name of the configuration.

standard C++ standard that this configuration uses, please refer to the relevant clang documentation, defaults to c++26.

source_files All source files of the project .cpp extension is assumed.

module_files All C++ 20 module files of the project .cppm extension is assumed.

additional_files Files that will be copied to the output_dir.

build_dir The directory where intermediate files are stored.

output_dir The directory where the output files will be placed.

type The type of the project: executable, library, shared-library, defaults to executable.

extends An array of configuration names that this configuration extends, later elements in the array take priority over previous ones.

optimization_level Please refer to the relevant clang documentation, defaults to 0.

dependencies An object array of the dependencies of this project, example:

"dependencies": [
    {
        "path":"/home/Crafter.Build/project.json",
        "configuration":"debug-lib"
    }
    {
        "path":"https://github.com/Catcrafts/Crafter.Build.git",
        "configuration":"debug-lib"
    }
]

This will now link the library of Crafter.Build in the configuration you use this in.

target Clang triplet this configuration uses, please refer to the relevant clang documentation.

Note: the WASI SDK needs to be installed to compile to webassmbly, and $WASI_SDK_PATH needs to be set, please refer to the wasi-sdk installation guide.

test