@@ -4,6 +4,8 @@ FROM ubuntu:${VARIANT}
44
55# Restate the variant to use it later on in the llvm and cmake installations
66ARG 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
911RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
@@ -29,7 +31,7 @@ ENV CONAN_SYSREQUIRES_SUDO 0
2931ENV 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
3436ARG GCC_VER="12"
3537# Add gcc-${GCC_VER}
@@ -60,15 +62,11 @@ RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-t
6062RUN update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100
6163RUN 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
7472RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
@@ -81,26 +79,13 @@ RUN apt-get update -qq && export DEBIAN_FRONTEND=noninteractive && \
8179 doxygen graphviz ccache cppcheck xz-utils
8280
8381# Install include-what-you-use
84- ENV IWYU /home/iwyu
85- ENV IWYU_BUILD ${IWYU}/build
86- ENV IWYU_SRC ${IWYU}/include-what-you-use
87- RUN mkdir -p ${IWYU_BUILD} && \
88- git clone --branch clang_${LLVM_VER} \
89- https://github.com/include-what-you-use/include-what-you-use.git \
90- ${IWYU_SRC}
91- RUN CC=clang-${LLVM_VER} CXX=clang++-${LLVM_VER} cmake -S ${IWYU_SRC} \
92- -B ${IWYU_BUILD} \
93- -G "Unix Makefiles" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-${LLVM_VER} && \
94- cmake --build ${IWYU_BUILD} -j && \
95- cmake --install ${IWYU_BUILD}
96-
97- # Per https://github.com/include-what-you-use/include-what-you-use#how-to-install:
98- # `You need to copy the Clang include directory to the expected location before
99- # running (similarly, use include-what-you-use -print-resource-dir to learn
100- # exactly where IWYU wants the headers).`
101- RUN mkdir -p $(include-what-you-use -print-resource-dir 2>/dev/null)
102- RUN ln -s $(readlink -f /usr/lib/clang/${LLVM_VER}/include) \
103- $(include-what-you-use -print-resource-dir 2>/dev/null)/include
82+ RUN mkdir iwyu && cd iwyu \
83+ && git clone --branch clang_${LLVM_VER} https://github.com/include-what-you-use/include-what-you-use.git \
84+ && mkdir build && cd build \
85+ && cmake -G "Ninja" -DCMAKE_PREFIX_PATH=/usr/lib/llvm-${LLVM_VER} ../include-what-you-use \
86+ && ninja install \
87+ && cd ../.. \
88+ && rm -rf iwyu
10489
10590# # Cleanup cached apt data we don't need anymore
10691RUN apt-get autoremove -y && apt-get clean && \
0 commit comments