Skip to content

Commit e2b8f4d

Browse files
committed
fixed cmake for lunar
- changed to install via script - aligned Dockerfile - added github workflow for building devcontainer
1 parent 7e11bc9 commit e2b8f4d

4 files changed

Lines changed: 18 additions & 16 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ FROM ubuntu:${VARIANT}
44

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

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

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

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

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

7371
# Install editors
7472
RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dockerfile": "Dockerfile",
77
// Update 'VARIANT' to pick an Ubuntu OS version. Options: [focal, jammy, lunar]. Default: lunar
88
// Update 'GCC_VER' to pick a gcc and g++ version. Options: [10, 11, 12, 13]. Default: 12
9-
// Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13, 14, 15]. Default: 15
9+
// Update 'LLVM_VER' to pick clang version. Options: [10, 11, 12, 13, 14, 15, 16, 17]. Default: 17
1010
// Update 'USE_CLANG' to set clang as the default C and C++ compiler. Options: [1, null]. Default null
1111
// "args": {
1212
// "VARIANT": "focal",
@@ -25,7 +25,7 @@
2525
"editor.formatOnSave": true
2626
},
2727
// Add the IDs of extensions you want installed when the container is created.
28-
"extensions": [
28+
"customizations/vscode/extensions": [
2929
"ms-vscode.cpptools",
3030
"ms-vscode.cmake-tools",
3131
"twxs.cmake",

.github/workflows/build_cmake.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ jobs:
2626
shell: bash
2727
run: cd docker && ./build-dev-image.sh
2828

29+
- name: Build .devcontainer docker image
30+
shell: bash
31+
run: cd .devcontainer && DOCKER_BUILDKIT=1 docker build -t devcontainer:latest .
32+
2933
linux:
3034
name: ${{ matrix.os }}, ${{ matrix.compiler.name }}, C++${{ matrix.cxx }}, ${{ matrix.buildtype }}
3135
runs-on: ${{ matrix.os }}

docker/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
FROM ubuntu:23.04 as cpp-docker-common
66

77
ARG DEBIAN_FRONTEND=noninteractive
8-
ARG CLANG_COMPILER_VERSION=15
9-
ARG CMAKE_VERSION=3.26.3
10-
ENV PATH="${PATH}:/cmake-3.26.3-linux-x86_64/bin/:"
8+
ARG CLANG_COMPILER_VERSION=17
9+
ARG CMAKE_VERSION=3.28.3
10+
ENV PATH="${PATH}:/cmake-${CMAKE_VERSION}-linux-x86_64/bin/:"
1111

1212
RUN apt-get update && apt-get -y dist-upgrade && apt-get -y install --fix-missing \
1313
binutils \

0 commit comments

Comments
 (0)