buildmc

Pure-Python build ochestrator using CMake or Meson to configure+build via a single simple command.


Keywords
cmake, meson, json, python
License
MIT
Install
pip install buildmc==0.6.0

Documentation

DOI

Build Status Build status Coverage Status pypi versions PyPi Download stats

Note: Meson native-files have built-in functionality that reduces the need for this program.

buildMC

A pure Python program that makes building a large, complicated project using CMake or Meson just a single, simple command. JSON from the build system API gives robust and fast build system status / interaction.

Install

Prereqs:

  • Python ≥ 3.6
  • build system: any one of:
    • CMake ≥ 3.0 + GNU Make
    • Meson + Ninja
  • compilers necessary for the project code
pip install buildmc

or to use latest development code

git clone https://github.com/scivision/buildmc

cd buildmc

pip install -e .

Usage

buildMC makes switching between compilers trivial. Also, building on native Windows and Windows Subsystem for Linux is detected and handled--the CMake or Meson cache is wiped to allow clean rebuild when switching without fuss.

The most basic use case, and what I use most frequently, is simply to specify the source directory:

buildmc ~/myproj

This uses whatever compiler and build_dir are specified in the ~/myproj/buildmc.ini If buildmc.ini doesn't exist, defaults are attempted.

Examples

Say you want to ensure a project builds with each of Visual Studio, GNU/GCC, Intel and Clang. This can be easily done by typing in the top-level of the project directory:

buildmc . -v msvc

buildmc . -v gnu

buildmc . -v intel

buildmc . -v clang

Each command independently builds and runs the user-configured tests via the selected build system. When switching between Windows and Linux (using WSL from Windows) buildMC detects the OS switch and wipes the build cache and rebuilds as needed.

Select build system

Select the build system (currently, cmake or meson) like:

buildmc . -s meson -test

The optional -test runs the project self-test, building first if necessary.

Now let's say you want to try CMake.

buildmc . -s cmake -test

Notes

CMake

An easy way to upgrade to the latest CMake on Linux or Windows is via CMakeUtils:

pip install cmakeutils

cmake_setup