From 46319119925710726e1b9065e6f491d12b4424c7 Mon Sep 17 00:00:00 2001 From: Mars Ultor Date: Sat, 25 Oct 2025 11:54:58 -0500 Subject: [PATCH] added blake3 as a submodule. compiles. Rule No. 1: never push code that won't compiled --- .gitmodules | 3 +++ CMakeLists.txt | 52 ++++++++++++++++++++++++++++++++++--------------- external/BLAKE3 | 1 + 3 files changed, 40 insertions(+), 16 deletions(-) create mode 160000 external/BLAKE3 diff --git a/.gitmodules b/.gitmodules index 81cdd56..e20d9f2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "external/json"] path = external/json url = https://github.com/nlohmann/json +[submodule "external/BLAKE3"] + path = external/BLAKE3 + url = https://github.com/BLAKE3-team/BLAKE3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cbedf8..f5542fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,28 @@ cmake_minimum_required(VERSION 3.20) -project(email-tracker LANGUAGES CXX) + +# ----------------------------- +# Project setup +# ----------------------------- +# Use Clang explicitly (you can override from CLI if needed) +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) + +project(email-tracker LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_BUILD_TYPE Release) # ----------------------------- -# Dependencies +# Dependencies (all local submodules) # ----------------------------- add_subdirectory(external/fmt) add_subdirectory(external/spdlog) add_subdirectory(external/tomlplusplus) add_subdirectory(external/duckdb) add_subdirectory(external/json) +add_subdirectory(external/BLAKE3/c) # ----------------------------- # Executables @@ -23,17 +33,25 @@ add_executable(${PROJECT_NAME}-daemon src/main-daemon.cpp) # ----------------------------- # Common libraries # ----------------------------- -set(COMMON_LIBS fmt spdlog tomlplusplus duckdb_static nlohmann_json) +set(COMMON_LIBS + fmt + spdlog + tomlplusplus + duckdb_static + nlohmann_json + blake3 +) # ----------------------------- -# External includes +# External include directories # ----------------------------- set(EXTERNAL_INCLUDES - external/fmt/include - external/spdlog/include - external/tomlplusplus/include - external/duckdb/src/include - external/json/include/nlohmann + ${CMAKE_CURRENT_SOURCE_DIR}/external/fmt/include + ${CMAKE_CURRENT_SOURCE_DIR}/external/spdlog/include + ${CMAKE_CURRENT_SOURCE_DIR}/external/tomlplusplus/include + ${CMAKE_CURRENT_SOURCE_DIR}/external/duckdb/src/include + ${CMAKE_CURRENT_SOURCE_DIR}/external/json/include/nlohmann + ${CMAKE_CURRENT_SOURCE_DIR}/external/BLAKE3/c ) # ----------------------------- @@ -48,7 +66,7 @@ foreach(dir ${SRC_SUBDIRS}) endforeach() # ----------------------------- -# Automatically include all .cpp under src/ +# Automatically include all .cpp files under src/ # Exclude main files to avoid multiple main() definitions # ----------------------------- file(GLOB_RECURSE ALL_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") @@ -58,16 +76,18 @@ list(REMOVE_ITEM ALL_CPP ) # ----------------------------- -# Apply to targets +# Apply configuration to all targets # ----------------------------- foreach(target ${PROJECT_NAME}-client ${PROJECT_NAME}-daemon) - # Link common libraries target_link_libraries(${target} PRIVATE ${COMMON_LIBS}) - - # Include directories target_include_directories(${target} PRIVATE ${EXTERNAL_INCLUDES} ${SRC_INCLUDES}) - - # Add all .cpp sources dynamically target_sources(${target} PRIVATE ${ALL_CPP}) endforeach() +# ----------------------------- +# Optional: warnings and strict flags for Clang +# ----------------------------- +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic -Wconversion) +endif() + diff --git a/external/BLAKE3 b/external/BLAKE3 new file mode 160000 index 0000000..8bec2fb --- /dev/null +++ b/external/BLAKE3 @@ -0,0 +1 @@ +Subproject commit 8bec2fbebfb4719d04d4f3bc3155afe8fa0b2818