Now super fast to compile project
This commit is contained in:
parent
3cc5abfde3
commit
c5222020fb
|
@ -6,6 +6,9 @@
|
|||
"detail": "Build project",
|
||||
"type": "shell",
|
||||
"command": "make",
|
||||
"args": [
|
||||
"-j$(nproc)"
|
||||
],
|
||||
"group": "build",
|
||||
"presentation": {
|
||||
"echo": true,
|
||||
|
|
32
Makefile
32
Makefile
|
@ -2,23 +2,29 @@
|
|||
BUILD_DIR = build
|
||||
|
||||
# Source files
|
||||
SOURCES = \
|
||||
SOURCES := \
|
||||
src/main.cpp \
|
||||
src/game_data.cpp
|
||||
|
||||
# Assets files
|
||||
ASSETS = \
|
||||
ASSETS := \
|
||||
assets/player-sheets/player_idle_sheet.png \
|
||||
assets/player-sheets/player_run_sheet.png
|
||||
|
||||
# Output target name
|
||||
OUTPUT = 2D_Engine_Casio_Tool
|
||||
OUTPUT := 2D_Engine_Casio_Tool
|
||||
|
||||
# Compiler and flags
|
||||
CXX = g++
|
||||
CXX = ccache g++
|
||||
CXXFLAGS = -Wall -Wextra -std=c++17 -O2 -I. -no-pie
|
||||
LDFLAGS = -no-pie
|
||||
|
||||
# Converter flags
|
||||
FXCONVFLAGS = --cg --toolchain= --arch=x86-64 --outputtarget=elf64-x86-64
|
||||
|
||||
# Change output location
|
||||
OUTPUT := $(BUILD_DIR)/$(OUTPUT)
|
||||
|
||||
# Deduce objects
|
||||
OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o) $(ASSETS:%=$(BUILD_DIR)/%.o)
|
||||
|
||||
|
@ -34,12 +40,11 @@ GREEN := \033[0;32m
|
|||
YELLOW := \033[1;33m
|
||||
RESET := \033[0m
|
||||
|
||||
# Total number of files to process
|
||||
TOTAL_FILES := $(shell echo $$(($(words $(SOURCES) $(ASSETS))+1)))
|
||||
# Current file nb to process
|
||||
CURRENT_FILE := 0
|
||||
|
||||
# Default targets
|
||||
all: build_dir $(OUTPUT) end
|
||||
all: count_build build_dir end
|
||||
|
||||
# Create build directory
|
||||
build_dir:
|
||||
|
@ -54,19 +59,26 @@ $(OUTPUT): $(OBJECTS)
|
|||
$(BUILD_DIR)/%.o: %.cpp
|
||||
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE)+1))))
|
||||
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE)*100/$(TOTAL_FILES)))))
|
||||
@echo "[$(PERCENTAGE)%] $(GREEN)Building $@$(RESET)"
|
||||
@echo "[$(PERCENTAGE)%] $(GREEN)Building CXX object $@$(RESET)"
|
||||
$(Q)mkdir -p $(dir $@)
|
||||
$(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
# Convert .*.o from .* (png files for example)
|
||||
$(BUILD_DIR)/%.o: %
|
||||
fxconv --cg --toolchain= --arch=x86-64 --outputtarget=elf64-x86-64 $< -o $@
|
||||
$(eval CURRENT_FILE := $(shell echo $$(($(CURRENT_FILE)+1))))
|
||||
$(eval PERCENTAGE := $(shell echo $$(($(CURRENT_FILE)*100/$(TOTAL_FILES)))))
|
||||
@echo "[$(PERCENTAGE)%] $(GREEN)Building FXCONV object $@$(RESET)"
|
||||
$(Q)fxconv $(FXCONVFLAGS) $< -o $@
|
||||
$(Q)objcopy --add-section .note.GNU-stack=/dev/null $@
|
||||
|
||||
# Source files dependencies
|
||||
-include $(OBJECTS:.o=.d)
|
||||
|
||||
count_build:
|
||||
$(eval export TOTAL_FILES := $(shell echo $$(($$(make -n $(OBJECTS) 2>/dev/null | grep -c "Building") + 1))))
|
||||
|
||||
# Print ending message
|
||||
end:
|
||||
end: $(OUTPUT)
|
||||
@echo "Built target $(OUTPUT)"
|
||||
|
||||
# Clean
|
||||
|
|
|
@ -8,7 +8,7 @@ This tool is used to make game data for the 2D_Engine_Casio [Gitea](https://gite
|
|||
- This program is open-source : you can redistribute and/or modify it under the term of the **GNU GPLv3**.
|
||||
Copyright (C) 2025 Ulysse Cura. See [LICENSE](LICENSE) or [gnu.org/licenses/gpl-3.0.html](https://www.gnu.org/licenses/gpl-3.0.html).
|
||||
|
||||
- Files from the gint project is used in directory [gint/](gint/).
|
||||
- Files from the gint project are used but not modified in directory [gint/](gint/).
|
||||
[Git](https://git.planet-casio.com/Lephenixnoir/gint)
|
||||
|
||||
- Folder `src/nlohmann/json` contains code under **MIT license** :
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue