succeffully spun up threads to answer clients, just have to client-side comms next.

This commit is contained in:
2025-10-25 00:13:23 -05:00
parent 0f62d80ffb
commit da73d88dd0
8 changed files with 138 additions and 17 deletions

View File

@@ -5,19 +5,30 @@ set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# -----------------------------
# Dependencies
# -----------------------------
add_subdirectory(external/fmt)
add_subdirectory(external/spdlog)
add_subdirectory(external/tomlplusplus)
add_subdirectory(external/duckdb)
add_subdirectory(external/json)
# -----------------------------
# Executables
# -----------------------------
add_executable(${PROJECT_NAME}-client src/main-tracker.cpp)
add_executable(${PROJECT_NAME}-daemon src/main-daemon.cpp)
# Common targets
# -----------------------------
# Common libraries
# -----------------------------
set(COMMON_LIBS fmt spdlog tomlplusplus duckdb_static nlohmann_json)
set(COMMON_INCLUDES
# -----------------------------
# External includes
# -----------------------------
set(EXTERNAL_INCLUDES
external/fmt/include
external/spdlog/include
external/tomlplusplus/include
@@ -25,9 +36,38 @@ set(COMMON_INCLUDES
external/json/include/nlohmann
)
# Apply common settings
foreach(target ${PROJECT_NAME}-client ${PROJECT_NAME}-daemon)
target_link_libraries(${target} PRIVATE ${COMMON_LIBS})
target_include_directories(${target} PRIVATE ${COMMON_INCLUDES})
# -----------------------------
# Automatically include all header directories 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()
# -----------------------------
# Automatically include all .cpp under src/
# Exclude main files to avoid multiple main() definitions
# -----------------------------
file(GLOB_RECURSE ALL_CPP "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
list(REMOVE_ITEM ALL_CPP
"${CMAKE_CURRENT_SOURCE_DIR}/src/main-tracker.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/main-daemon.cpp"
)
# -----------------------------
# Apply to 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()