Giter VIP home page Giter VIP logo

dockerized_cpp's Introduction

License: MIT

Dockerized C/C++ Build Environment

This repository contains a single highly customizable Makefile helping to build C/C++ projects in a docker container.

Usage

  • Add this repository as a git submodule to your project, for example as directory build_tools:
    git submodule add https://github.com/f-squirrel/dockerized_cpp.git build_tools/
  • Create a Makefile in the root of your project's source tree
  • Override the variables from the list in the Makefile
  • Include the Makefile from this repository in your new Makefile: include build_tools/Makefile

In order to see available commands including user-defined ones, run make help:

$ make help
gen_cmake                      Generate cmake files, used internally
build                          Build source. In order to build a specific target run: make TARGET=<target name>.
test                           Run all tests
clean                          Clean build directory
login                          Login to the container. Note: if the container is already running, login into existing one
build-docker-deps-image        Build the deps image.

Example

An example of usage can be found in the repository "Dockerized C/C++ Build Example".

List of variables

Variable name Default value Description
PROJECT_NAME project Name of the project, by default used in multiple places
DOCKER_CC clang C compiler used in the project
DOCKER_CXX clang++ C++ copmiler used in the project
DOCKER_DEPS_REPO ${PROJECT_NAME}/ Docker repository where the build image is stored
DOCKER_DEPS_IMAGE ${PROJECT_NAME}_build The name of the build image
DOCKER_DEPS_VERSION latest Docker image version
DOCKER_DEPS_CONTAINER ${DOCKER_DEPS_IMAGE} The name of build's docker container
DOCKER_DEPS_FILE DockerfileBuildEnv Dockerfile used for building the build image
DOCKER_DEPS_IMAGE_BUILD_FLAGS --no-cache=true Flags used for building the image, note with this flag on, docker rebuilds from scratch the whole image
DOCKER_PREPEND_MAKEFILES empty The list of space-separated custom Makefiles to be included before default targets
DOCKER_APPEND_MAKEFILES empty The list of space-separated ustom Makefiles to be included after default targets
DOCKER_CMAKE_FLAGS empty Project specific CMake flags
DOCKER_SHELL bash Shell used in the container
LOCAL_SOURCE_PATH Current directory The path to the source files
DOCKER_SOURCE_PATH /${PROJECT_NAME} Path where source files are mounted in the container
DOCKER_BUILD_DIR build Cmake build directory
DOCKER_CTEST_TIMEOUT 5000 CMake test timeout
DOCKER_TEST_CORE_DIR ${DOCKER_BUILD_DIR}/cores Path to the core files. For more information on configuring core dumps in docker please refer here
DOCKER_ADDITIONAL_RUN_PARAMS empty Additional docker run commands
DOCKER_BASIC_RUN_PARAMS link to the code Default commands used for running the build container
DOCKER_USER_ROOT OFF Runs container as root user

dockerized_cpp's People

Contributors

f-squirrel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.