Now building under windows 10 with VS 2019

This commit is contained in:
Travis Hunter 2023-05-02 20:56:23 -06:00
parent cea4d13e6c
commit 36996abab8
5 changed files with 50 additions and 21 deletions

View File

@ -9,10 +9,37 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) 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 NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools PrintSupport)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools PrintSupport) find_package(Qt6 REQUIRED COMPONENTS Widgets LinguistTools PrintSupport)
find_package(CURL) #find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools PrintSupport)
find_package(fmt) #find_package(CURL)
#find_package(fmt)
set(TS_FILES qtrocket_en_US.ts) set(TS_FILES qtrocket_en_US.ts)
@ -124,10 +151,11 @@ else()
) )
endif() endif()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) #qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
endif() 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 set_target_properties(qtrocket PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com

View File

@ -14,7 +14,7 @@ int main(int argc, char *argv[])
// Instantiate logger // Instantiate logger
utils::Logger* logger = utils::Logger::getInstance(); utils::Logger* logger = utils::Logger::getInstance();
logger->setLogLevel(utils::Logger::DEBUG); logger->setLogLevel(utils::Logger::DEBUG_);
// instantiate QtRocket // instantiate QtRocket
QtRocket* qtrocket = QtRocket::getInstance(); QtRocket* qtrocket = QtRocket::getInstance();

View File

@ -7,6 +7,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <vector> #include <vector>
#include <iterator>
// 3rd party headers // 3rd party headers
/// \endcond /// \endcond

View File

@ -40,22 +40,22 @@ void Logger::log(std::string_view msg, const LogLevel& lvl)
// all levels at or lower than the current level. // all levels at or lower than the current level.
switch(currentLevel) switch(currentLevel)
{ {
case DEBUG: case DEBUG_:
if(lvl == DEBUG) if(lvl == DEBUG_)
{ {
outFile << "[DEBUG] " << msg << std::endl; outFile << "[DEBUG] " << msg << std::endl;
std::cout << "[DEBUG] " << msg << "\n"; std::cout << "[DEBUG] " << msg << "\n";
} }
[[fallthrough]]; [[fallthrough]];
case INFO: case INFO_:
if(lvl == INFO) if(lvl == INFO_)
{ {
outFile << "[INFO] " << msg << std::endl; outFile << "[INFO] " << msg << std::endl;
std::cout << "[INFO] " << msg << "\n"; std::cout << "[INFO] " << msg << "\n";
} }
[[fallthrough]]; [[fallthrough]];
case WARN: case WARN_:
if(lvl == WARN) if(lvl == WARN_)
{ {
outFile << "[WARN] " << msg << std::endl; outFile << "[WARN] " << msg << std::endl;
std::cout << "[WARN] " << msg << "\n"; 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 // Regardless of what level is set, ERROR is always logged, so
// rather than explicitly check for the ERROR case, we just use default case // rather than explicitly check for the ERROR case, we just use default case
default: default:
if(lvl == ERROR) if(lvl == ERROR_)
{ {
outFile << "[ERROR] " << msg << std::endl; outFile << "[ERROR] " << msg << std::endl;
std::cout << "[ERROR] " << msg << "\n"; std::cout << "[ERROR] " << msg << "\n";

View File

@ -22,10 +22,10 @@ class Logger
public: public:
enum LogLevel enum LogLevel
{ {
ERROR, ERROR_,
WARN, WARN_,
INFO, INFO_,
DEBUG DEBUG_
}; };
static Logger* getInstance(); static Logger* getInstance();
@ -44,10 +44,10 @@ public:
std::function<void(std::string_view)> info; std::function<void(std::string_view)> info;
std::function<void(std::string_view)> debug; std::function<void(std::string_view)> debug;
*/ */
inline void error(std::string_view msg) { log(msg, ERROR); } inline void error(std::string_view msg) { log(msg, ERROR_); }
inline void warn(std::string_view msg) { log(msg, WARN); } inline void warn(std::string_view msg) { log(msg, WARN_); }
inline void info(std::string_view msg) { log(msg, INFO); } inline void info(std::string_view msg) { log(msg, INFO_); }
inline void debug(std::string_view msg) { log(msg, DEBUG); } inline void debug(std::string_view msg) { log(msg, DEBUG_); }
void log(std::ostream& o, const std::string& msg); void log(std::ostream& o, const std::string& msg);