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.4.tar.gz (9.6 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.4-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: buildcpp-0.2.4.tar.gz
  • Upload date:
  • Size: 9.6 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.4.tar.gz
Algorithm Hash digest
SHA256 f633cd54ba47f414037a0a9757ec638b68b29cff4b5d81cf85de85f9b213de8c
MD5 cd52df8deac6aa097a1c8e80df21bdd4
BLAKE2b-256 058a1e5a442c6ec156ddac57a960560c58017c580f48282ee11852d25d835e95

See more details on using hashes here.

File details

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

File metadata

  • Download URL: buildcpp-0.2.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ee308efabd30ed2e215d8ecfd845dce201baa62799db71cc5b2fb0150f40b7ed
MD5 cb43c81fb0db8c109b2fadf8d2c8c41d
BLAKE2b-256 2d7ccdf6058a9feb9b92f5768b687126386da7a87bd53b9c2d0029e65efc7576

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