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

View File

@ -1,8 +1,66 @@
cmake_minimum_required(VERSION 3.0)
cmake_policy(VERSION 3.0...3.18.4)
project(proj)
add_executable(app src/main.cpp)
find_package(OpenCLHeaders REQUIRED)
find_package(OpenCLICDLoader REQUIRED)
find_package(OpenCLHeadersCpp REQUIRED)
target_link_libraries(app PRIVATE OpenCL::Headers OpenCL::OpenCL OpenCL::HeadersCpp)
cmake_minimum_required(VERSION 3.15...4.0)
project(
simulator
VERSION 0.0.1
DESCRIPTION "Simulation of Ground Fertility, 1 tick every time it is ran."
LANGUAGES CXX)
# Only do these if this is the main project, and not if it is included through add_subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# Optionally set things like CMAKE_CXX_STANDARD, CMAKE_POSITION_INDEPENDENT_CODE here
# Let's ensure -std=c++xx instead of -std=g++xx
set(CMAKE_CXX_EXTENSIONS OFF)
# Let's nicely support folders in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Testing only available if this is the main app
# Note this needs to be done in the main CMakeLists
# since it calls enable_testing, which must be in the
# main CMakeLists.
include(CTest)
# Docs only available if this is the main app
find_package(Doxygen)
if(Doxygen_FOUND)
add_subdirectory(docs)
else()
message(STATUS "Doxygen not found, not building docs")
endif()
endif()
# FetchContent added in CMake 3.11, downloads during the configure step
# FetchContent_MakeAvailable was added in CMake 3.14; simpler usage
include(FetchContent)
# Accumulator library
# This is header only, so could be replaced with git submodules or FetchContent
find_package(OpenCL REQUIRED)
link_directories(libs)
#kernel code compiled
add_subdirectory(kernels)
# The compiled library code is here
add_subdirectory(src)
# The executable code is here
add_subdirectory(simulation)
# Testing only available if this is the main app
# Emergency override MODERN_CMAKE_BUILD_TESTING provided as well
if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING)
AND BUILD_TESTING)
add_subdirectory(tests)
endif()
#add_library(duckdb SHARED "libs/libduckdb.so" "include/duckdb/duckdb.h")
#target_include_directories(base PUBLIC HEADER_LIST)
#add_executable(simulator src/main.cpp)
#target_link_libraries(simulator OpenCL::OpenCL duckdb)