database connection created

This commit is contained in:
2025-12-18 13:21:09 -06:00
parent fc02524fc1
commit c522e9abda
4 changed files with 56 additions and 11 deletions

View File

@@ -1,11 +1,12 @@
cmake_minimum_required(VERSION 3.20)
# -----------------------------
# Force Clang before project() is called
# Force Clang before project()
# -----------------------------
if(NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER clang CACHE STRING "" FORCE)
endif()
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER clang++ CACHE STRING "" FORCE)
endif()
@@ -21,13 +22,20 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE Release)
# -----------------------------
# Dependencies (local submodules / cloned repos)
# System dependency: libsodium
# -----------------------------
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBSODIUM REQUIRED IMPORTED_TARGET libsodium)
# -----------------------------
# Dependencies (vendored)
# -----------------------------
add_subdirectory(external/spdlog)
add_subdirectory(external/cpr)
add_subdirectory(external/clickhouse-cpp)
add_subdirectory(external/tomlplusplus)
add_subdirectory(external/json)
# -----------------------------
# Executable
# -----------------------------
@@ -36,7 +44,10 @@ add_executable(${PROJECT_NAME} src/main.cpp)
# -----------------------------
# Auto-discover include dirs under src/
# -----------------------------
file(GLOB_RECURSE SRC_SUBDIRS LIST_DIRECTORIES true "${CMAKE_CURRENT_SOURCE_DIR}/src/*")
file(GLOB_RECURSE SRC_SUBDIRS LIST_DIRECTORIES true
"${CMAKE_CURRENT_SOURCE_DIR}/src/*"
)
set(SRC_INCLUDES "")
foreach(dir ${SRC_SUBDIRS})
if(IS_DIRECTORY ${dir})
@@ -45,10 +56,15 @@ foreach(dir ${SRC_SUBDIRS})
endforeach()
# -----------------------------
# Auto-discover all .cpp files except main.cpp
# Auto-discover all .cpp except main.cpp
# -----------------------------
file(GLOB_RECURSE ALL_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
list(REMOVE_ITEM ALL_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
file(GLOB_RECURSE ALL_CPP
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
)
list(REMOVE_ITEM ALL_CPP
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp"
)
# -----------------------------
# Apply sources and includes
@@ -65,15 +81,19 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
clickhouse-cpp-lib
tomlplusplus::tomlplusplus
nlohmann_json::nlohmann_json
PkgConfig::LIBSODIUM
)
# -----------------------------
# Compiler warnings (Clang/GCC)
# Compiler warnings (Clang / GCC)
# -----------------------------
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(
-Wall -Wextra -Wpedantic
-Wconversion -Wshadow
target_compile_options(${PROJECT_NAME} PRIVATE
-Wall
-Wextra
-Wpedantic
-Wconversion
-Wshadow
-Wnull-dereference
-Wdouble-promotion
)