Skip to content

Commit

Permalink
Added SDL2 and glad to create window.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte committed May 1, 2021
1 parent 854cc85 commit 626de24
Show file tree
Hide file tree
Showing 17 changed files with 3,429 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.o
*.exe

.idea

20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
CC := gcc # C Compiler
CXX := g++ # C++ compiler
I_FLAGS := -I"./include"
L_FLAGS := -lmingw32 -static-libgcc
I_FLAGS := -I"./include" -I"${SDL2_HOME}/include"
L_FLAGS := -lmingw32 -lSDL2main -lSDL2_mixer -lSDL2 -static-libgcc
C_FLAGS := -w -std=c++14 -Wfatal-errors
LIBRARIES := -L"${SDL2_HOME}/lib"
BUILD_OBJECT := roll_back_engine.exe
TEST_BUILD_OBJECT := test_roll_back_engine.exe

SRC = $(wildcard src/main.cpp src/core/*.cpp src/core/utils/*.cpp)
SRC_C = $(wildcard lib/glad.c)

OBJ = $(SRC:.cpp=.o)
OBJ_C = $(SRC_C:.c=.o)

TEST_SRC = $(wildcard src/test/*.cpp src/test/unit/*.cpp src/core/*.cpp src/core/utils/*.cpp)
TEST_OBJ = $(TEST_SRC:.cpp=.o)
Expand All @@ -22,9 +26,13 @@ all: clean format build
@echo "Compiling " $< " into " $@
@$(CXX) -c $(C_FLAGS) $< -o $@ $(I_FLAGS)

build: $(OBJ)
%.o: %.c
@echo "Compiling " $< " into " $@
@$(CC) -c $(C_FLAGS) $< -o $@ $(I_FLAGS)

build: $(OBJ) $(OBJ_C)
@echo "Linking " $@
@$(CXX) -o $(BUILD_OBJECT) $^ $(I_FLAGS) $(L_FLAGS)
@$(CXX) -o $(BUILD_OBJECT) $^ $(I_FLAGS) $(L_FLAGS) $(LIBRARIES)

format:
astyle -n --style=google --recursive src/*.cpp src/*.h
Expand All @@ -41,9 +49,9 @@ run:
# Tests
test: build-test run-test

build-test: $(TEST_OBJ)
build-test: $(TEST_OBJ) $(OBJ_C)
@echo "Linking " $@
@$(CXX) -o $(TEST_BUILD_OBJECT) $^ $(I_FLAGS) $(L_FLAGS)
@$(CXX) -o $(TEST_BUILD_OBJECT) $^ $(I_FLAGS) $(L_FLAGS) $(LIBRARIES)

clean-test:
ifneq ("$(wildcard $(TEST_BUILD_OBJECT))","")
Expand Down
Binary file added SDL2.dll
Binary file not shown.
Binary file added SDL2_mixer.dll
Binary file not shown.
Loading

0 comments on commit 626de24

Please sign in to comment.