You've already forked flecs_tests
Add a makefile, change imgui with nuklear and add file dropping and loading
This commit is contained in:
82
makefile
Normal file
82
makefile
Normal file
@@ -0,0 +1,82 @@
|
||||
# Compiler and tools
|
||||
CC = emcc
|
||||
XXD = xxd
|
||||
|
||||
# Directories
|
||||
SRC_DIR = src
|
||||
SHADER_DIR = $(SRC_DIR)/shaders
|
||||
GENERATED_DIR = $(SRC_DIR)/generated
|
||||
SOKOL_DIR = ../sokol
|
||||
NUKLEAR_DIR = ../nuklear
|
||||
|
||||
# Output
|
||||
TARGET = app.html
|
||||
|
||||
# Source files
|
||||
C_SOURCES = $(SRC_DIR)/main.c
|
||||
|
||||
# Dynamic shader processing
|
||||
SHADER_FILES = $(wildcard $(SHADER_DIR)/*)
|
||||
SHADER_HEADERS = $(patsubst $(SHADER_DIR)/%,$(GENERATED_DIR)/%.h,$(SHADER_FILES))
|
||||
|
||||
# Compiler flags
|
||||
EMCC_FLAGS = -sUSE_WEBGPU \
|
||||
-sASSERTIONS \
|
||||
-sWASM_BIGINT \
|
||||
-sALLOW_MEMORY_GROWTH \
|
||||
-msimd128 \
|
||||
-sFILESYSTEM=0
|
||||
|
||||
# Include directories
|
||||
INCLUDES = -I$(SOKOL_DIR) -I$(NUKLEAR_DIR)
|
||||
|
||||
# Shell template
|
||||
SHELL_FILE = shell.html
|
||||
|
||||
# Default target
|
||||
all: $(TARGET)
|
||||
|
||||
# Main build target
|
||||
$(TARGET): $(SHADER_HEADERS) $(C_SOURCES) $(SHELL_FILE)
|
||||
$(CC) $(C_SOURCES) \
|
||||
-o $(TARGET) \
|
||||
$(EMCC_FLAGS) \
|
||||
-O3 \
|
||||
$(INCLUDES) \
|
||||
--shell-file=$(SHELL_FILE)
|
||||
|
||||
# Pattern rule for generating shader headers
|
||||
$(GENERATED_DIR)/%.h: $(SHADER_DIR)/% | $(GENERATED_DIR)
|
||||
@echo "Generating header for $<"
|
||||
$(XXD) -i $< $@
|
||||
|
||||
# Create generated directory if it doesn't exist
|
||||
$(GENERATED_DIR):
|
||||
mkdir -p $(GENERATED_DIR)
|
||||
|
||||
debug: $(SHADER_HEADERS) $(C_SOURCES) $(SHELL_FILE)
|
||||
$(CC) $(C_SOURCES) \
|
||||
-o $(TARGET) \
|
||||
$(EMCC_FLAGS) \
|
||||
-g -gsource-map=inline \
|
||||
$(INCLUDES) \
|
||||
--shell-file=$(SHELL_FILE)
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm -f $(TARGET) app.js app.wasm
|
||||
rm -rf $(GENERATED_DIR)
|
||||
|
||||
# Rebuild everything
|
||||
rebuild: clean all
|
||||
|
||||
# List all shader files (for debugging)
|
||||
list-shaders:
|
||||
@echo "Shader files found:"
|
||||
@echo "$(SHADER_FILES)"
|
||||
@echo ""
|
||||
@echo "Generated headers:"
|
||||
@echo "$(SHADER_HEADERS)"
|
||||
|
||||
# Phony targets
|
||||
.PHONY: all clean rebuild list-shaders
|
||||
Reference in New Issue
Block a user