From 88340ae30b5b379c08e71295d10e1b918d95e706 Mon Sep 17 00:00:00 2001 From: Truongphi20 Date: Mon, 1 Dec 2025 10:24:27 +0000 Subject: [PATCH 1/6] update: set up dev container with cmake and vcpkg --- .devcontainer/Dockerfile | 31 +++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 16 ++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..f60cc29 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,31 @@ +FROM mcr.microsoft.com/devcontainers/base:ubuntu + +# Install Ubuntu packages +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get install -y \ + build-essential \ + git \ + curl \ + pkg-config \ + unzip \ + make \ + wget \ + && apt-get clean + +# Install CMake 4.0.2 +RUN mkdir -p /usr/local \ + && cd /usr/local \ + && wget https://github.com/Kitware/CMake/releases/download/v4.0.2/cmake-4.0.2-linux-x86_64.sh \ + && chmod +x cmake-4.0.2-linux-x86_64.sh \ + && ./cmake-4.0.2-linux-x86_64.sh --skip-license + +# Install vcpkg +RUN git clone https://github.com/microsoft/vcpkg.git /usr/local/vcpkg \ + && /usr/local/vcpkg/bootstrap-vcpkg.sh -disableMetrics + +# Add vcpkg to PATH +ENV VCPKG_ROOT=/usr/local/vcpkg +ENV PATH="${VCPKG_ROOT}:${PATH}" + +# Default user +USER vscode diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..eb7ca0b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +{ + "name": "C++ Dev with vcpkg", + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "ms-vscode.makefile-tools" + ] + } + }, + "remoteUser": "vscode" +} From 301ae29ed259db4a0f592d17cfeea7006d467939 Mon Sep 17 00:00:00 2001 From: Truongphi20 Date: Mon, 1 Dec 2025 11:00:01 +0000 Subject: [PATCH 2/6] fix: install vcpkg with vscode user --- .devcontainer/Dockerfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f60cc29..d504b65 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -19,13 +19,11 @@ RUN mkdir -p /usr/local \ && chmod +x cmake-4.0.2-linux-x86_64.sh \ && ./cmake-4.0.2-linux-x86_64.sh --skip-license -# Install vcpkg -RUN git clone https://github.com/microsoft/vcpkg.git /usr/local/vcpkg \ - && /usr/local/vcpkg/bootstrap-vcpkg.sh -disableMetrics +# Switch to vscode temporarily for installing vcpkg +USER vscode -# Add vcpkg to PATH -ENV VCPKG_ROOT=/usr/local/vcpkg -ENV PATH="${VCPKG_ROOT}:${PATH}" +RUN git clone https://github.com/microsoft/vcpkg.git /home/vscode/vcpkg \ + && /home/vscode/vcpkg/bootstrap-vcpkg.sh -disableMetrics -# Default user -USER vscode +ENV VCPKG_ROOT=/home/vscode/vcpkg +ENV PATH="${VCPKG_ROOT}:${PATH}" From 49f1af7d33d9743fd4abbe8daa7bcf548de16c5c Mon Sep 17 00:00:00 2001 From: Truongphi20 Date: Mon, 1 Dec 2025 11:14:03 +0000 Subject: [PATCH 3/6] fix: installed system dependencies of opengl --- .devcontainer/Dockerfile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d504b65..f6893d9 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,6 +10,15 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ unzip \ make \ wget \ + # --- OpenGL + X11 dependencies for GLEW + GLFW --- + libx11-dev \ + libxrandr-dev \ + libxinerama-dev \ + libxcursor-dev \ + libxi-dev \ + xorg-dev \ + libgl1-mesa-dev \ + libglu1-mesa-dev \ && apt-get clean # Install CMake 4.0.2 From 671f5c04092548c2aebca14e984dab27f02a19a3 Mon Sep 17 00:00:00 2001 From: Truongphi20 Date: Mon, 1 Dec 2025 11:20:05 +0000 Subject: [PATCH 4/6] fix: connect X11 to devcontainer --- .devcontainer/devcontainer.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index eb7ca0b..68a1e1f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,5 +12,10 @@ ] } }, - "remoteUser": "vscode" + "remoteUser": "vscode", + "runArgs": [ + "--env=DISPLAY", + "--env=QT_X11_NO_MITSHM=1", + "--volume=/tmp/.X11-unix:/tmp/.X11-unix" + ] } From 79221f37172aea478a0b80321914d1e6cc4a8108 Mon Sep 17 00:00:00 2001 From: Truongphi20 Date: Mon, 1 Dec 2025 11:27:15 +0000 Subject: [PATCH 5/6] fix: use all gpu --- .devcontainer/devcontainer.json | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 68a1e1f..27a2c08 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,8 +14,10 @@ }, "remoteUser": "vscode", "runArgs": [ - "--env=DISPLAY", - "--env=QT_X11_NO_MITSHM=1", - "--volume=/tmp/.X11-unix:/tmp/.X11-unix" - ] + "--gpus=all", + "--device=/dev/dri:/dev/dri", + "--env=DISPLAY", + "--env=LIBGL_ALWAYS_INDIRECT=0", + "--volume=/tmp/.X11-unix:/tmp/.X11-unix" +] } From 53b135d08d1d23e847e28fae3117e9525a0f93e2 Mon Sep 17 00:00:00 2001 From: Truongphi20 Date: Mon, 1 Dec 2025 11:41:03 +0000 Subject: [PATCH 6/6] update: fix version of system dependencies --- .devcontainer/Dockerfile | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f6893d9..4de0feb 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,22 +3,22 @@ FROM mcr.microsoft.com/devcontainers/base:ubuntu # Install Ubuntu packages RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get install -y \ - build-essential \ - git \ - curl \ - pkg-config \ - unzip \ - make \ - wget \ + build-essential=12.10ubuntu1 \ + git=1:2.43.0-1ubuntu7.3 \ + curl=8.5.0-2ubuntu10.6 \ + pkg-config=1.8.1-2build1 \ + unzip=6.0-28ubuntu4.1 \ + make=4.3-4.1build2 \ + wget=1.21.4-1ubuntu4.1 \ # --- OpenGL + X11 dependencies for GLEW + GLFW --- - libx11-dev \ - libxrandr-dev \ - libxinerama-dev \ - libxcursor-dev \ - libxi-dev \ - xorg-dev \ - libgl1-mesa-dev \ - libglu1-mesa-dev \ + libx11-dev=2:1.8.7-1build1 \ + libxrandr-dev=2:1.5.2-2build1 \ + libxinerama-dev=2:1.1.4-3build1 \ + libxcursor-dev=1:1.2.1-1build1 \ + libxi-dev=2:1.8.1-1build1 \ + xorg-dev=1:7.7+23ubuntu3 \ + libgl1-mesa-dev=25.0.7-0ubuntu0.24.04.2 \ + libglu1-mesa-dev=9.0.2-1.1build1 \ && apt-get clean # Install CMake 4.0.2