PitchHut
Log in / Sign up
bs.h
4 views
Simplify your C/C++ projects with a header-only build system.
Pitch

bs.h is a header-only build system designed for C and C++ that streamlines your development process. With easy integration and a simple target declaration, you can efficiently manage your project dependencies and compilation settings without needing complex configurations. Boost your productivity with bs.h.

Description

bs.h is a powerful header-only build system designed specifically for C and C++ projects. It simplifies the build process by allowing developers to easily define build targets, headers, and dependencies directly within their source code, providing a streamlined and efficient workflow.

Key Features

  • Header-Only: No need for complex setup or installation; simply include bs.h in your project.
  • Flexible Target Definitions: Effortlessly create libraries and binaries with straightforward syntax:
#include "bs.h"

static auto const hello = target([]{
    return cpp_library("Hello", {
        .srcs = {
            "Hello.cpp",
        },
        .exported_headers = {
            "Hello.h",
        },
        .header_namespace = "Hello",
        .compile_flags = {},
        .linker_flags = {},
        .target_triple = system_target_triple(),
        .link_style = "static",
        .deps = {},
    });
});

static auto const example = target([]{
    return cpp_binary("example", {
        .srcs = {
            "main.cpp",
        },
        .compile_flags = {},
        .linker_flags = {},
        .target_triple = system_target_triple(),
        .deps = {
            hello,
        },
    });
});
  • Streamlined Setup: Setup your build environment with ease. The setup function initializes the build folder, and the generated Ninja build file simplifies the build process, ensuring optimal performance:
int main()
{
    setup("build");
    FILE* ninja = fopen("build/build.ninja", "w");
    if (!ninja) {
        perror("could not open build/build.ninja");
        return 1;
    }
    emit_ninja(ninja, all_targets);
    fclose(ninja);
    return 0;
}

With bs.h, focus on coding your application without getting bogged down in the intricacies of build configuration. Ideal for both small and large projects, this build system enhances productivity and fosters a clean architecture.