make c++ only. fix makefile. next library fix.
This commit is contained in:
25
Makefile
25
Makefile
@ -2,7 +2,8 @@ TARGET_EXEC := sim
|
||||
|
||||
BUILD_DIR := ./build
|
||||
SRC_DIR := ./src
|
||||
SHADER_DIR := ./shaders
|
||||
INC_DIR := ./include
|
||||
SHADER_DIR := ./kernels
|
||||
|
||||
# Find all the C and C++ files we want to compile
|
||||
SRCS := $(shell find $(SRC_DIR) -name '*.cpp')
|
||||
@ -15,27 +16,31 @@ SPIRVS := $(GLSLS:%.glsl=$(BUILD_DIR)/%.sphv)
|
||||
# String substitution (suffix version without %).
|
||||
DEPS := $(OBJS:.o=.d)
|
||||
|
||||
# Every folder in ./src will need to be passed to GCC so that it can find header files
|
||||
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
|
||||
# Every folder in ./include will need to be passed to GCC so that it can find header files
|
||||
INC_DIRS := $(shell find $(INC_DIR) -type d)
|
||||
# Add a prefix to INC_DIRS. So moduleA would become -ImoduleA. GCC understands this -I flag
|
||||
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
||||
|
||||
LIBS := OpenCL
|
||||
|
||||
# The -MMD and -MP flags together generate Makefiles for us!
|
||||
CPPFLAGS := $(INC_FLAGS) -MMD -MP
|
||||
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
|
||||
|
||||
# The final build step.
|
||||
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
|
||||
$(CXX) $(OBJS) -o $@ $(LDFLAGS)
|
||||
|
||||
# Build step for C++ source
|
||||
$(BUILD_DIR)/%.cpp.o: %.cpp .simdb $(SPIRVS)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $i@
|
||||
$(BUILD_DIR)/%.cpp.o: %.cpp $(SPIRVS)
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(LDFLAGS)
|
||||
|
||||
#build the shaders
|
||||
$(SPIRVS): $(GLSL)
|
||||
mkdir -p $(dir $@)
|
||||
glslc $(shaders).glsl $(shaders).spv
|
||||
mkdir -p $(dir $@)
|
||||
glslc $(shaders).glsl $(shaders).spv
|
||||
|
||||
run: $(BUILD_DIR)/$(TARGET_EXEC)
|
||||
./$(BUILD_DIR)/$(TARGET_EXEC)
|
||||
./$(BUILD_DIR)/$(TARGET_EXEC)
|
||||
|
||||
Reference in New Issue
Block a user