diff --git a/.gitignore b/.gitignore index e257658..c718b09 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,8 @@ *.out *.app +# Build directories +build/ + +# Vscode +.vscode/ \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5d94ea8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "lib/imgui"] + path = lib/imgui + url = https://github.com/ocornut/imgui.git + branch = docking diff --git a/lib/imgui b/lib/imgui new file mode 160000 index 0000000..3912b3d --- /dev/null +++ b/lib/imgui @@ -0,0 +1 @@ +Subproject commit 3912b3d9a9c1b3f17431aebafd86d2f40ee6e59c diff --git a/makefile b/makefile new file mode 100644 index 0000000..77e418a --- /dev/null +++ b/makefile @@ -0,0 +1,64 @@ +# Directories +INCLUDE_DIR = inc +SRC_DIR = src +BUILD_DIR = build + +# imgui bs +IMGUI_DIR = lib/imgui +INCLUDE_DIR += $(IMGUI_DIR) $(IMGUI_DIR)/backends + +# Compiler, flags and libraries +CXX = g++ +CXXFLAGS = -std=c++17 +LIBS = -lGL -lglm `pkg-config --libs sdl3 sdl3-image` + +# =============================== Don't touch below pwease :3 =============================== + +# Compiler and linker settings +CXXFLAGS += $(addprefix -I, $(INCLUDE_DIR)) + +# Source files +SRC = $(wildcard $(SRC_DIR)/*.cpp) + +# Imgui specific stuff +SRC += $(IMGUI_DIR)/imgui.cpp $(IMGUI_DIR)/imgui_demo.cpp $(IMGUI_DIR)/imgui_draw.cpp $(IMGUI_DIR)/imgui_tables.cpp $(IMGUI_DIR)/imgui_widgets.cpp +SRC += $(IMGUI_DIR)/backends/imgui_impl_sdl3.cpp $(IMGUI_DIR)/backends/imgui_impl_opengl3.cpp + +# Target executable +UNAME := $(shell uname -s) +BUILD_DIR := $(BUILD_DIR)/$(UNAME) +OBJ_DIR := $(BUILD_DIR)/objs +BIN = $(BUILD_DIR)/main + +# Object files corresponding to the source files +OBJS = $(addprefix $(OBJ_DIR)/, $(addsuffix .o, $(basename $(notdir $(SRC))))) + +# black magic wizardry below this line (pwease don't touch i beg you) +dev: CXXFLAGS += -g -Wall -Wformat +dev: all + +release: CXXFLAGS += -O3 +release: all + +dirs: + @mkdir -p $(BUILD_DIR) + @mkdir -p $(OBJ_DIR) + +# Even more imgui specific stuff >:( +$(OBJ_DIR)/%.o: $(IMGUI_DIR)/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +$(OBJ_DIR)/%.o: $(IMGUI_DIR)/backends/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp + $(CXX) $(CXXFLAGS) -c -o $@ $< + +all: dirs $(BIN) + @echo Build complete + +$(BIN): $(OBJS) + $(CXX) -o $@ $^ $(CXXFLAGS) $(LIBS) + +clean: + rm -rf $(BUILD_DIR) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..e69de29