summaryrefslogtreecommitdiff
path: root/.devcontainer
diff options
context:
space:
mode:
authorcoavins <me@coavins.org>2026-02-25 20:24:22 -0500
committerGitHub <noreply@github.com>2026-02-26 01:24:22 +0000
commitc2cf154e3e813acb1b298c82f64a61c38e3d16f6 (patch)
tree640592c7aeceedfcd8254a52e308f7fda75fd0c7 /.devcontainer
parent0e99b30e914b4baf910318b8ec1b1c9b2cd3aaa1 (diff)
Update .vscode and .devcontainer files (#6246)
This commit makes some changes to the dockerfile to make it work again. We install cmake from source in order to meet the minimum required version specified in the CMakeLists.txt file. We build the same version that is installed on the CI runner image. We also build tinyxml2 from source because we need some cmake files that are apparently not included in the apt package.
Diffstat (limited to '.devcontainer')
-rw-r--r--.devcontainer/Dockerfile58
1 files changed, 55 insertions, 3 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index d59e6ec4c..4e2f2fe90 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,13 +1,65 @@
FROM mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04
-RUN apt-get update && apt-get install -y libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev ninja-build
+RUN apt-get update && apt-get upgrade -y \
+ && rm -rf /var/lib/apt/lists/*
+
+# download and install cmake from source
+# this ensures we use the same version as in the github runner image
+RUN apt-get purge -y cmake || true
+ARG CMAKE_VERSION=3.31.11
+# download
+WORKDIR /tmp
+RUN curl -fsSL \
+ https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \
+ -o cmake.tar.gz \
+ && tar -xzf cmake.tar.gz \
+ && rm cmake.tar.gz
+ # build and install
+WORKDIR /tmp/cmake-${CMAKE_VERSION}
+RUN ./bootstrap \
+ --prefix=/usr/local \
+ --parallel=$(nproc) \
+ && make -j$(nproc) \
+ && make install
+# clean up
+WORKDIR /
+RUN rm -rf /tmp/cmake-${CMAKE_VERSION}
+
+# download and install tinyxml2 from source
+# this ensures we have the cmake files needed for find_package
+RUN apt-get purge -y libtinyxml2-dev || true
+ARG TINYXML2_VERSION=11.0.0
+# download
+WORKDIR /tmp
+RUN curl -fsSL \
+ https://github.com/leethomason/tinyxml2/archive/refs/tags/${TINYXML2_VERSION}.tar.gz \
+ -o tinyxml2.tar.gz \
+ && tar -xzf tinyxml2.tar.gz \
+ && rm tinyxml2.tar.gz
+ # build and install
+WORKDIR /tmp/tinyxml2-${TINYXML2_VERSION}
+RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
+ && cmake --build build --parallel $(nproc) \
+ && cmake --install build
+# clean up
+WORKDIR /
+RUN rm -rf /tmp/tinyxml2-${TINYXML2_VERSION}
+
+# install apt dependencies
+RUN apt-get update && apt-get install -y \
+ libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev \
+ libglew-dev nlohmann-json3-dev libspdlog-dev ninja-build libogg-dev \
+ libopus-dev opus-tools libopusfile-dev libvorbis-dev libespeak-ng-dev \
+ lsb-release git clang clang-format-14 zipcmp zipmerge ziptool \
+ libopengl-dev libbz2-dev libzip-dev \
+ && rm -rf /var/lib/apt/lists/*
# Install latest SDL2
RUN wget https://www.libsdl.org/release/SDL2-2.26.1.tar.gz && \
tar -xzf SDL2-2.26.1.tar.gz && \
cd SDL2-2.26.1 && \
./configure && \
- make && \
+ make -j$(nproc) && \
make install && \
cd .. && \
rm -rf SDL2-2.26.1 && \
@@ -19,7 +71,7 @@ RUN wget https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.2.0.tar.gz &
tar -xzf SDL2_net-2.2.0.tar.gz && \
cd SDL2_net-2.2.0 && \
./configure && \
- make && \
+ make -j$(nproc) && \
make install && \
cd .. && \
rm -rf SDL2_net-2.2.0 && \