mapbox / mapbox/mason

Mason CMake

Open
#339 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
258
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Following https://github.com/mapbox/mason/issues/187, my long term goal is to split Mason in two pieces: A small-ish client that downloads/installs/uses packages, and a system that builds packages.

We're using the CMake script in gl-native with much success so far; except for a special-case to support old packages, it does not have a dependency on the `scripts` folder (cf. https://github.com/mapbox/mason/issues/186). Since that is only required for old packages, we don't need it anymore, now that we have newer versions of all packages.

I believe there's value in only having one canonical client rather than several concurrent implementations. Therefore, I'd like to evolve the CMake client and make it the canonical way of using CMake. In gl-native, our build system doesn't require the shell-script based version anymore, but some other supporting scripts still require it, and we use it to install dependencies on CI.

The road forward I am imagining looks like this:
- Add a command mode to mason.cmake by making it executable and adding a shebang of `#!/usr/bin/env cmake -P`. Instead of adding CMake as a submodule, projects now copy (!) the `mason.cmake` into their project, and can invoke `cmake/mason.cmake install libpng 1.6.20` and similar actions. The only commands we'd need to implement are `install`, `prefix`, and possibly `cflags`, et al.

This leaves out one use case: Installing cross compilers. Right now, we have dedicated support for Android toolchain flags built into Mason. Instead of having it there, I'd like to make this more generic, along the lines of `toolchain.cmake/sh` (see [GCC package](https://github.com/mapbox/mason/tree/master/scripts/gcc/5.3.0-i686)). This requires somewhat standardizing the format (/cc @springmeyer @tmpsantos) so that we can switch between compilers more easily.

Another thing to consider when removing the `scripts` dependency is that we have to manually mark packages as `HEADER_ONLY` when installing. `mason.cmake` does this by supporting a syntax like this: `mason_use(geometry VERSION 0.9.0 HEADER_ONLY)`. It might be a good idea to support the same syntax instead of porting over mason.sh syntax: `cmake/mason.cmake install geometry VERSION 0.9.0 HEADER_ONLY`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing mason.cmake and the existing scripts dependency, then compare the toolchain.cmake/sh approach with scripts/gcc/5.3.0-i686. Define the command-mode interface for install, prefix, and optional cflags, including HEADER_ONLY handling, and verify that gl-native and CI use cases no longer require the shell client.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.