default compiler environment vars in Makefile
This commit is contained in:
parent
d8c5bdd56d
commit
d47289007c
|
@ -2,4 +2,4 @@ local/
|
|||
*.o
|
||||
BPmono.ttf
|
||||
compile_commands.json
|
||||
pudding
|
||||
gunkiss
|
||||
|
|
40
Makefile
40
Makefile
|
@ -1,15 +1,19 @@
|
|||
# _______________ ,-------------------------------------------------------------------.
|
||||
# //`````````````\\ \ \
|
||||
# //~~~~~~~~~~~~~~~\\ \ by @ohsqueezy & @sleepin \
|
||||
# //=================\\ \ [ohsqueezy.itch.io] [sleepin.itch.io] \
|
||||
# // \\ \ \
|
||||
# // \\ \ code released under zlib license [git.nugget.fun/nugget/gunkiss] \
|
||||
# // ☆ GUNKISS ☆ \\ \ \
|
||||
# //_________________________\\ `-------------------------------------------------------------------'
|
||||
# _______________ ,--------------------------------------------------------.
|
||||
# //`````````````\\ \ \
|
||||
# //~~~~~~~~~~~~~~~\\ \ by @ohsqueezy & @sleepin \
|
||||
# //=================\\ \ [ohsqueezy.itch.io] [sleepin.itch.io] \
|
||||
# // \\ \ \
|
||||
# // \\ \ zlib licensed code at [git.nugget.fun/nugget/gunkiss] \
|
||||
# // ☆ GUNKISS ☆ \\ \ \
|
||||
# //_________________________\\ `--------------------------------------------------------'
|
||||
#
|
||||
# This Makefile should build a Linux binary from `make linux`. Other platform targets have not been tested yet.
|
||||
# It requires the [SPACEBOX] framework to be located in the paths that can be configured in the code block
|
||||
# below.
|
||||
# This Makefile is used to build a Linux executable with `make linux`. Other platform targets have not been
|
||||
# tested and were copied over from a previous project.
|
||||
#
|
||||
# The [SPACEBOX] game framework source code from [git.nugget.fun/nugget/spacebox] is required. If this is the
|
||||
# Git repository for Gunkiss, the source code should already have been cloned into `lib/sb` as a submodule using
|
||||
# `git clone --recursive git.nugget.fun/nugget/gunkiss`. The paths below are the default for the repository, but
|
||||
# they can be edited as necessary.
|
||||
|
||||
#######################
|
||||
# Location parameters #
|
||||
|
@ -29,7 +33,7 @@ GLEW_DIR := $(SB_LIB_DIR)glew/
|
|||
|
||||
# C and C++ compiler commands
|
||||
CC := clang
|
||||
CPPC := clang++
|
||||
CXX := clang++
|
||||
|
||||
# Location of SDL config program
|
||||
SDLCONFIG := $(HOME)/local/sdl/bin/sdl2-config
|
||||
|
@ -54,7 +58,7 @@ SRC_O_FILES := $(filter-out $(addprefix $(SRC_DIR),Carousel.o),$(SRC_H_FILES:.hp
|
|||
|
||||
$(SDLGFX2_DIR)%.o: $(SDLGFX2_DIR)%.c $(SDLGFX2_DIR)%.h
|
||||
$(GLEW_DIR)%.o: $(GLEW_DIR)%.c $(GLEW_DIR)%.h
|
||||
$(CC) $(CFLAGS) $< -c -o $@
|
||||
$(CC) $< $(CFLAGS) -c -o $@
|
||||
|
||||
$(SB_SRC_DIR)extension.o : $(addprefix $(SB_SRC_DIR),Box.hpp Segment.hpp Color.hpp filesystem.hpp Pixels.hpp Log.hpp)
|
||||
$(SB_SRC_DIR)Node.o : $(addprefix $(SB_SRC_DIR),Game.hpp Configuration.hpp Delegate.hpp Display.hpp Input.hpp Box.hpp Audio.hpp Log.hpp)
|
||||
|
@ -79,14 +83,12 @@ $(SRC_DIR)Model.o : $(addprefix $(SB_SRC_DIR),extension.hpp Attributes.hpp Textu
|
|||
$(SRC_DIR)Item.o : $(addprefix $(SB_SRC_DIR),Texture.hpp Log.hpp utility.hpp) $(addprefix $(SRC_DIR),Model.hpp Carousel.hpp)
|
||||
$(SRC_DIR)Pudding.o : $(SRC_H_FILES) $(SB_H_FILES)
|
||||
%.o : %.cpp %.hpp
|
||||
$(CPPC) $(CPP_FLAGS) $< -c -o $@
|
||||
$(CXX) $(CPP_FLAGS) $< -c -o $@
|
||||
|
||||
###############
|
||||
# Linux build #
|
||||
###############
|
||||
|
||||
linux : CC = clang
|
||||
linux : CPPC = clang++
|
||||
linux : CFLAGS = -g -Wall -Wextra -O0 -c -I$(SB_LIB_DIR) -I$(SB_SRC_DIR) $(SDL_CFLAGS) -I$(HOME)/local/zbar/include \
|
||||
-I$(HOME)/local/opencv/include/opencv4
|
||||
linux : CPP_FLAGS = $(CFLAGS) --std=c++17
|
||||
|
@ -96,7 +98,7 @@ linux : LFLAGS = $(SDL_LFLAGS) -Wl,--enable-new-dtags -lpthread -lGL -lGLESv2 -l
|
|||
linux : $(GLEW_DIR)glew.o $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) \
|
||||
$(SB_O_FILES) $(SRC_O_FILES)
|
||||
$(CREATE_FONT_SYMLINK)
|
||||
$(CPPC) $^ $(LFLAGS) -D__LINUX__ -o pudding
|
||||
$(CXX) $^ $(LFLAGS) -D__LINUX__ -o gunkiss
|
||||
|
||||
#############
|
||||
# Web build #
|
||||
|
@ -112,12 +114,12 @@ EMSCRIPTEN_CFLAGS = -O3 -Wall -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORM
|
|||
EMSCRIPTEN_PRELOADS = --preload-file "BPmono.ttf"@/ --preload-file "config.json" --preload-file "resource"
|
||||
|
||||
emscripten : CC = $(EMSCRIPTENHOME)/emcc
|
||||
emscripten : CPPC = $(EMSCRIPTENHOME)/em++
|
||||
emscripten : CXX = $(EMSCRIPTENHOME)/em++
|
||||
emscripten : CFLAGS = $(EMSCRIPTEN_CFLAGS)
|
||||
emscripten : CPP_FLAGS = $(CFLAGS) --std=c++17
|
||||
emscripten : $(addprefix $(SDLGFX2_DIR),SDL2_rotozoom.o SDL2_gfxPrimitives.o) $(SB_O_FILES) $(SRC_O_FILES)
|
||||
$(CREATE_FONT_SYMLINK)
|
||||
$(CPPC) $(CPP_FLAGS) $(EMSCRIPTEN_PRELOADS) $^ -o "index.html"
|
||||
$(CXX) $(CPP_FLAGS) $(EMSCRIPTEN_PRELOADS) $^ -o "index.html"
|
||||
|
||||
#########################
|
||||
# Clean up object files #
|
||||
|
|
35
README.md
35
README.md
|
@ -19,35 +19,54 @@ Where to play
|
|||
|
||||
Gunkiss is in-development. Public builds for the web and Android are expected to be released soon.
|
||||
|
||||
Libraries
|
||||
---------
|
||||
Building from source
|
||||
--------------------
|
||||
|
||||
The following external libraries are required to compile the game.
|
||||
First, checkout the full repository.
|
||||
|
||||
### cURL
|
||||
git clone --recursive https://git.nugget.fun/nugget/gunkiss
|
||||
|
||||
### Required Libraries
|
||||
|
||||
The following external programs and libraries are required to compile the game.
|
||||
|
||||
#### SPACEBOX
|
||||
|
||||
The [SPACEBOX game framework][] is being developed simultaneously and should be checked out into `lib/sb` as a submodule of the project using the `--recursive` flag as shown above.
|
||||
|
||||
#### cURL
|
||||
|
||||
The game uses [cURL][] to communicate with the [Open Food Facts][] API. The cURL library and development headers must be installed to the system paths in order to compile the program.
|
||||
|
||||
#### Linux
|
||||
##### Linux
|
||||
|
||||
On Linux, you can install libcurl and development headers through the package manager. For example, on Debian:
|
||||
|
||||
sudo apt install libcurl4 libcurl4-openssl-dev
|
||||
|
||||
#### Other systems
|
||||
##### Other systems
|
||||
|
||||
See [the downloads page][] for ways to get the library and headers. It must be installed in such a way that linking can be done with `-lcurl` and headers are in the default search path.
|
||||
|
||||
### OpenCV
|
||||
#### OpenCV
|
||||
|
||||
The game uses [OpenCV][] to enable barcode reading through the camera. The library and headers by default are expected to be installed to `[HOME]/local/opencv/lib` and `[HOME]/local/opencv/headers` respectively, but those locations can be edited in the [Makefile][]
|
||||
|
||||
### ZBar
|
||||
#### ZBar
|
||||
|
||||
The game uses [ZBar][] to scan images for barcodes and report what the barcode is. The library and headers by default are expected to be installed to `[HOME]/local/zbar/lib` and `[HOME]/local/zbar/headers` respectively, but those locations can be edited in the [Makefile][].
|
||||
|
||||
### Compiling
|
||||
|
||||
Once the requirements are satisfied, run `make linux` to compile. The executable will be saved to the root folder as `gunkiss`.
|
||||
|
||||
#### Compiler
|
||||
|
||||
The project is developed using `clang`, but `gcc` can be substituted. Environment variables for `CC` and `CXX` can be used to change the default compiler.
|
||||
|
||||
[cURL]: https://curl.se/
|
||||
[Open Food Facts]: https://world.openfoodfacts.org/
|
||||
[OpenCV]: https://opencv.org/
|
||||
[ZBar]: http://zbar.sourceforge.net/
|
||||
[Makefile]: Makefile
|
||||
[SPACEBOX game framework]: https://git.nugget.fun/nugget/spacebox
|
||||
|
|
Loading…
Reference in New Issue