This commit is contained in:
2025-12-23 22:10:12 -06:00
commit 1fa0913f3c
7 changed files with 143 additions and 0 deletions

38
.gitignore vendored Normal file
View File

@@ -0,0 +1,38 @@
# OS junk
.DS_Store
Thumbs.db
# Editor settings
.vscode/**
.idea/**
*.swp
*.swo
# Build system metadata (keep actual build dirs tracked)
CMakeFiles/**
CMakeCache.txt
cmake_install.cmake
Makefile
compile_commands.json
# Logs and temp files
*.log
*.tmp
*.bak
*.old
build/**
*.toml
.cache/**
**/*.aux
**/*.fdb_latexmk
**/*.fls
**/*.log
**/*.synctex.gz
**/*.blg
**/*.bcf
**/*.run.xml
**/*.bbl

10
.gitmodules vendored Normal file
View File

@@ -0,0 +1,10 @@
[submodule "external/clickhouse-cpp"]
path = external/clickhouse-cpp
url = https://github.com/ClickHouse/clickhouse-cpp
[submodule "external/tomlplusplus"]
path = external/tomlplusplus
url = https://github.com/marzer/tomlplusplus
[submodule "external/spdlog"]
path = external/spdlog
url = https://github.com/gabime/spdlog

78
CMakeLists.txt Normal file
View File

@@ -0,0 +1,78 @@
cmake_minimum_required(VERSION 3.20)
# -----------------------------
# Force Clang before project() is called
# -----------------------------
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()
# -----------------------------
# Project setup
# -----------------------------
project(mc-watchdog LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_BUILD_TYPE Release)
# -----------------------------
# Dependencies (local submodules / cloned repos)
# -----------------------------
add_subdirectory(external/spdlog)
add_subdirectory(external/clickhouse-cpp)
add_subdirectory(external/tomlplusplus)
# -----------------------------
# Executable
# -----------------------------
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/*")
set(SRC_INCLUDES "")
foreach(dir ${SRC_SUBDIRS})
if(IS_DIRECTORY ${dir})
list(APPEND SRC_INCLUDES ${dir})
endif()
endforeach()
# -----------------------------
# Auto-discover all .cpp files 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")
# -----------------------------
# Apply sources and includes
# -----------------------------
target_sources(${PROJECT_NAME} PRIVATE ${ALL_CPP})
target_include_directories(${PROJECT_NAME} PRIVATE ${SRC_INCLUDES})
# -----------------------------
# Link libraries
# -----------------------------
target_link_libraries(${PROJECT_NAME} PRIVATE
spdlog::spdlog
clickhouse-cpp-lib
tomlplusplus::tomlplusplus
)
# -----------------------------
# Compiler warnings (Clang/GCC)
# -----------------------------
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(
-Wall -Wextra -Wpedantic
-Wconversion -Wshadow
-Wnull-dereference
-Wdouble-promotion
)
endif()

1
external/clickhouse-cpp vendored Submodule

Submodule external/clickhouse-cpp added at 3c94b44894

1
external/spdlog vendored Submodule

Submodule external/spdlog added at 32dd298dc2

1
external/tomlplusplus vendored Submodule

Submodule external/tomlplusplus added at e7aaccca3f

14
src/main.cpp Normal file
View File

@@ -0,0 +1,14 @@
#include <string>
#include <toml++/toml.h>
int main (int argc, char *argv[]) {
auto config = toml::parse_file("config.toml");
bool ingest_all_logs = config["all"].value_or(false);
std::string log_path = config["minecraft"]["logs_path"].value_or("");
if(log_path.empty()) throw std::runtime_error("your dumbass can't put in a path");
std::string clickhouse_username = config["clickhouse"]["username"].value_or("");
std::string clickouse_password = config["clickhouse"]["password"].value_or("");
if(clickhouse_username.empty() || clickouse_password.empty()) throw std::runtime_error("put the creds in the right place idiot");
return 0;
}