Skip to main content

A build system for C++.

Project description

Buildcpp: A Python Build System for C++ Projects

MIT-LICENSE
PyPI

Buildcpp is a build tool that uses Python as the scripting language for C++ projects. Its minimalist design makes building C++ projects straightforward and efficient.

Installation

Buildcpp requires Python 3.7 or higher. You can download Python from python.org.
Once Python is installed, install Buildcpp via pip:

pip install buildcpp

Buildcpp also depends on CMake 3.15 or later, which you can download from cmake.org.
Under the hood, Buildcpp uses Python for front-end scripting and CMake as the back-end build engine.

Usage

Buildcpp is a Python package that provides a set of APIs for defining and building C++ projects.
To use it, simply create a Python script in your project directory and define your build using Buildcpp’s API. Running this script will execute the build.

While Buildcpp uses a script-based approach, the script itself resembles a configuration file. This design choice stems from the fact that C++ builds often involve numerous configuration options, which can become cumbersome in static configuration files.

Here’s a minimal example:

from buildcpp import Target, Builder, Scope
from pathlib import Path

# Get current directory
ROOT = Path(__file__).parent

# Define a build target
target = Target('main')\
    .add_sources(Scope.PRIVATE, ROOT / 'main.cpp')

if __name__ == '__main__':
    # Create a builder and compile the target
    builder = Builder()
    builder.attach(target)
    builder.build()

Even without prior Python experience, you can likely understand what’s happening if you’re familiar with C++.
The Target object is central to Buildcpp—it holds all the metadata needed for the build, much like a configuration file.

If you want to learn more, check out the documentation.

LICENSE

This project is licensed under the MIT license.

Project details


Download files

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

Source Distribution

buildcpp-0.2.5.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

buildcpp-0.2.5-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file buildcpp-0.2.5.tar.gz.

File metadata

  • Download URL: buildcpp-0.2.5.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for buildcpp-0.2.5.tar.gz
Algorithm Hash digest
SHA256 f5725d29337d0f5ee13f990694ab12c2c92812bed676a8799c51564295d5ace7
MD5 35524db83f07fa4ae47fb44629b3ed32
BLAKE2b-256 7a44e9909f6096bc136d78703ecd8ec67abfb3c173432a1d45265feefa97f963

See more details on using hashes here.

File details

Details for the file buildcpp-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: buildcpp-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for buildcpp-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3072b2031f7c736643f1804313d8d9a81f0582a36397597df6dddc2f90f220d3
MD5 46315eda0d5f94b18af4ddd9b0ae76e0
BLAKE2b-256 d507f5709f819eeb5d00f70818c187454ed01050963757a83b4b2791a96b4429

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