diff --git a/CMakeLists.txt b/CMakeLists.txt index fd97aafe..f016fa82 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -155,11 +155,11 @@ if(NOT WIN32) message(FATAL_ERROR "uuid lib error") endif() endif(NOT WIN32) -if(NOT MSVC) +if(NOT MSVC OR NOT BUILD_ORM) find_package(ZLIB REQUIRED) target_include_directories(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIR}) target_link_libraries(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES}) -endif(NOT MSVC) +endif(NOT MSVC OR NOT BUILD_ORM) set(DROGON_SOURCES lib/src/AOPAdvice.cc diff --git a/cmake/templates/DrogonConfig.cmake.in b/cmake/templates/DrogonConfig.cmake.in index 1d2bacaa..6e35a8cd 100644 --- a/cmake/templates/DrogonConfig.cmake.in +++ b/cmake/templates/DrogonConfig.cmake.in @@ -3,15 +3,15 @@ # DROGON_INCLUDE_DIRS - include directories for Drogon # DROGON_LIBRARIES - libraries to link against # DROGON_EXECUTABLE - the drogon_ctl executable -# DROGON_FOUND +# Drogon_FOUND # This module defines the following IMPORTED target: # Drogon::Drogon @PACKAGE_INIT@ -if(NOT TRANTOR_FOUND) +if(NOT Trantor_FOUND) # find trantor - find_package(Trantor REQUIRED) + find_package(Trantor CONFIG REQUIRED) endif() # Our library dependencies (contains definitions for IMPORTED targets) @@ -24,4 +24,3 @@ endif() get_target_property(DROGON_INCLUDE_DIRS Drogon::Drogon INTERFACE_INCLUDE_DIRECTORIES) set(DROGON_LIBRARIES Drogon::Drogon) set(DROGON_EXECUTABLE drogon_ctl) -set(DROGON_FOUND TRUE) diff --git a/lib/inc/drogon/HttpRequest.h b/lib/inc/drogon/HttpRequest.h index 70521fca..0afdcbd2 100644 --- a/lib/inc/drogon/HttpRequest.h +++ b/lib/inc/drogon/HttpRequest.h @@ -58,11 +58,11 @@ HttpRequestPtr toRequest(T &&) } template <> -HttpRequestPtr toRequest(const Json::Value &pJson); +HttpRequestPtr toRequest(const Json::Value &pJson); template <> HttpRequestPtr toRequest(Json::Value &&pJson); template <> -inline HttpRequestPtr toRequest(Json::Value &pJson) +inline HttpRequestPtr toRequest(Json::Value &pJson) { return toRequest((const Json::Value &)pJson); } @@ -372,7 +372,7 @@ class HttpRequest }; template <> -inline HttpRequestPtr toRequest(const Json::Value &pJson) +inline HttpRequestPtr toRequest(const Json::Value &pJson) { return HttpRequest::newHttpJsonRequest(pJson); } diff --git a/lib/inc/drogon/HttpResponse.h b/lib/inc/drogon/HttpResponse.h index 694d8139..176621f1 100644 --- a/lib/inc/drogon/HttpResponse.h +++ b/lib/inc/drogon/HttpResponse.h @@ -54,11 +54,11 @@ HttpResponsePtr toResponse(T &&) exit(1); } template <> -HttpResponsePtr toResponse(const Json::Value &pJson); +HttpResponsePtr toResponse(const Json::Value &pJson); template <> HttpResponsePtr toResponse(Json::Value &&pJson); template <> -inline HttpResponsePtr toResponse(Json::Value &pJson) +inline HttpResponsePtr toResponse(Json::Value &pJson) { return toResponse((const Json::Value &)pJson); } @@ -367,7 +367,7 @@ class HttpResponse virtual void setBody(const char *body, size_t len) = 0; }; template <> -inline HttpResponsePtr toResponse(const Json::Value &pJson) +inline HttpResponsePtr toResponse(const Json::Value &pJson) { return HttpResponse::newHttpJsonResponse(pJson); } diff --git a/lib/inc/drogon/MultiPart.h b/lib/inc/drogon/MultiPart.h index b364642f..6979158a 100644 --- a/lib/inc/drogon/MultiPart.h +++ b/lib/inc/drogon/MultiPart.h @@ -77,7 +77,7 @@ class HttpFile /// Return the file content. char *fileData() noexcept { -#if __cplusplus >= 201703L | defined _WIN32 +#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900) return fileContent_.data(); #else return (char *)(fileContent_.data()); diff --git a/lib/inc/drogon/utils/any.h b/lib/inc/drogon/utils/any.h index 0faa4275..63abd2e8 100644 --- a/lib/inc/drogon/utils/any.h +++ b/lib/inc/drogon/utils/any.h @@ -13,7 +13,7 @@ */ #pragma once -#if __cplusplus >= 201703L | defined _WIN32 +#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900) #include #else #include @@ -21,7 +21,7 @@ namespace drogon { -#if __cplusplus >= 201703L | defined _WIN32 +#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900) using std::any; using std::any_cast; #else diff --git a/lib/inc/drogon/utils/string_view.h b/lib/inc/drogon/utils/string_view.h index c2809c83..47b0aa27 100644 --- a/lib/inc/drogon/utils/string_view.h +++ b/lib/inc/drogon/utils/string_view.h @@ -13,7 +13,7 @@ */ #pragma once -#if __cplusplus >= 201703L | defined _WIN32 +#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900) #include #else #include @@ -24,7 +24,7 @@ namespace drogon { -#if __cplusplus >= 201703L | defined _WIN32 +#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900) using std::string_view; #else using boost::string_view; diff --git a/lib/src/HttpAppFrameworkImpl.cc b/lib/src/HttpAppFrameworkImpl.cc index 10bc37e7..a32779a7 100644 --- a/lib/src/HttpAppFrameworkImpl.cc +++ b/lib/src/HttpAppFrameworkImpl.cc @@ -87,11 +87,14 @@ HttpAppFrameworkImpl::HttpAppFrameworkImpl() uploadPath_(rootPath_ + "uploads") { } + +static std::function f = [] { + LOG_TRACE << "Initialize the main event loop in the main thread"; +}; + /// Make sure that the main event loop is initialized in the main thread. drogon::InitBeforeMainFunction drogon::HttpAppFrameworkImpl::initFirst_([]() { - HttpAppFrameworkImpl::instance().getLoop()->runInLoop([]() { - LOG_TRACE << "Initialize the main event loop in the main thread"; - }); + HttpAppFrameworkImpl::instance().getLoop()->runInLoop(f); }); namespace drogon diff --git a/orm_lib/inc/drogon/orm/ResultIterator.h b/orm_lib/inc/drogon/orm/ResultIterator.h index cdb22068..643ceb9d 100644 --- a/orm_lib/inc/drogon/orm/ResultIterator.h +++ b/orm_lib/inc/drogon/orm/ResultIterator.h @@ -115,7 +115,7 @@ class ConstReverseResultIterator : private ConstResultIterator using iterator_type::iterator_category; using iterator_type::pointer; using iterator_type::reference; - using iterator_type::value_type; + // using iterator_type::value_type; ConstReverseResultIterator(const ConstReverseResultIterator &rhs) : ConstResultIterator(rhs) diff --git a/orm_lib/inc/drogon/orm/RowIterator.h b/orm_lib/inc/drogon/orm/RowIterator.h index 10ec043e..5e2feb0e 100644 --- a/orm_lib/inc/drogon/orm/RowIterator.h +++ b/orm_lib/inc/drogon/orm/RowIterator.h @@ -111,7 +111,7 @@ class ConstReverseRowIterator : private ConstRowIterator using iterator_type::iterator_category; using iterator_type::pointer; using iterator_type::reference; - using iterator_type::value_type; + // using iterator_type::value_type; ConstReverseRowIterator(const ConstReverseRowIterator &rhs) : ConstRowIterator(rhs) diff --git a/trantor b/trantor index b152c54b..e052988f 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit b152c54b1fd36c04fde8b400f5637617962260c9 +Subproject commit e052988f277d039e3392bd4d213a531e45b822a8