Now building under windows 10 with VS 2019
This commit is contained in:
parent
cea4d13e6c
commit
36996abab8
@ -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
|
||||
|
2
main.cpp
2
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();
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
// 3rd party headers
|
||||
/// \endcond
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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<void(std::string_view)> info;
|
||||
std::function<void(std::string_view)> 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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user