Skip to content

Commit

Permalink
fixed cmake for lunar
Browse files Browse the repository at this point in the history
- changed to install via script
- aligned Dockerfile
- added github workflow for building devcontainer
  • Loading branch information
StephanKa committed Feb 17, 2024
1 parent 7e11bc9 commit e2b8f4d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
20 changes: 9 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ FROM ubuntu:${VARIANT}

# Restate the variant to use it later on in the llvm and cmake installations
ARG VARIANT
ARG CMAKE_VERSION=3.28.3
ENV PATH="${PATH}:/cmake-${CMAKE_VERSION}-linux-x86_64/bin/:"

# Install necessary packages available from standard repos
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
Expand All @@ -29,7 +31,7 @@ ENV CONAN_SYSREQUIRES_SUDO 0
ENV CONAN_SYSREQUIRES_MODE enabled

# User-settable versions:
# This Dockerfile should support gcc-[10, 11, 12] and clang-[10, 11, 12, 13, 14, 15]
# This Dockerfile should support gcc-[10, 11, 12, 13] and clang-[10, 11, 12, 13, 14, 15, 16, 17]
# Earlier versions of clang will require significant modifications to the IWYU section
ARG GCC_VER="12"
# Add gcc-${GCC_VER}
Expand All @@ -42,7 +44,7 @@ RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
RUN update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100
RUN update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100

ARG LLVM_VER="15"
ARG LLVM_VER="17"
# Add clang-${LLVM_VER}
ARG LLVM_URL="http://apt.llvm.org/${VARIANT}/"
ARG LLVM_PKG="llvm-toolchain-${VARIANT}-${LLVM_VER}"
Expand All @@ -60,15 +62,11 @@ RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-t
RUN update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100
RUN update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100

# Add current cmake/ccmake, from Kitware
ARG CMAKE_URL="https://apt.kitware.com/ubuntu/"
# FALLBACK because lunar isn't support yet by kitware
ARG CMAKE_PKG=${VARIANT}
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
apt-add-repository -y "deb ${CMAKE_URL} ${CMAKE_PKG} main" && \
apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
apt-get install -y --no-install-recommends cmake cmake-curses-gui
# Add install cmake/ccmake
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
&& chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh \
&& ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --include-subdir --skip-license \
&& rm cmake-${CMAKE_VERSION}-linux-x86_64.sh

# Install editors
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu OS version. Options: [focal, jammy, lunar]. Default: lunar
// Update 'GCC_VER' to pick a gcc and g++ version. Options: [10, 11, 12, 13]. Default: 12
// Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13, 14, 15]. Default: 15
// Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13, 14, 15, 16, 17]. Default: 17
// Update 'USE_CLANG' to set clang as the default C and C++ compiler. Options: [1, null]. Default null
// "args": {
// "VARIANT": "focal",
Expand All @@ -25,7 +25,7 @@
"editor.formatOnSave": true
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"customizations/vscode/extensions": [
"ms-vscode.cpptools",
"ms-vscode.cmake-tools",
"twxs.cmake",
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
shell: bash
run: cd docker && ./build-dev-image.sh

- name: Build .devcontainer docker image
shell: bash
run: cd .devcontainer && DOCKER_BUILDKIT=1 docker build -t devcontainer:latest .

linux:
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}, ${{ matrix.buildtype }}
runs-on: ${{ matrix.os }}
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
FROM ubuntu:23.04 as cpp-docker-common

ARG DEBIAN_FRONTEND=noninteractive
ARG CLANG_COMPILER_VERSION=15
ARG CMAKE_VERSION=3.26.3
ENV PATH="${PATH}:/cmake-3.26.3-linux-x86_64/bin/:"
ARG CLANG_COMPILER_VERSION=17
ARG CMAKE_VERSION=3.28.3
ENV PATH="${PATH}:/cmake-${CMAKE_VERSION}-linux-x86_64/bin/:"

RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install --fix-missing \
binutils \
Expand Down

0 comments on commit e2b8f4d

Please sign in to comment.