From 231c0bce7ef6835de003fe8a266b0acf4d80e806 Mon Sep 17 00:00:00 2001 From: Usow Maxim Date: Mon, 12 May 2025 08:11:29 +0700 Subject: [PATCH] Can build with docker on Windows --- Dockerfile | 10 ++++++++++ README.md | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Dockerfile b/Dockerfile index f52496de..9d0005f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ g++ \ make \ cmake \ + pkg-config \ xauth \ gdb \ gdbserver \ @@ -25,8 +26,17 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ libvorbis-dev \ libcurl4-openssl-dev \ ca-certificates \ + wget \ && rm -rf /var/lib/apt/lists/* +# Установка CMake >= 3.26 вручную +ARG CMAKE_VERSION=3.27.9 +RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh && \ + chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh && \ + ./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license --prefix=/usr/local && \ + rm cmake-${CMAKE_VERSION}-linux-x86_64.sh + + # Install EnTT RUN git clone https://github.com/skypjack/entt.git && \ cd entt/build && \ diff --git a/README.md b/README.md index 91318051..832ac43f 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,8 @@ cmake --build --preset default-vs-msvc-windows See +### Do you have Linux + ### Step 1. Build docker container ```sh @@ -157,3 +159,31 @@ docker run --rm -it -v$(pwd):/project voxel-engine bash -c "cmake -DCMAKE_BUILD_ ```sh docker run --rm -it -v$(pwd):/project -v/tmp/.X11-unix:/tmp/.X11-unix -v${XAUTHORITY}:/home/user/.Xauthority:ro -eDISPLAY --network=host voxel-engine ./build/VoxelEngine ``` + +### Do you have Windows + +### Step 1. You need to install VcXsrv + +### Step 2. Run VcXsrv with the command + +```powershell +.\vcxsrv.exe :0 -multiwindow -ac +``` + +### Step 3. Build docker container + +```powershell +docker build -t voxel-engine . +``` + +### Step 4. Build project using the docker container + +```powershell +docker run --rm -it -v "${PWD}:/project" voxel-engine bash -c "cmake -DCMAKE_BUILD_TYPE=Release -Bbuild && cmake --build build" +``` + +### Step 5. Run project using the docker container + +```powershell +docker run --rm -it -v "${PWD}:/project" -e DISPLAY=host.docker.internal:0.0 --network host voxel-engine ./build/VoxelEngine +``` \ No newline at end of file