From ff7276be18a460eae87065201ca4e35dd1239911 Mon Sep 17 00:00:00 2001 From: zukrmn Date: Fri, 6 Mar 2026 15:30:21 +0000 Subject: [PATCH] docs: add devcontainer and missing libpng-dev dependency --- .devcontainer/Dockerfile | 36 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 17 ++++++++++++++++ README.md | 13 +++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..91eb40723 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,36 @@ +FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04 + +ENV DEBIAN_FRONTEND=noninteractive + +# Dependencies +RUN apt-get update \ + && apt-get install -y software-properties-common \ + && add-apt-repository -y ppa:ubuntu-toolchain-r/test \ + && apt-get update \ + && apt-get install -y \ + build-essential \ + cmake \ + libglfw3-dev \ + libgl-dev \ + libglu1-mesa-dev \ + libopenal-dev \ + libvorbis-dev \ + libpng-dev \ + libpthread-stubs0-dev \ + lld \ + meson \ + ninja-build \ + gcc-15 \ + g++-15 \ + # Clean up lol + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Set GCC 15 as default +RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 100 \ + && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-15 100 \ + && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 100 \ + && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 100 + +ENV DEBIAN_FRONTEND=dialog \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..8cb772dff --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "4JCraft Dev Container", + "build": { + "dockerfile": "Dockerfile" + }, + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "mesonbuild.mesonbuild" + ] + } + }, + "remoteUser": "vscode" +} diff --git a/README.md b/README.md index 9abd14374..01fcfac0d 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ sudo apt install \ build-essential cmake \ libglfw3-dev libgl-dev libglu1-mesa-dev \ libopenal-dev libvorbis-dev \ - libpthread-stubs0-dev + libpng-dev libpthread-stubs0-dev ``` On Arch/Manjaro: @@ -43,6 +43,17 @@ sudo pacman -S base-devel gcc pkgconf cmake glfw-x11 mesa openal libvorbis glu If you are on wayland, you may swap `glfw-x11` to `glfw-wayland` for native wayland windowing instead of xwayland. +On Docker: + +If you don't want to deal with installing dependencies, you can use the included devcontainer. Open the project in VS Code with the [Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension and it will set everything up for you — GCC 15, Meson, Ninja, lld, and all the libraries. + +Alternatively, you can build and use the container manually: + +```bash +docker build -t 4jcraft-dev .devcontainer/ +docker run -it -v $(pwd):/workspaces/4jcraft -w /workspaces/4jcraft 4jcraft-dev bash +``` + ### Configure & Build > [!IMPORTANT]