From e40ac5de096fac6e32e3d8b7852eb12ef9a2af33 Mon Sep 17 00:00:00 2001 From: Alexander Hurd Date: Sun, 9 Nov 2025 19:38:18 -0500 Subject: [PATCH 1/4] adding CMakeLists.txt --- .gitignore | 1 + CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 07e019e..bd440e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ tests a.out +.idea \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..baba4fd --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.10) + +# Project name and version +project(cppq VERSION 1.0 LANGUAGES CXX) + +# Specify C++ standard +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# Add header-only library +add_library(cppq INTERFACE) + +# Specify the include directory for the library +target_include_directories(cppq INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +# Executable for tests +add_executable(tests tests.cpp) +target_link_libraries(tests PRIVATE + cppq + hiredis + uuid + Catch2Main + Catch2) + +# Executable for example +add_executable(example example.cpp) +target_link_libraries(example PRIVATE + cppq + hiredis + uuid) \ No newline at end of file From 4eafc270c4896582e27f89dfb920a98a057e5ed6 Mon Sep 17 00:00:00 2001 From: Alexander Hurd Date: Sun, 9 Nov 2025 19:58:14 -0500 Subject: [PATCH 2/4] adding Dockerfile for web --- web/Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 web/Dockerfile diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..2d2a2e6 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,39 @@ +# Use the official Node.js 20 LTS image as the base +FROM node:20-alpine AS builder + +# Set working directory +WORKDIR /app + +# Install dependencies +COPY package.json package-lock.json* ./ +RUN npm ci + +# Copy the rest of the source code +COPY . . + +# Build the Next.js app +RUN npm run build + +# Production image +FROM node:20-alpine AS runner + +WORKDIR /app + +# Install only production dependencies +COPY package.json package-lock.json* ./ +RUN npm ci --omit=dev + +# Copy the built Next.js app and public files +COPY --from=builder /app/.next ./.next +COPY --from=builder /app/public ./public +COPY --from=builder /app/next.config.ts ./ +COPY --from=builder /app/node_modules ./node_modules + +# Set environment variable +ENV NODE_ENV=production + +# Expose the default Next.js port +EXPOSE 3000 + +# Start the app +CMD ["npm", "start"] From 5aafe55c39900972c4b3f1e692843b07b43a53ae Mon Sep 17 00:00:00 2001 From: Alexander Hurd Date: Tue, 11 Nov 2025 21:03:04 -0500 Subject: [PATCH 3/4] add package find for deps --- CMakeLists.txt | 89 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index baba4fd..e12fcf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,33 +1,92 @@ +# ------------------------------------------------------------ +# Minimum CMake version required +# ------------------------------------------------------------ cmake_minimum_required(VERSION 3.10) -# Project name and version -project(cppq VERSION 1.0 LANGUAGES CXX) +# ------------------------------------------------------------ +# Project definition +# ------------------------------------------------------------ +# - Name: cppq +# - Version: 0.1 +# - Language: C++ +project(cppq VERSION 0.1 LANGUAGES CXX) -# Specify C++ standard +# ------------------------------------------------------------ +# C++ standard configuration +# ------------------------------------------------------------ +# Require modern C++17 support (no compiler extensions) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -# Add header-only library +# ------------------------------------------------------------ +# Header-only library definition +# ------------------------------------------------------------ +# This creates an INTERFACE library — no compiled code, +# just headers and interface properties (include dirs, etc.) add_library(cppq INTERFACE) -# Specify the include directory for the library +# Make headers in the project root available to anything +# that links to cppq target_include_directories(cppq INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -# Executable for tests +# ------------------------------------------------------------ +# Dependency discovery +# ------------------------------------------------------------ +# We’ll use pkg-config to find libraries that don’t provide +# native CMake config files. + +# Make sure pkg-config is available +find_package(PkgConfig REQUIRED) + +# Find libuuid (used for generating UUIDs) +pkg_check_modules(UUID REQUIRED uuid) + +# Find hiredis (Redis C client library) +pkg_check_modules(HIREDIS REQUIRED hiredis) + +# Find Catch2 v3 (C++ testing framework) +find_package(Catch2 3 REQUIRED) + +# ------------------------------------------------------------ +# Build the unit test executable +# ------------------------------------------------------------ +# - Compiles tests.cpp +# - Links against cppq, hiredis, uuid, and Catch2 add_executable(tests tests.cpp) + +# Add include directories from pkg-config results +target_include_directories(tests PRIVATE + ${UUID_INCLUDE_DIRS} + ${HIREDIS_INCLUDE_DIRS} +) + +# Link required libraries target_link_libraries(tests PRIVATE - cppq - hiredis - uuid - Catch2Main - Catch2) + cppq # our header-only library + ${UUID_LIBRARIES} # libuuid + ${HIREDIS_LIBRARIES} # hiredis + Catch2::Catch2WithMain # Catch2 test runner +) -# Executable for example +# ------------------------------------------------------------ +# Build the example executable +# ------------------------------------------------------------ +# - Compiles example.cpp +# - Links only with cppq, hiredis, and uuid add_executable(example example.cpp) + +# Include hiredis and uuid headers +target_include_directories(example PRIVATE + ${UUID_INCLUDE_DIRS} + ${HIREDIS_INCLUDE_DIRS} +) + +# Link with cppq and dependencies target_link_libraries(example PRIVATE - cppq - hiredis - uuid) \ No newline at end of file + cppq + ${UUID_LIBRARIES} + ${HIREDIS_LIBRARIES} +) From 47c158601086722f1bdc087472bca1ac6e18824d Mon Sep 17 00:00:00 2001 From: Alexander Hurd Date: Tue, 11 Nov 2025 21:10:59 -0500 Subject: [PATCH 4/4] adding nlohman find_package for test --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e12fcf7..5efc2b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) # Header-only library definition # ------------------------------------------------------------ # This creates an INTERFACE library — no compiled code, -# just headers and interface properties (include dirs, etc.) +# just header cppq.hpp add_library(cppq INTERFACE) # Make headers in the project root available to anything @@ -50,6 +50,9 @@ pkg_check_modules(HIREDIS REQUIRED hiredis) # Find Catch2 v3 (C++ testing framework) find_package(Catch2 3 REQUIRED) +# Add nlohmann_json dependency for tests +find_package(nlohmann_json REQUIRED) + # ------------------------------------------------------------ # Build the unit test executable # ------------------------------------------------------------ @@ -69,6 +72,7 @@ target_link_libraries(tests PRIVATE ${UUID_LIBRARIES} # libuuid ${HIREDIS_LIBRARIES} # hiredis Catch2::Catch2WithMain # Catch2 test runner + nlohmann_json::nlohmann_json # json dep ) # ------------------------------------------------------------