Merge pull request #352 from V10lator/docker
Add Docker support for Linux
This commit is contained in:
commit
1effdc5b85
|
|
@ -300,6 +300,28 @@ jobs:
|
|||
yamls
|
||||
gamecontrollerdb.txt
|
||||
|
||||
build-linux-docker:
|
||||
needs: generate-port-o2r
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
- name: Docker caching
|
||||
uses: ScribeMD/docker-cache@0.5.0
|
||||
id: cache
|
||||
continue-on-error: true
|
||||
with:
|
||||
key: sk-docker-cache-${{ hashFiles('Dockerfile') }}
|
||||
- name: Build docker image
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: docker build . -t spaghetti
|
||||
- name: Confiure
|
||||
run: docker run --rm -v ${PWD}:/project spaghetti cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
|
||||
- name: Build spaghetti
|
||||
run: docker run --rm -v ${PWD}:/project spaghetti cmake --build build-cmake --config Release -j$(nproc)
|
||||
|
||||
build-switch:
|
||||
needs: generate-port-o2r
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ mingw64/
|
|||
|
||||
# torch
|
||||
torch.hash.yml
|
||||
build*
|
||||
.idea
|
||||
|
||||
# the game
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
FROM ubuntu:22.04
|
||||
|
||||
ENV DOCKER_CMAKE_VERSION="4.0.3"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update -y && apt-get -y upgrade && apt-get -y install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libsdl2-net-dev libpng-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev wget file
|
||||
|
||||
# Install libultraship compatible cmake
|
||||
# This is based on https://askubuntu.com/questions/829310/how-to-upgrade-cmake-in-ubuntu
|
||||
RUN apt-get remove -y cmake && \
|
||||
wget https://github.com/Kitware/CMake/releases/download/v4.0.3/cmake-${DOCKER_CMAKE_VERSION}-linux-x86_64.sh && \
|
||||
chmod +x cmake-${DOCKER_CMAKE_VERSION}-linux-x86_64.sh && \
|
||||
./cmake-${DOCKER_CMAKE_VERSION}-linux-x86_64.sh --prefix=/opt/ --include-subdir --skip-license && \
|
||||
ln -s /opt/cmake-${DOCKER_CMAKE_VERSION}-linux-x86_64/bin/* /usr/bin && \
|
||||
rm cmake-${DOCKER_CMAKE_VERSION}-linux-x86_64.sh
|
||||
|
||||
# Install latest SDL
|
||||
RUN wget https://www.libsdl.org/release/SDL2-2.30.3.tar.gz && \
|
||||
tar -xzf SDL2-2.30.3.tar.gz && \
|
||||
cd SDL2-2.30.3 && \
|
||||
./configure --enable-hidapi-libusb && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ && \
|
||||
cd .. && \
|
||||
rm -rf SDL2-2.30.3.tar.gz SDL2-2.30.3
|
||||
|
||||
# Install latest SDL_net
|
||||
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 -j$(nproc) && \
|
||||
make install && \
|
||||
cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ && \
|
||||
cd .. && \
|
||||
rm -rf SDL2_net-2.2.0.tar.gz SDL2_net-2.2.0
|
||||
|
||||
# Install latest tinyxml2
|
||||
RUN wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz && \
|
||||
tar -xzf 10.0.0.tar.gz && \
|
||||
cd tinyxml2-10.0.0 && \
|
||||
mkdir -p build && \
|
||||
cd build && \
|
||||
cmake .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd ../.. && \
|
||||
rm -rf 10.0.0.tar.gz tinyxml2-10.0.0
|
||||
|
||||
# Install libzip without crypto
|
||||
RUN wget https://github.com/nih-at/libzip/releases/download/v1.10.1/libzip-1.10.1.tar.gz && \
|
||||
tar -xzf libzip-1.10.1.tar.gz && \
|
||||
cd libzip-1.10.1 && \
|
||||
mkdir -p build && \
|
||||
cd build && \
|
||||
cmake .. -DENABLE_COMMONCRYPTO=OFF -DENABLE_GNUTLS=OFF -DENABLE_MBEDTLS=OFF -DENABLE_OPENSSL=OFF && \
|
||||
make -j$(nproc) && \
|
||||
make install & \
|
||||
# cp -av /usr/local/lib/libzip* /lib/x86_64-linux-gnu/ && \
|
||||
cd ../.. && \
|
||||
rm -rf libzip-1.10.1.tar.gz libzip-1.10.1
|
||||
|
||||
WORKDIR /project
|
||||
|
|
@ -79,8 +79,15 @@ C:\Program Files\CMake\bin\cmake.exe --build build-cmake --target clean
|
|||
```
|
||||
|
||||
## Linux
|
||||
### Install dependencies
|
||||
#### Debian/Ubuntu
|
||||
### Clone the repo and enter the directory
|
||||
```sh
|
||||
git clone https://github.com/HarbourMasters/SpaghettiKart.git
|
||||
cd SpaghettiKart
|
||||
```
|
||||
|
||||
### Manual
|
||||
#### Install dependencies
|
||||
##### Debian/Ubuntu
|
||||
```sh
|
||||
# using gcc
|
||||
apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
|
||||
|
|
@ -88,7 +95,7 @@ apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev
|
|||
# or using clang
|
||||
apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
|
||||
```
|
||||
#### Arch
|
||||
##### Arch
|
||||
```sh
|
||||
# using gcc
|
||||
pacman -S gcc git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost libogg libvorbis
|
||||
|
|
@ -96,7 +103,7 @@ pacman -S gcc git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyx
|
|||
# or using clang
|
||||
pacman -S clang git cmake ninja lsb-release sdl2 libpng libzip nlohmann-json tinyxml2 spdlog sdl2_net boost libogg libvorbis
|
||||
```
|
||||
#### Fedora
|
||||
##### Fedora
|
||||
```sh
|
||||
# using gcc
|
||||
dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel SDL2_net-devel libpng-devel libzip-devel libzip-tools nlohmann-json-devel tinyxml2-devel spdlog-devel boost-devel libogg-devel libvorbis-devel
|
||||
|
|
@ -104,7 +111,7 @@ dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel SDL2_net-de
|
|||
# or using clang
|
||||
dnf install clang git cmake ninja-build lsb_release SDL2-devel SDL2_net-devel libpng-devel libzip-devel libzip-tools nlohmann-json-devel tinyxml2-devel spdlog-devel boost-devel libogg-devel libvorbis-devel
|
||||
```
|
||||
#### openSUSE
|
||||
##### openSUSE
|
||||
```sh
|
||||
# using gcc
|
||||
zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel libogg-devel libvorbis-devel
|
||||
|
|
@ -113,15 +120,11 @@ zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel libzip-devel lib
|
|||
zypper in clang libstdc++-devel git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools nlohmann_json-devel tinyxml2-devel spdlog-devel libogg-devel libvorbis-devel
|
||||
```
|
||||
|
||||
### Build
|
||||
#### Build
|
||||
|
||||
_Note: If you're using Visual Studio Code, the [CMake Tools plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._
|
||||
|
||||
```bash
|
||||
# Clone the repo and enter the directory
|
||||
git clone https://github.com/HarbourMasters/SpaghettiKart.git
|
||||
cd SpaghettiKart
|
||||
|
||||
```sh
|
||||
# Clone the submodules
|
||||
git submodule update --init
|
||||
|
||||
|
|
@ -143,9 +146,25 @@ cmake --build build-cmake
|
|||
# System wide freezes may be due to low memory, add "-j4" to the end of the build command to use four cores.
|
||||
```
|
||||
|
||||
### Docker
|
||||
#### Create the docker container
|
||||
```sh
|
||||
docker build . -t spaghetti
|
||||
```
|
||||
|
||||
#### Configure the project
|
||||
```sh
|
||||
docker run --rm -v ${PWD}:/project spaghetti cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Release
|
||||
```
|
||||
|
||||
#### Compile the project
|
||||
```sh
|
||||
docker run --rm -v ${PWD}:/project spaghetti cmake --build build-cmake --config Release -j$(nproc)
|
||||
```
|
||||
|
||||
### Generate a distributable
|
||||
After compiling the project you can generate a distributable by running of the following:
|
||||
```bash
|
||||
```sh
|
||||
# Go to build folder
|
||||
cd build-cmake
|
||||
# Generate
|
||||
|
|
|
|||
Loading…
Reference in New Issue