Skip to content

Sharing build toolchain setup code #12

@springmeyer

Description

@springmeyer

Context

node-cpp-skel now has a single method for setting up mason and the clang++ toolchain. It lives in https://github.com/mapbox/node-cpp-skel/blob/master/scripts/setup.sh and is used like:

./scripts/setup.ch --config local.env
source local.env
# now both `clang++` and `mason` are available and on your PATH

The idea behind this script is to:

  • Make it easy to get clang++ and mason without worrying about the versions (which are controlled in the script)
  • Avoid needing to source a script that might error, which can cause problems on travis: it is best practice for bash scripts need to use set -e to stop on error, but sourcing will accidentally inherit this in the travis shell (and this cane break the travis build oddly). The output of setup.sh (aka local.env) is purely export commands for variables. So this is safe to source without worrying about breaking the travis shell.
  • This script can be a central location for adding further methods/variables needed for building C++ code
  • The script can be used locally as well as on travis ci for installing clang++. For example, a custom clang++ from mason is needed even on OS X for local coverage reporting, as demonstrated at https://github.com/mapbox/node-cpp-skel/blob/master/scripts/coverage.sh

Proposal

This setup.sh script is not specific to node addons, so we could start using and recommending it for all header only C++ libs.

So, @mapsam what do you think about pulling it into hpp-skel and adapting the travis.yml to use it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions