From 7647633ac14aa28739458b4ba6065c099a5f55bc Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:12:02 +0100 Subject: [PATCH 1/7] Makefile for Linux --- Makefile | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..79b6870 --- /dev/null +++ b/Makefile @@ -0,0 +1,60 @@ +# Makefile to compile the examples on linux +# make will generate temporary linux compatible cpp files and build them into executables +# +# Tested on Ubuntu 18.04 with: +# sudo apt install libsdl2-dev +# make +# +# (C) 2018 Giampiero Salvi +# LICENSE: GPL 3 + +MAKEFLAGS += --no-builtin-rules +# most programs work with c++11, but OneLoneCoder_Mazes requires 14 for the period definition +CPPFLAGS=-DUNICODE -I/usr/include/SDL2 -std=c++14 +LDFLAGS= +LDLIBS=-lSDL2 -lpthread + +# Not working yet: +# OneLoneCoder_AR_OpticFlow (missing escapi.h) +# OneLoneCoder_Balls2 (missing function max) +# OneLoneCoder_CaveDiver (imports Windows.h) +# OneLoneCoder_CommandLineFPS (imports Windows.h) +# OneLoneCoder_FlappyBird (imports Windows.h) +# OneLoneCoder_LogitechG13Twitch (winsock2.h) +# OneLoneCoder_LudumDare42 (missing function max) +# OneLoneCoder_olcEngine3D_Part1-4 strange errors, haven't checked +# OneLoneCoder_PanAndZoom (missing to_wstring) +# OneLoneCoder_RacingLines (missing FillTriangle) +# OneLoneCoder_Snake (imports Windows.h) +# OneLoneCoder_Tetris (imports Windows.h) +# OneLoneCoder_Webcam (missing escapi.h) +# worms/OneLoneCoder_Worms1-3 (missing escapi.h) + +# these are working +EXAMPLES= \ + OneLoneCoder_Asteroids \ + OneLoneCoder_Balls1 \ + OneLoneCoder_ComandLineFPS_2 \ + OneLoneCoder_Frogger \ + OneLoneCoder_GameOfLife \ + OneLoneCoder_Matrix \ + OneLoneCoder_Mazes \ + OneLoneCoder_OverEngineered \ + OneLoneCoder_PathFinding_AStar \ + OneLoneCoder_PerlinNoise \ + OneLoneCoder_PlatformGame1 \ + OneLoneCoder_Pseudo3DPlanesMode7 \ + OneLoneCoder_RetroArcadeRacer \ + OneLoneCoder_Splines1 \ + OneLoneCoder_Splines2 \ + OneLoneCoder_SpriteEditor \ + OneLoneCoder_Webcam + +all: $(EXAMPLES) + +%_linux.cpp: %.cpp + cat $< | sed 's/olcConsoleGameEngine.h/olcConsoleGameEngineSDL.h/g' | sed 's/VK_SHIFT/VK_LSHIFT/g' | sed 's/VK_CONTROL/VK_LCONTROL/g' > $@ + +%: %_linux.cpp + g++ $< $(CPPFLAGS) -o $@ $(LDLIBS) + From 4c7a4b7e1c2a04996227e4e50b0166d191c26a5f Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:23:40 +0100 Subject: [PATCH 2/7] added instructions --- Makefile => linux/Makefile | 0 linux/README.md | 13 +++++++++++++ 2 files changed, 13 insertions(+) rename Makefile => linux/Makefile (100%) create mode 100644 linux/README.md diff --git a/Makefile b/linux/Makefile similarity index 100% rename from Makefile rename to linux/Makefile diff --git a/linux/README.md b/linux/README.md new file mode 100644 index 0000000..5a7c756 --- /dev/null +++ b/linux/README.md @@ -0,0 +1,13 @@ +# Linux Makefile +The is a Makefile for GNU Linux to build the examples in this repository. It has been tested on Ubuntu 18.04. Running make will create temporary cpp files from the original, that have been modified to work with Linux. Main differences are using `olcConsoleGameEngineSDL.h` instead of `olcConsoleGameEngine.h` and substituting the `VK_SHIFT` and `VK_CONTROL` flags. Look at the Makefile to know which programs will not build, yet, and why. + +## Dependencies +Install the development files for the SDL library: +``` +sudo apt install libsdl2-dev +``` + +## Build +``` +make +``` From 7c2efc3735818cedf9989a532d7bacab090fa435 Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:23:59 +0100 Subject: [PATCH 3/7] removed target that does not build --- linux/Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linux/Makefile b/linux/Makefile index 79b6870..dda3beb 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -10,7 +10,7 @@ MAKEFLAGS += --no-builtin-rules # most programs work with c++11, but OneLoneCoder_Mazes requires 14 for the period definition -CPPFLAGS=-DUNICODE -I/usr/include/SDL2 -std=c++14 +CPPFLAGS=-DUNICODE -I/usr/include/SDL2 -I.. -std=c++14 LDFLAGS= LDLIBS=-lSDL2 -lpthread @@ -47,12 +47,11 @@ EXAMPLES= \ OneLoneCoder_RetroArcadeRacer \ OneLoneCoder_Splines1 \ OneLoneCoder_Splines2 \ - OneLoneCoder_SpriteEditor \ - OneLoneCoder_Webcam + OneLoneCoder_SpriteEditor all: $(EXAMPLES) -%_linux.cpp: %.cpp +%_linux.cpp: ../%.cpp cat $< | sed 's/olcConsoleGameEngine.h/olcConsoleGameEngineSDL.h/g' | sed 's/VK_SHIFT/VK_LSHIFT/g' | sed 's/VK_CONTROL/VK_LCONTROL/g' > $@ %: %_linux.cpp From 9daf985e9c983ea2805464bd8b1526c3bc860bfc Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:24:56 +0100 Subject: [PATCH 4/7] small correction --- linux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/README.md b/linux/README.md index 5a7c756..06f4724 100644 --- a/linux/README.md +++ b/linux/README.md @@ -1,5 +1,5 @@ # Linux Makefile -The is a Makefile for GNU Linux to build the examples in this repository. It has been tested on Ubuntu 18.04. Running make will create temporary cpp files from the original, that have been modified to work with Linux. Main differences are using `olcConsoleGameEngineSDL.h` instead of `olcConsoleGameEngine.h` and substituting the `VK_SHIFT` and `VK_CONTROL` flags. Look at the Makefile to know which programs will not build, yet, and why. +The is a Makefile for GNU Linux to build the examples in this repository. It has been tested on Ubuntu 18.04. Running make will create temporary cpp files from the original files, that have been modified to work with Linux. Main differences are using `olcConsoleGameEngineSDL.h` instead of `olcConsoleGameEngine.h` and substituting the `VK_SHIFT` and `VK_CONTROL` flags. Look at the Makefile to know which programs will not build, yet, and why. ## Dependencies Install the development files for the SDL library: From 18a8d1d0a929074f33bdae4eed4ac686dd0af2bf Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:26:37 +0100 Subject: [PATCH 5/7] fixed copyright --- linux/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/Makefile b/linux/Makefile index dda3beb..7acaa98 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -5,7 +5,7 @@ # sudo apt install libsdl2-dev # make # -# (C) 2018 Giampiero Salvi +# (C) 2019 Giampiero Salvi # LICENSE: GPL 3 MAKEFLAGS += --no-builtin-rules From 8088e3970c34b9e67def8c79b2187954d3007930 Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:30:19 +0100 Subject: [PATCH 6/7] small fix --- linux/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/README.md b/linux/README.md index 06f4724..706e120 100644 --- a/linux/README.md +++ b/linux/README.md @@ -1,5 +1,5 @@ # Linux Makefile -The is a Makefile for GNU Linux to build the examples in this repository. It has been tested on Ubuntu 18.04. Running make will create temporary cpp files from the original files, that have been modified to work with Linux. Main differences are using `olcConsoleGameEngineSDL.h` instead of `olcConsoleGameEngine.h` and substituting the `VK_SHIFT` and `VK_CONTROL` flags. Look at the Makefile to know which programs will not build, yet, and why. +This is a Makefile to build the examples in this repository on GNU Linux. It has been tested on Ubuntu 18.04. Running make will create temporary cpp files from the original files, that have been modified to work with Linux. Main differences are using `olcConsoleGameEngineSDL.h` instead of `olcConsoleGameEngine.h` and substituting the `VK_SHIFT` and `VK_CONTROL` flags. Look at the Makefile to know which programs will not build, yet, and why. ## Dependencies Install the development files for the SDL library: From 6a543076912ffb91a1a8018ed2219c4fef797d00 Mon Sep 17 00:00:00 2001 From: Giampiero Salvi Date: Wed, 6 Feb 2019 18:57:02 +0100 Subject: [PATCH 7/7] added instructions to run --- linux/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux/README.md b/linux/README.md index 706e120..e9f7f19 100644 --- a/linux/README.md +++ b/linux/README.md @@ -11,3 +11,9 @@ sudo apt install libsdl2-dev ``` make ``` +## Run +You need to run the programs from the top directory of the repository in order to find the additional files, such as sprites, for example: +``` +cd .. +linux/OneLoneCoder_Asteroids +```