make c++ only. fix makefile. next library fix.

This commit is contained in:
2025-07-23 15:56:35 +02:00
parent d1959539e2
commit f3b83c5ab2
7 changed files with 18 additions and 122 deletions

View File

@ -1,6 +0,0 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -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)

View File

@ -1,72 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"id": "f6e13c4a-8200-4c09-b402-025fae57236f",
"metadata": {},
"outputs": [
{
"ename": "LoadError",
"evalue": "ArgumentError: Package FixedSizeArrays not found in current path.\n- Run `import Pkg; Pkg.add(\"FixedSizeArrays\")` to install the FixedSizeArrays package.",
"output_type": "error",
"traceback": [
"ArgumentError: Package FixedSizeArrays not found in current path.\n- Run `import Pkg; Pkg.add(\"FixedSizeArrays\")` to install the FixedSizeArrays package.",
""
]
}
],
"source": [
"using FixedSizeArrays"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "251cbbae-41f5-4ef9-b16b-4fd63a07a126",
"metadata": {},
"outputs": [
{
"ename": "LoadError",
"evalue": "UndefVarError: `FixedSizeArray` not defined in `Main`\nSuggestion: check for spelling errors or missing imports.",
"output_type": "error",
"traceback": [
"UndefVarError: `FixedSizeArray` not defined in `Main`\nSuggestion: check for spelling errors or missing imports.",
"",
"Stacktrace:",
" [1] top-level scope",
" @ In[3]:1"
]
}
],
"source": [
"struct Ground \n",
" nurtrient::FixedSizeArray{Float32}(undef, (1000, 1000, 50))\n",
"end "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "83f4cd41-3b52-43ff-a536-3381d5fe1faa",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Julia 1.11.3",
"language": "julia",
"name": "julia-1.11"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.11.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

3
packges.org Normal file
View File

@ -0,0 +1,3 @@
#+title: Packges
opencl-headers ocl-icd-opencl-dev -y

View File

@ -1,34 +0,0 @@
-- weather definition
CREATE TABLE weather (
rain_mm NUMERIC NOT NULL,
"day" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
rain_nutrient NUMERIC NOT NULL,
rain_ph NUMERIC DEFAULT (random() % 1 + 7) NOT NULL,
temperature NUMERIC NOT NULL,
WindSpeed NUMERIC NOT NULL,
O2 NUMERIC DEFAULT (0.21) NOT NULL,
CO2 NUMERIC DEFAULT (0.001) NOT NULL,
Humidity NUMERIC DEFAULT (random() % 100) NOT NULL,
CH4 NUMERIC NOT NULL,
N2 NUMERIC DEFAULT (.78) NOT NULL,
AirPressure NUMERIC NOT NULL,
CONSTRAINT weather_pk PRIMARY KEY ("day")
);
-- Locations definition
CREATE TABLE Locations (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
loc_x NUMERIC NOT NULL,
loc_y NUMERIC NOT NULL,
loc_z NUMERIC NOT NULL
);
-- Distance definition
CREATE TABLE Distance (
distance NUMERIC NOT NULL,
vecA INTEGER NOT NULL,
vecB INTEGER NOT NULL,
CONSTRAINT Distance_Locations_FK FOREIGN KEY (vecA) REFERENCES Locations(id),
CONSTRAINT Distance_Locations_FK_1 FOREIGN KEY (vecB) REFERENCES Locations(id)
);