try cmake and make. failed now try with julia.
This commit is contained in:
26
Makefile
26
Makefile
@ -4,14 +4,15 @@ BUILD_DIR := ./build
|
||||
SRC_DIR := ./src
|
||||
INC_DIR := ./include
|
||||
SHADER_DIR := ./kernels
|
||||
SHADER_EXT := 'cl'
|
||||
|
||||
# Find all the C and C++ files we want to compile
|
||||
SRCS := $(shell find $(SRC_DIR) -name '*.cpp')
|
||||
GLSLS := $(shell find $(SHADER_DIR) -name '*.glsl')
|
||||
GLSLS := $(shell find $(SHADER_DIR) -name '*.cl')
|
||||
|
||||
# Prepends BUILD_DIR and appends .o to every src file
|
||||
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
|
||||
SPIRVS := $(GLSLS:%.glsl=$(BUILD_DIR)/%.sphv)
|
||||
SPIRVS := $(GLSLS:%.$(SHADER_EXT)=$(BUILD_DIR)/%.sphv)
|
||||
|
||||
# String substitution (suffix version without %).
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
@ -26,7 +27,22 @@ LIBS := OpenCL
|
||||
LDFLAGS := $(addprefix -l,$(LIBS))
|
||||
|
||||
# The -MMD and -MP flags together generate Makefiles for us! we use c++ 26
|
||||
CPPFLAGS := -Wall -Wextra $(INC_FLAGS) -MMD -MP -std=c++23
|
||||
CPPFLAGS := -Wall -Wextra $(INC_FLAGS) -MMD -MP -std=c++20
|
||||
|
||||
#set flags for kernel compiling
|
||||
GPU_VENDOR := glxinfo | grep -E "OpenGL vendor | OpenGL renderer" | cut -d" " -f4
|
||||
ARCH := uname -m
|
||||
ifeq ($(GPU_VENDOR),"AMD")
|
||||
CLFLAGS := --target=amdgcn-amd-amdhsa -mcpu=gfx900
|
||||
else ifeq ($(GPU_VENDOR),"NVIDIA")
|
||||
CLFLAGS := --target=nvtpx64-unkown-unkown
|
||||
else ifeq ($(ARCH), "x86_64")
|
||||
CLFLAGS := --target=spirv64
|
||||
else
|
||||
CLFLAGS := --target=spirv32
|
||||
endif
|
||||
|
||||
CXX := clang
|
||||
|
||||
# The final build step.
|
||||
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
|
||||
@ -38,9 +54,9 @@ $(BUILD_DIR)/%.cpp.o: %.cpp $(SPIRVS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(LDFLAGS)
|
||||
|
||||
#build the shaders
|
||||
$(SPIRVS): $(GLSL)
|
||||
$(BUILD_DIR)/%.spv: %.cl
|
||||
mkdir -p $(dir $@)
|
||||
glslc $(shaders).glsl $(shaders).spv
|
||||
$(CXX) $(CLFLAGS) -c $< -o $@
|
||||
|
||||
run: $(BUILD_DIR)/$(TARGET_EXEC)
|
||||
./$(BUILD_DIR)/$(TARGET_EXEC)
|
||||
|
||||
Reference in New Issue
Block a user