diff --git a/CMakeLists.txt b/CMakeLists.txt index 3dfd854..828a0a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,10 +9,37 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) +include(FetchContent) + +# fmtlib dependency +FetchContent_Declare(fmt + GIT_REPOSITORY https://github.com/fmtlib/fmt + GIT_TAG 9.1.0) +FetchContent_MakeAvailable(fmt) + +# jsoncpp dependency +FetchContent_Declare(jsoncpp + GIT_REPOSITORY https://github.com/open-source-parsers/jsoncpp + GIT_TAG 1.9.5) +FetchContent_MakeAvailable(jsoncpp) + +# curl dependency +FetchContent_Declare(CURL + GIT_REPOSITORY https://github.com/curl/curl + GIT_TAG curl-8_0_1) +FetchContent_MakeAvailable(CURL) + +if(WIN32) + set(CMAKE_PREFIX_PATH $ENV{QTDIR}) + include_directories("C:\\boost\\boost_1_82_0\\") +# find_package(Qt6Core REQUIRED) +# find_package(Qt6Widgets REQUIRED) +endif() find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools PrintSupport) -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools PrintSupport) -find_package(CURL) -find_package(fmt) +find_package(Qt6 REQUIRED COMPONENTS Widgets LinguistTools PrintSupport) +#find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools PrintSupport) +#find_package(CURL) +#find_package(fmt) set(TS_FILES qtrocket_en_US.ts) @@ -124,10 +151,11 @@ else() ) endif() - qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) + #qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) endif() -target_link_libraries(qtrocket PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${Qt_VERSION_MAJOR}::PrintSupport curl jsoncpp fmt::fmt-header-only) +#target_link_libraries(qtrocket PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt${Qt_VERSION_MAJOR}::PrintSupport libcurl jsoncpp_static fmt::fmt-header-only) +target_link_libraries(qtrocket PRIVATE Qt6::Widgets Qt6::PrintSupport libcurl jsoncpp_static fmt::fmt-header-only) set_target_properties(qtrocket PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com diff --git a/main.cpp b/main.cpp index 0ce1027..e0d1885 100644 --- a/main.cpp +++ b/main.cpp @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) // Instantiate logger utils::Logger* logger = utils::Logger::getInstance(); - logger->setLogLevel(utils::Logger::DEBUG); + logger->setLogLevel(utils::Logger::DEBUG_); // instantiate QtRocket QtRocket* qtrocket = QtRocket::getInstance(); diff --git a/sim/Environment.h b/sim/Environment.h index 0e09caf..b866420 100644 --- a/sim/Environment.h +++ b/sim/Environment.h @@ -7,6 +7,7 @@ #include #include #include +#include // 3rd party headers /// \endcond diff --git a/utils/Logger.cpp b/utils/Logger.cpp index c4f6880..bce72dc 100644 --- a/utils/Logger.cpp +++ b/utils/Logger.cpp @@ -40,22 +40,22 @@ void Logger::log(std::string_view msg, const LogLevel& lvl) // all levels at or lower than the current level. switch(currentLevel) { - case DEBUG: - if(lvl == DEBUG) + case DEBUG_: + if(lvl == DEBUG_) { outFile << "[DEBUG] " << msg << std::endl; std::cout << "[DEBUG] " << msg << "\n"; } [[fallthrough]]; - case INFO: - if(lvl == INFO) + case INFO_: + if(lvl == INFO_) { outFile << "[INFO] " << msg << std::endl; std::cout << "[INFO] " << msg << "\n"; } [[fallthrough]]; - case WARN: - if(lvl == WARN) + case WARN_: + if(lvl == WARN_) { outFile << "[WARN] " << msg << std::endl; std::cout << "[WARN] " << msg << "\n"; @@ -64,7 +64,7 @@ void Logger::log(std::string_view msg, const LogLevel& lvl) // Regardless of what level is set, ERROR is always logged, so // rather than explicitly check for the ERROR case, we just use default case default: - if(lvl == ERROR) + if(lvl == ERROR_) { outFile << "[ERROR] " << msg << std::endl; std::cout << "[ERROR] " << msg << "\n"; diff --git a/utils/Logger.h b/utils/Logger.h index dede4e2..18c7467 100644 --- a/utils/Logger.h +++ b/utils/Logger.h @@ -22,10 +22,10 @@ class Logger public: enum LogLevel { - ERROR, - WARN, - INFO, - DEBUG + ERROR_, + WARN_, + INFO_, + DEBUG_ }; static Logger* getInstance(); @@ -44,10 +44,10 @@ public: std::function info; std::function debug; */ - inline void error(std::string_view msg) { log(msg, ERROR); } - inline void warn(std::string_view msg) { log(msg, WARN); } - inline void info(std::string_view msg) { log(msg, INFO); } - inline void debug(std::string_view msg) { log(msg, DEBUG); } + inline void error(std::string_view msg) { log(msg, ERROR_); } + inline void warn(std::string_view msg) { log(msg, WARN_); } + inline void info(std::string_view msg) { log(msg, INFO_); } + inline void debug(std::string_view msg) { log(msg, DEBUG_); } void log(std::ostream& o, const std::string& msg);