From e597fbb916848df1f6fbd4da04c1ab6f89a25b45 Mon Sep 17 00:00:00 2001 From: Omniscient Date: Sun, 27 Oct 2024 00:56:55 +1100 Subject: start on vulkan backend --- Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 597ecdc..92afab1 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CC := clang INCLUDES := -I./include -Ideps/glfw-3.3.8/include/GLFW -Ideps/stb_image CFLAGS := -Wall -Wextra -O2 -fPIC $(INCLUDES) # TODO(low prio): split static object files and shared object files so we can remove -fPIC from static lib builds -LDFLAGS := -lglfw +LDFLAGS := -lglfw -lvulkan # Detect OS UNAME_S := $(shell uname -s) @@ -67,22 +67,27 @@ shared: $(SHARED_LIB) static: $(STATIC_LIB) -# Shaders +# Metal shader compilation +ifeq ($(UNAME_S),Darwin) $(SHADER_OUT_DIR)/%.air: $(SHADER_DIR)/%.metal @mkdir -p $(SHADER_OUT_DIR) xcrun -sdk macosx metal -c $< -o $@ $(METAL_LIB): $(METAL_AIR_FILES) xcrun -sdk macosx metallib $^ -o $(SHADER_OUT_DIR)/default.metallib +endif .PHONY: all all: shared static .PHONY: triangle -triangle: $(EXAMPLES_DIR)/triangle.c $(SHARED_LIB) $(SHADER_OUT_DIR)/triangle.air $(METAL_LIB) +triangle: $(EXAMPLES_DIR)/triangle.c $(SHARED_LIB) # $(SHADER_OUT_DIR)/triangle.air $(METAL_LIB) @mkdir -p $(BUILD_DIR) +ifeq ($(UNAME_S),Darwin) + $(MAKE) $(SHADER_OUT_DIR)/triangle.air $(METAL_LIB) +endif $(CC) $(CFLAGS) $(EXAMPLES_DIR)/triangle.c -L$(BUILD_DIR) -lceleritas $(LDFLAGS) -o $(BUILD_DIR)/triangle.bin - MTL_DEBUG_LAYER=1 build/triangle.bin + MTL_DEBUG_LAYER=1 LD_LIBRARY_PATH=$(BUILD_DIR) build/triangle.bin .PHONY: cube cube: $(EXAMPLES_DIR)/cube.c $(SHARED_LIB) $(SHADER_OUT_DIR)/cube.air $(METAL_LIB) -- cgit v1.2.3-70-g09d2