steve-downey / scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

https://github.com/steve-downey/scratch/actions/workflows/ci.yml/badge.svg

1 A Base ‘scratch’ template repository

Scratch work

The repository is also my work on, if not ‘best’, at least good practices with CMake and emerging consensus on file and directory layout.

2 CMake Workflow – targets.mk

The targets.mk Makefile embodies the normal cmake workflow, making sure the build area is configured for a particular toolchain, compile is run after that, that tests are rebuilt and run after compiling, and so forth.

The Ninja multi-config generator is used, and several configs are created in the build area;

  • RelWithDebInfo
  • Debug
  • Tsan
  • Asan

The default build is RelWithDebInfo. Other options are selected by the CONFIG paramter.

make CONFIG=Asan

The top level Makefile is executable, and is symlinked as build, so equivalently

./build CONFIG=Asan

The build is done, by default, in ../cmake.bld/$(dirname)/build, controlled by the PROJECT variable.

Additional CMake flags can be supplied by CMAKE_FLAGS

3 Submodules

A few git submodules I find useful are linked in.

4 Docker

The workflow can be forwarded to a Docker image, instead of being built in the host system.

The target use-docker enables this by creating the flag file .use-docker

The base image can be created by using the definition in docker-inf/docker-cxx-dev/ with the Makefile provided.

The target docker-rebuild will create an image for this project, by default on the image steve-downey/cxx-dev:latest but can be overridden by setting BASE.

The targets in targets.mk can run in either the host or in a docker container. The targets in Makefile either help build or control that image, or forward to targets.mk.

About

License:Apache License 2.0


Languages

Language:TeX 99.5%Language:CMake 0.3%Language:Makefile 0.2%Language:Dockerfile 0.1%Language:C++ 0.0%