mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-11-30 02:37:57 +08:00
Add support for MSVC 2015 (#365)
Co-authored-by: An Tao <antao2002@gmail.com>
This commit is contained in:
parent
53f61e9b66
commit
d5cd882248
@ -155,11 +155,11 @@ if(NOT WIN32)
|
|||||||
message(FATAL_ERROR "uuid lib error")
|
message(FATAL_ERROR "uuid lib error")
|
||||||
endif()
|
endif()
|
||||||
endif(NOT WIN32)
|
endif(NOT WIN32)
|
||||||
if(NOT MSVC)
|
if(NOT MSVC OR NOT BUILD_ORM)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
target_include_directories(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIR})
|
target_include_directories(${PROJECT_NAME} PRIVATE ${ZLIB_INCLUDE_DIR})
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${ZLIB_LIBRARIES})
|
||||||
endif(NOT MSVC)
|
endif(NOT MSVC OR NOT BUILD_ORM)
|
||||||
|
|
||||||
set(DROGON_SOURCES
|
set(DROGON_SOURCES
|
||||||
lib/src/AOPAdvice.cc
|
lib/src/AOPAdvice.cc
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
# DROGON_INCLUDE_DIRS - include directories for Drogon
|
# DROGON_INCLUDE_DIRS - include directories for Drogon
|
||||||
# DROGON_LIBRARIES - libraries to link against
|
# DROGON_LIBRARIES - libraries to link against
|
||||||
# DROGON_EXECUTABLE - the drogon_ctl executable
|
# DROGON_EXECUTABLE - the drogon_ctl executable
|
||||||
# DROGON_FOUND
|
# Drogon_FOUND
|
||||||
# This module defines the following IMPORTED target:
|
# This module defines the following IMPORTED target:
|
||||||
# Drogon::Drogon
|
# Drogon::Drogon
|
||||||
|
|
||||||
@PACKAGE_INIT@
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
if(NOT TRANTOR_FOUND)
|
if(NOT Trantor_FOUND)
|
||||||
# find trantor
|
# find trantor
|
||||||
find_package(Trantor REQUIRED)
|
find_package(Trantor CONFIG REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||||
@ -24,4 +24,3 @@ endif()
|
|||||||
get_target_property(DROGON_INCLUDE_DIRS Drogon::Drogon INTERFACE_INCLUDE_DIRECTORIES)
|
get_target_property(DROGON_INCLUDE_DIRS Drogon::Drogon INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
set(DROGON_LIBRARIES Drogon::Drogon)
|
set(DROGON_LIBRARIES Drogon::Drogon)
|
||||||
set(DROGON_EXECUTABLE drogon_ctl)
|
set(DROGON_EXECUTABLE drogon_ctl)
|
||||||
set(DROGON_FOUND TRUE)
|
|
||||||
|
@ -58,11 +58,11 @@ HttpRequestPtr toRequest(T &&)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
HttpRequestPtr toRequest(const Json::Value &pJson);
|
HttpRequestPtr toRequest<const Json::Value &>(const Json::Value &pJson);
|
||||||
template <>
|
template <>
|
||||||
HttpRequestPtr toRequest(Json::Value &&pJson);
|
HttpRequestPtr toRequest(Json::Value &&pJson);
|
||||||
template <>
|
template <>
|
||||||
inline HttpRequestPtr toRequest(Json::Value &pJson)
|
inline HttpRequestPtr toRequest<Json::Value &>(Json::Value &pJson)
|
||||||
{
|
{
|
||||||
return toRequest((const Json::Value &)pJson);
|
return toRequest((const Json::Value &)pJson);
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ class HttpRequest
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline HttpRequestPtr toRequest(const Json::Value &pJson)
|
inline HttpRequestPtr toRequest<const Json::Value &>(const Json::Value &pJson)
|
||||||
{
|
{
|
||||||
return HttpRequest::newHttpJsonRequest(pJson);
|
return HttpRequest::newHttpJsonRequest(pJson);
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,11 @@ HttpResponsePtr toResponse(T &&)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
HttpResponsePtr toResponse(const Json::Value &pJson);
|
HttpResponsePtr toResponse<const Json::Value &>(const Json::Value &pJson);
|
||||||
template <>
|
template <>
|
||||||
HttpResponsePtr toResponse(Json::Value &&pJson);
|
HttpResponsePtr toResponse(Json::Value &&pJson);
|
||||||
template <>
|
template <>
|
||||||
inline HttpResponsePtr toResponse(Json::Value &pJson)
|
inline HttpResponsePtr toResponse<Json::Value &>(Json::Value &pJson)
|
||||||
{
|
{
|
||||||
return toResponse((const 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;
|
virtual void setBody(const char *body, size_t len) = 0;
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
inline HttpResponsePtr toResponse(const Json::Value &pJson)
|
inline HttpResponsePtr toResponse<const Json::Value &>(const Json::Value &pJson)
|
||||||
{
|
{
|
||||||
return HttpResponse::newHttpJsonResponse(pJson);
|
return HttpResponse::newHttpJsonResponse(pJson);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class HttpFile
|
|||||||
/// Return the file content.
|
/// Return the file content.
|
||||||
char *fileData() noexcept
|
char *fileData() noexcept
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201703L | defined _WIN32
|
#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
|
||||||
return fileContent_.data();
|
return fileContent_.data();
|
||||||
#else
|
#else
|
||||||
return (char *)(fileContent_.data());
|
return (char *)(fileContent_.data());
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#if __cplusplus >= 201703L | defined _WIN32
|
#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
|
||||||
#include <any>
|
#include <any>
|
||||||
#else
|
#else
|
||||||
#include <boost/any.hpp>
|
#include <boost/any.hpp>
|
||||||
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
namespace drogon
|
namespace drogon
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201703L | defined _WIN32
|
#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
|
||||||
using std::any;
|
using std::any;
|
||||||
using std::any_cast;
|
using std::any_cast;
|
||||||
#else
|
#else
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#if __cplusplus >= 201703L | defined _WIN32
|
#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#else
|
#else
|
||||||
#include <boost/utility/string_view.hpp>
|
#include <boost/utility/string_view.hpp>
|
||||||
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
namespace drogon
|
namespace drogon
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201703L | defined _WIN32
|
#if __cplusplus >= 201703L || (defined _MSC_VER && _MSC_VER > 1900)
|
||||||
using std::string_view;
|
using std::string_view;
|
||||||
#else
|
#else
|
||||||
using boost::string_view;
|
using boost::string_view;
|
||||||
|
@ -87,11 +87,14 @@ HttpAppFrameworkImpl::HttpAppFrameworkImpl()
|
|||||||
uploadPath_(rootPath_ + "uploads")
|
uploadPath_(rootPath_ + "uploads")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::function<void()> 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.
|
/// Make sure that the main event loop is initialized in the main thread.
|
||||||
drogon::InitBeforeMainFunction drogon::HttpAppFrameworkImpl::initFirst_([]() {
|
drogon::InitBeforeMainFunction drogon::HttpAppFrameworkImpl::initFirst_([]() {
|
||||||
HttpAppFrameworkImpl::instance().getLoop()->runInLoop([]() {
|
HttpAppFrameworkImpl::instance().getLoop()->runInLoop(f);
|
||||||
LOG_TRACE << "Initialize the main event loop in the main thread";
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
namespace drogon
|
namespace drogon
|
||||||
|
@ -115,7 +115,7 @@ class ConstReverseResultIterator : private ConstResultIterator
|
|||||||
using iterator_type::iterator_category;
|
using iterator_type::iterator_category;
|
||||||
using iterator_type::pointer;
|
using iterator_type::pointer;
|
||||||
using iterator_type::reference;
|
using iterator_type::reference;
|
||||||
using iterator_type::value_type;
|
// using iterator_type::value_type;
|
||||||
|
|
||||||
ConstReverseResultIterator(const ConstReverseResultIterator &rhs)
|
ConstReverseResultIterator(const ConstReverseResultIterator &rhs)
|
||||||
: ConstResultIterator(rhs)
|
: ConstResultIterator(rhs)
|
||||||
|
@ -111,7 +111,7 @@ class ConstReverseRowIterator : private ConstRowIterator
|
|||||||
using iterator_type::iterator_category;
|
using iterator_type::iterator_category;
|
||||||
using iterator_type::pointer;
|
using iterator_type::pointer;
|
||||||
using iterator_type::reference;
|
using iterator_type::reference;
|
||||||
using iterator_type::value_type;
|
// using iterator_type::value_type;
|
||||||
|
|
||||||
ConstReverseRowIterator(const ConstReverseRowIterator &rhs)
|
ConstReverseRowIterator(const ConstReverseRowIterator &rhs)
|
||||||
: ConstRowIterator(rhs)
|
: ConstRowIterator(rhs)
|
||||||
|
2
trantor
2
trantor
@ -1 +1 @@
|
|||||||
Subproject commit b152c54b1fd36c04fde8b400f5637617962260c9
|
Subproject commit e052988f277d039e3392bd4d213a531e45b822a8
|
Loading…
Reference in New Issue
Block a user