make it compile with cmake.

This commit is contained in:
2025-09-23 19:08:56 +02:00
parent 59411ea4ce
commit 377582c833
25 changed files with 56742 additions and 78 deletions

4
simulation/.ccls Normal file
View File

@ -0,0 +1,4 @@
%compile_commands.json
%c -std=c11
%cpp -std=c++17
-Iinc

View File

@ -0,0 +1,3 @@
add_executable(sim main.cpp)
target_compile_features(sim PRIVATE cxx_std_17)
target_link_libraries(sim PRIVATE inc duckdb OpenCL::OpenCL)

44
simulation/main.cpp Normal file
View File

@ -0,0 +1,44 @@
#include <print>
#include <iostream>
// opencl
#include <CL/opencl.hpp>
// duckdb
#include "duckdb/duckdb.hpp"
#include "opencl_helper.hpp"
#include "simulation.hpp"
#define DB_FILE "../simulation.duckdb"
#define KERNEL_DIR "../kernels/"
#define SQLCMD_DIR "../sqlcmd/"
int main(){
// open database
duckdb_database db;
duckdb_connection dbcon;
if (duckdb_open(DB_FILE, &db) == DuckDBError) {
std::cout << "DB file can not be found" << std::endl;
exit(1);
}
if (duckdb_connect(db, &dbcon) == DuckDBError) {
std::cout << ("DB NOT Connected") << std::endl;
exit(1);
}
std::cout << "DB Connected" << std::endl;
// Setup OpenCL
cl::Device cl_device = OpenCL::select_devices();
cl::Context cl_context ({cl_device});
run_simulation(dbcon, cl_device , cl_context);
duckdb_disconnect(&dbcon);
duckdb_close(&db);
return 0;
}