Skip to main content

A python-based meta-build system for C++ projects.

Project description

SBuildr - Stupid Buildr

A stupid, simple python-based meta-build system for C++ projects.

Installation

Prerequisites

  1. RBuild
    • Install Cargo
    • Run cargo install rbuild

Installing from PyPI

pip install sbuildr

Installing from Source

  1. Clone the SBuildr source repository.
  2. Install locally with python setup.py install

A Small Example

For this example, we will assume the following directory structure:

minimal_project
├── build.py
├── include
│   └── math.hpp
├── src
│   ├── factorial.cpp
│   ├── factorial.hpp
│   ├── fibonacci.cpp
│   ├── fibonacci.hpp
│   └── utils.hpp
└── tests
    └── test.cpp

The corresponding build.py file might look like this:

#!/usr/bin/env python
import sbuildr
import os

project = sbuildr.Project()

# Build a library using two source files. Note that headers do not have to be specified manually.
# Full file paths are only required in cases where a partial path would be ambiguous.
libmath = project.library("math", sources=["factorial.cpp", "fibonacci.cpp"], libs=["stdc++"])

# Set the installation location for the library created above to /usr/local/lib.
project.install(libmath, dir=os.path.join("usr", "local", "lib"))

# Set the installation location for the public header to /usr/local/include.
project.install("math.hpp", dir=os.path.join("usr", "local", "include"))

# Specify a test for the project using the test.cpp source file. The resulting executable will be linked
# against the library created above.
test = project.test("test", sources=["test.cpp"], libs=["stdc++", libmath])

# Enable this script to be used interactively on the command-line
sbuildr.cli(project)

The call to the cli() function allows us to use the script to build interactively in a shell. For example, to run all tests registered for this project, you can run: ./build.py test

This will configure the project, build all dependencies, and finally run tests.

To view all available commands, you can run ./build.py --help

Known Limitations

  • SBuildr's header scanning functionality does not take into account preprocessor #ifdefs. This means that an #include in a false branch will still be used as a dependency during builds. Header scanning will also not work for paths containing escaped characters.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

SBuildr-0.3.2-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

Details for the file SBuildr-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: SBuildr-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 40.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for SBuildr-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d97f0a9ff0b4a063aa69fdcf6d5c329f82621f94a93472a7e7ed633006deb616
MD5 2dee57884f351a6f16165e32ef66ed22
BLAKE2b-256 96a29b412d24929486e5dde355ae81324d5466855eb9511dc98bcafceb84eb95

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