Added release Build Options
This commit is contained in:
parent
dd17ed8df5
commit
a428ba3a0e
102
Makefile
102
Makefile
@ -1,31 +1,49 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Compiler and Base Flags
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
CXX := g++
|
||||
CXXFLAGS := -Wall -Wextra -std=c++17 -g -DDEBUG -DTIMERS
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Common flags (for both Debug and Release)
|
||||
CXXFLAGS_BASE := -Wall -Wextra -std=c++17
|
||||
|
||||
# Debug flags (includes TIMERS and DEBUG, plus -g)
|
||||
CXXFLAGS_DEBUG := $(CXXFLAGS_BASE) -g -DDEBUG -DTIMERS
|
||||
|
||||
# Release flags (optimized, no debug macros, no timers)
|
||||
CXXFLAGS_RELEASE := $(CXXFLAGS_BASE) -O2 -DNDEBUG
|
||||
|
||||
# By default, we build in Debug mode:
|
||||
BUILD_TYPE ?= debug
|
||||
|
||||
# We’ll dynamically set BUILD_DIR and CXXFLAGS based on BUILD_TYPE
|
||||
ifeq ($(BUILD_TYPE),debug)
|
||||
BUILD_DIR := build
|
||||
CXXFLAGS := $(CXXFLAGS_DEBUG)
|
||||
else ifeq ($(BUILD_TYPE),release)
|
||||
BUILD_DIR := release
|
||||
CXXFLAGS := $(CXXFLAGS_RELEASE)
|
||||
else
|
||||
$(error Unknown BUILD_TYPE '$(BUILD_TYPE)'. Valid options: debug or release)
|
||||
endif
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Detect Platform
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
ifeq ($(OS),Windows_NT)
|
||||
# -------------------- Windows --------------------
|
||||
EXE_EXT := .exe
|
||||
|
||||
# Example paths (adjust if you have your libs somewhere else):
|
||||
# Include directories for GLFW, GLEW, etc.
|
||||
GLFW_INCLUDE := C:/libs/glfw/include
|
||||
GLEW_INCLUDE := C:/libs/glew/include
|
||||
|
||||
# Library search paths
|
||||
LIB_PATHS := -LC:/libs/glfw/lib \
|
||||
-LC:/libs/glew/lib \
|
||||
-Llib
|
||||
|
||||
# Libraries to link against (adjust if needed)
|
||||
LIBS := -lglfw3 -lopengl32 -lgdi32 -limm32 -lole32 -loleaut32 -luuid \
|
||||
-lwinmm -lglew32 -lglu32 -lyaml-cpp -llua54
|
||||
|
||||
# A Windows-compatible "mkdir" command:
|
||||
define MKDIR_P
|
||||
if not exist "$(1)" mkdir "$(1)" >nul 2>&1
|
||||
endef
|
||||
@ -34,34 +52,29 @@ else
|
||||
# -------------------- Linux (or other Unix-likes) --------------------
|
||||
EXE_EXT :=
|
||||
|
||||
# If libs are installed system-wide, you usually only need -lGL, -lGLEW, etc.
|
||||
# But you can still point to custom paths if needed:
|
||||
GLFW_INCLUDE := /usr/include
|
||||
GLEW_INCLUDE := /usr/include
|
||||
|
||||
# Library search paths (often not needed if system-wide)
|
||||
LIB_PATHS :=
|
||||
|
||||
# Libraries on Linux
|
||||
LIBS := -lglfw -lGL -lGLEW -lGLU -lyaml-cpp -llua
|
||||
|
||||
# A Linux-compatible "mkdir -p" command:
|
||||
define MKDIR_P
|
||||
mkdir -p "$(1)"
|
||||
endef
|
||||
|
||||
endif
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Directories
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
SRC_DIR := src
|
||||
VENDOR_DIRS := vendor/imgui-docking vendor/stb vendor/ImGuizmo
|
||||
BUILD_DIR := build
|
||||
# BUILD_DIR is determined by $(BUILD_TYPE) above: either `build` or `release`
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Include Directories
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
INCLUDE_DIRS := \
|
||||
$(SRC_DIR) \
|
||||
$(VENDOR_DIRS) \
|
||||
@ -72,12 +85,11 @@ INCLUDE_DIRS := \
|
||||
vendor/ImGuizmo \
|
||||
vendor/gcml
|
||||
|
||||
# Add them to compiler flags:
|
||||
CXXFLAGS += $(foreach inc,$(INCLUDE_DIRS),-I$(inc))
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Source Files
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
SRC_FILES := $(wildcard $(SRC_DIR)/*.cpp) \
|
||||
$(wildcard $(SRC_DIR)/**/*.cpp)
|
||||
|
||||
@ -85,43 +97,51 @@ VENDOR_SRC := $(foreach dir, $(VENDOR_DIRS), $(wildcard $(dir)/*.cpp))
|
||||
STB_SRC := $(wildcard vendor/stb/src/*.cpp) # If stb has .cpp files
|
||||
ALL_SRC := $(SRC_FILES) $(VENDOR_SRC) $(STB_SRC)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Object Files
|
||||
# ------------------------------------------------------------------------------
|
||||
OBJ_FILES := $(patsubst %.cpp, $(BUILD_DIR)/%.o, $(ALL_SRC))
|
||||
# ---------------------------------------------------------------------------
|
||||
OBJ_FILES := $(patsubst %.cpp,$(BUILD_DIR)/%.o,$(ALL_SRC))
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Target
|
||||
# ------------------------------------------------------------------------------
|
||||
TARGET := TesseractEngine$(EXE_EXT)
|
||||
# ---------------------------------------------------------------------------
|
||||
# Target (goes into the same directory as object files)
|
||||
# ---------------------------------------------------------------------------
|
||||
TARGET := $(BUILD_DIR)/TesseractEngine$(EXE_EXT)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Phony Targets
|
||||
# ------------------------------------------------------------------------------
|
||||
.PHONY: all clean
|
||||
# ---------------------------------------------------------------------------
|
||||
.PHONY: all clean debug release
|
||||
|
||||
# Default target
|
||||
# Default target uses whatever BUILD_TYPE is (default = debug)
|
||||
all: $(TARGET)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
## "debug" target => override BUILD_TYPE
|
||||
debug:
|
||||
@$(MAKE) BUILD_TYPE=debug all
|
||||
|
||||
## "release" target => override BUILD_TYPE
|
||||
release:
|
||||
@$(MAKE) BUILD_TYPE=release all
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Link all object files to create the executable
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
$(TARGET): $(OBJ_FILES)
|
||||
@echo Linking $@...
|
||||
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIB_PATHS) $(LIBS)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Pattern rule to compile .cpp files to .o files
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
$(BUILD_DIR)/%.o: %.cpp
|
||||
@$(call MKDIR_P,$(dir $@))
|
||||
@echo Compiling $<...
|
||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
# Clean build artifacts
|
||||
# ------------------------------------------------------------------------------
|
||||
# ---------------------------------------------------------------------------
|
||||
clean:
|
||||
@echo Cleaning up...
|
||||
rm -rf "$(BUILD_DIR)"
|
||||
rm -f "$(TARGET)"
|
||||
rm -rf build
|
||||
rm -rf release
|
||||
|
27
imgui.ini
27
imgui.ini
@ -1,11 +1,10 @@
|
||||
[Window][DockSpace]
|
||||
Pos=0,0
|
||||
Size=1280,720
|
||||
Size=1920,1177
|
||||
Collapsed=0
|
||||
|
||||
[Window][Debug##Default]
|
||||
ViewportPos=926,1030
|
||||
ViewportId=0x16723995
|
||||
Pos=926,701
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
@ -80,8 +79,8 @@ Collapsed=0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][Performance##performance]
|
||||
Pos=8,360
|
||||
Size=335,352
|
||||
Pos=8,581
|
||||
Size=335,588
|
||||
Collapsed=0
|
||||
DockId=0x0000001C,0
|
||||
|
||||
@ -105,7 +104,7 @@ DockId=0x0000000F,0
|
||||
|
||||
[Window][Scene Window##SceneWindow]
|
||||
Pos=8,28
|
||||
Size=335,330
|
||||
Size=335,551
|
||||
Collapsed=0
|
||||
DockId=0x0000001B,0
|
||||
|
||||
@ -134,26 +133,26 @@ Collapsed=0
|
||||
DockId=0x0000001E,0
|
||||
|
||||
[Window][ Logger##logger]
|
||||
Pos=345,282
|
||||
Size=265,430
|
||||
Pos=345,739
|
||||
Size=586,430
|
||||
Collapsed=0
|
||||
DockId=0x00000021,0
|
||||
|
||||
[Window][ Editor##EditorWindow]
|
||||
Pos=345,28
|
||||
Size=530,252
|
||||
Size=1170,709
|
||||
Collapsed=0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][ Inspector##InspectorWindow]
|
||||
Pos=877,28
|
||||
Size=395,684
|
||||
Pos=1517,28
|
||||
Size=395,1141
|
||||
Collapsed=0
|
||||
DockId=0x00000022,0
|
||||
|
||||
[Window][ Profiler]
|
||||
Pos=612,282
|
||||
Size=263,430
|
||||
Pos=933,739
|
||||
Size=582,430
|
||||
Collapsed=0
|
||||
DockId=0x00000023,0
|
||||
|
||||
@ -181,7 +180,7 @@ Column 0 Width=30
|
||||
Column 1 Weight=1.0000
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=146,189 Size=1264,684 Split=X Selected=0xF7365A5A
|
||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,28 Size=1904,1141 Split=X Selected=0xF7365A5A
|
||||
DockNode ID=0x00000020 Parent=0x14621557 SizeRef=884,684 Split=X
|
||||
DockNode ID=0x00000013 Parent=0x00000020 SizeRef=335,1142 Split=Y Selected=0x818D04BB
|
||||
DockNode ID=0x0000001B Parent=0x00000013 SizeRef=264,551 HiddenTabBar=1 Selected=0x1D5D92B6
|
||||
|
Loading…
Reference in New Issue
Block a user