From 38f90e3ba9b998ff20260e181b647b66bdc5d0ab Mon Sep 17 00:00:00 2001 From: Alexandre Lavoie <36684879+alexandre-lavoie@users.noreply.github.com> Date: Wed, 2 Jun 2021 17:01:27 -0400 Subject: [PATCH] Nixpkgs Implementation (and Docker Improvement) (#1881) * Fix Dockerfile would not complete due to interactivity being enabled. * Added docker-compose.yml to build with `docker-compose up`. * Removed Lua 5.2 from Dockerfile. * Add BUILD_CORSIXTH cmake flag for disabling building the main program, e.g. if you only want AnimView --- .gitignore | 4 ++++ CMakeLists.txt | 9 ++++++--- Dockerfile.build | 21 +++++++++++++++++++-- docker-compose.yml | 10 ++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore index 5ae5076e..a851ff49 100644 --- a/.gitignore +++ b/.gitignore @@ -101,3 +101,7 @@ CorsixTH/CorsixTH.sln # Default build path CorsixTH/CorsixTH CorsixTH/corsix-th + +# Nix +*.so +/result* diff --git a/CMakeLists.txt b/CMakeLists.txt index 41bb0936..ea8c32ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ include(CheckIncludeFiles) set(CORSIX_TH_DONE_TOP_LEVEL_CMAKE ON) # Define our options +option(BUILD_CORSIXTH "Builds the main game" ON) option(WITH_AUDIO "Activate sound" ON) option(WITH_FREETYPE2 "Enhanced font support" ON) option(WITH_MOVIES "Activate in game movies" ON) @@ -125,9 +126,11 @@ message("") message("Building common libraries") add_subdirectory("libs") -# We always build CorsixTH otherwise we would miss the generated header -message("Building CorsixTH") -add_subdirectory(CorsixTH) +# We build CorsixTH if BUILD_CORSIXTH is set. This is set by default and should generally be set. +if(BUILD_CORSIXTH) + message("Building CorsixTH") + add_subdirectory(CorsixTH) +endif() if(BUILD_ANIMVIEW) message("Building AnimView") diff --git a/Dockerfile.build b/Dockerfile.build index 44caee38..2b92f301 100644 --- a/Dockerfile.build +++ b/Dockerfile.build @@ -3,6 +3,23 @@ FROM ubuntu:latest WORKDIR /sourcecode -RUN apt-get update && apt-get install -y build-essential cmake git liblua5.2-0 liblua5.2-dev libsdl2-dev libsdl2-mixer-dev timidity libfreetype6-dev lua-filesystem lua-lpeg doxygen liblua5.3-0 liblua5.3-0-dbg liblua5.3-dev ffmpeg libavcodec-dev libavformat-dev libavresample-dev libavdevice-dev libavutil-dev libavfilter-dev libswscale-dev libpostproc-dev libswresample-dev +ENV DEBIAN_FRONTEND=noninteractive -CMD mkdir build && cd build && cmake -DUSE_SOURCE_DATADIRS=ON .. && make +RUN apt-get -y update + +RUN apt-get install -y \ + # Base Tools + build-essential cmake git doxygen \ + # LUA + liblua5.3-0 liblua5.3-0-dbg liblua5.3-dev \ + lua-filesystem lua-lpeg \ + # SDL2 + libsdl2-dev libsdl2-mixer-dev \ + # AV + ffmpeg timidity \ + libavformat-dev libavresample-dev libavdevice-dev libavutil-dev libavfilter-dev libavcodec-dev \ + libpostproc-dev libswscale-dev libswresample-dev \ + # Font + libfreetype6-dev + +CMD mkdir -p build && cd build && cmake -DUSE_SOURCE_DATADIRS=ON .. && make diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..e0bc8d8d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3' + +services: + corsix-th: + container_name: corsix-th + build: + context: . + dockerfile: Dockerfile.build + volumes: + - .:/sourcecode