Configurable CC/CXX compiler toolchain in Dockerfiles. (#1402)

Allows to build Docker images with Clang.
master
Michael Grupp 2018-10-31 15:34:05 +01:00 committed by Wally B. Feed
parent 01af348100
commit aaa8a9a652
7 changed files with 44 additions and 4 deletions

View File

@ -22,14 +22,15 @@ cache:
- /home/travis/docker/
env:
- LSB_RELEASE=trusty DOCKER_CACHE_FILE=/home/travis/docker/trusty-cache.tar.gz
- LSB_RELEASE=xenial DOCKER_CACHE_FILE=/home/travis/docker/xenial-cache.tar.gz
- LSB_RELEASE=jessie DOCKER_CACHE_FILE=/home/travis/docker/jessie-cache.tar.gz
- LSB_RELEASE=stretch DOCKER_CACHE_FILE=/home/travis/docker/stretch-cache.tar.gz
- LSB_RELEASE=trusty DOCKER_CACHE_FILE=/home/travis/docker/trusty-cache.tar.gz CC=gcc CXX=g++
- LSB_RELEASE=xenial DOCKER_CACHE_FILE=/home/travis/docker/xenial-cache.tar.gz CC=gcc CXX=g++
- LSB_RELEASE=jessie DOCKER_CACHE_FILE=/home/travis/docker/jessie-cache.tar.gz CC=gcc CXX=g++
- LSB_RELEASE=stretch DOCKER_CACHE_FILE=/home/travis/docker/stretch-cache.tar.gz CC=gcc CXX=g++
before_install: scripts/load_docker_cache.sh
install: true
script:
- docker build ${TRAVIS_BUILD_DIR} -t cartographer:${LSB_RELEASE} -f Dockerfile.${LSB_RELEASE}
--build-arg cc=$CC --build-arg cxx=$CXX
- scripts/save_docker_cache.sh

View File

@ -14,6 +14,13 @@
FROM debian:jessie
ARG cc
ARG cxx
# Set the preferred C/C++ compiler toolchain, if given (otherwise default).
ENV CC=$cc
ENV CXX=$cxx
# This base image doesn't ship with sudo.
RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*

View File

@ -14,6 +14,13 @@
FROM debian:stretch
ARG cc
ARG cxx
# Set the preferred C/C++ compiler toolchain, if given (otherwise default).
ENV CC=$cc
ENV CXX=$cxx
# This base image doesn't ship with sudo.
RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*

View File

@ -13,6 +13,14 @@
# limitations under the License.
FROM ubuntu:trusty
ARG cc
ARG cxx
# Set the preferred C/C++ compiler toolchain, if given (otherwise default).
ENV CC=$cc
ENV CXX=$cxx
COPY scripts/install_debs_cmake.sh cartographer/scripts/
RUN cartographer/scripts/install_debs_cmake.sh && rm -rf /var/lib/apt/lists/*
COPY scripts/install_ceres.sh cartographer/scripts/

View File

@ -13,6 +13,14 @@
# limitations under the License.
FROM ubuntu:trusty
ARG cc
ARG cxx
# Set the preferred C/C++ compiler toolchain, if given (otherwise default).
ENV CC=$cc
ENV CXX=$cxx
COPY scripts/install_debs_bazel.sh cartographer/scripts/
RUN cartographer/scripts/install_debs_bazel.sh && rm -rf /var/lib/apt/lists/*
COPY . cartographer

View File

@ -12,8 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:xenial
ARG cc
ARG cxx
# Set the preferred C/C++ compiler toolchain, if given (otherwise default).
ENV CC=$cc
ENV CXX=$cxx
# This base image doesn't ship with sudo.
RUN apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*

View File

@ -35,6 +35,7 @@ else
fi
sudo apt-get install -y \
clang \
g++ \
git \
google-mock \