Coder Social home page Coder Social logo

sbuildr's Introduction

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++"])

# Specify that math.hpp is part of the public API for this library.
project.interfaces(["math.hpp"])

# 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

API Documentation

For more information, see the API Documentation

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.

sbuildr's People

Contributors

pmarathe25 avatar

Stargazers

Ryan McCormick avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.