From 4372684d00ec23c1a1f4ace3efbc27d76daf6a4b Mon Sep 17 00:00:00 2001 From: Dustin Thomas Date: Fri, 5 Sep 2025 19:59:51 -0500 Subject: [PATCH] fix compile issues --- client.cpp | 1 + logging.h | 20 ++++++-------------- meson.build | 8 ++++++-- server.cpp | 1 + 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/client.cpp b/client.cpp index edc2a54..e597c13 100644 --- a/client.cpp +++ b/client.cpp @@ -5,6 +5,7 @@ #include #include #include "transfer.h" +#include "logging.h" using namespace std; diff --git a/logging.h b/logging.h index 78e83aa..440b3a7 100644 --- a/logging.h +++ b/logging.h @@ -19,7 +19,7 @@ #define LOGGING_COLOR true // enable color #define LOGGING_TIMESTAMP true // enable timestamp #define LOGGING_TIMESTAMP_FMT "%Y-%m-%dT%H:%M:%S%z" // timestamp format (local time) -#define LOGGING_POSITION true // display position (only works on C++20 or newer) +#define LOGGING_POSITION false // display position (only works on C++20 or newer) // Color codes #define ANSI_RESET "\033[0m" @@ -33,15 +33,9 @@ #define ANSI_WHITE "\033[37m" /* White */ #define ANSI_BOLD "\033[1m" /* Bold */ -template -void print(T t) { - std::cout << t << std::endl; -} - -template -void print(T t, Args... args) { - std::cout << t; - print(args...); +template +void print(Args... args) { + (std::cout << ... << args) << "\n"; } inline void printTimestamp() { @@ -55,13 +49,11 @@ inline void printTimestamp() { } // if we're on C++20 or later, then use the source_location header and add source location to logs -#if __cplusplus >= 202002L +#if __cplusplus >= 202002L && LOGGING_POSITION #include inline void printPosition(std::source_location& location) { - #if LOGGING_POSITION - std::cout << location.file_name() << ":" << location.function_name << ":" << ANSI_CYAN << location.line() << ANSI_RESET << ": "; - #endif + std::cout << location.file_name() << ":" << location.function_name() << ":" << ANSI_CYAN << location.line() << ANSI_RESET << ": "; } inline void printHeader(std::string name, std::string color, std::source_location& location) { diff --git a/meson.build b/meson.build index 3d04040..fc0c561 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,8 @@ project('video-streaming-poc', 'cpp', version : '0.0.1-SNAPSHOT', #======================================================================================================================= # opencv dependency opencv = dependency('opencv4', version : '>=4.0.0') +opencv_incl_dir = opencv.get_variable(cmake : 'OpenCV_INCLUDE_DIRECTORIES', pkgconfig : 'includedir') +include = include_directories(opencv_incl_dir) # boost dependency boost = dependency('boost') @@ -27,7 +29,9 @@ server = common + ['server.cpp'] #======================================================================================================================= # client executable client_exe = executable('client', client, - dependencies : [opencv, boost]) + dependencies : [opencv, boost], + include_directories : include) # server executable server_exe = executable('server', server, - dependencies : [opencv, boost]) \ No newline at end of file + dependencies : [opencv, boost], + include_directories : include) \ No newline at end of file diff --git a/server.cpp b/server.cpp index 924dc72..d5f5447 100644 --- a/server.cpp +++ b/server.cpp @@ -6,6 +6,7 @@ #include #include #include "transfer.h" +#include "logging.h" using namespace std;