Adapt to MacOS system

This commit is contained in:
antao 2018-07-16 18:58:22 +08:00
parent 81515f16fe
commit 8fae7a9749
4 changed files with 16 additions and 7 deletions

View File

@ -2,8 +2,7 @@ cmake_minimum_required (VERSION 2.6)
project (DROGON CXX)
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g' | sed s'/-.*//g'" OUTPUT_VARIABLE version)
MESSAGE(STATUS "This is gcc version:: " ${version})
if(version LESS 4.8.5)
@ -22,7 +21,9 @@ else()
MESSAGE(STATUS "c++17")
endif()
else()
set(CMAKE_CXX_STD_FLAGS c++11)
endif()
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/)
#jsoncpp

View File

@ -18,7 +18,7 @@
#include <drogon/DrClassMap.h>
#include <cxxabi.h>
#include <string>
namespace drogon
{
class DrObjectBase

View File

@ -253,7 +253,7 @@ namespace drogon
}
std::string getHeader(const std::string& field) const
std::string getHeader(const std::string& field) const override
{
std::string result;
std::map<std::string, std::string>::const_iterator it = _headers.find(field);
@ -263,7 +263,7 @@ namespace drogon
return result;
}
std::string getCookie(const std::string& field) const
std::string getCookie(const std::string& field) const override
{
std::string result;
std::map<std::string, std::string>::const_iterator it = _cookies.find(field);

View File

@ -92,7 +92,11 @@ void SharedLibManager::managerLibs()
void *oldHandle= nullptr;
if(_dlMap.find(filename)!=_dlMap.end())
{
#ifdef __linux__
if(st.st_mtim.tv_sec>_dlMap[filename].mTime.tv_sec)
#else
if(st.st_mtimespec.tv_sec>_dlMap[filename].mTime.tv_sec)
#endif
{
LOG_DEBUG<<"new csp file:"<<filename;
oldHandle=_dlMap[filename].handle;
@ -112,7 +116,11 @@ void SharedLibManager::managerLibs()
srcFile.append(".cc");
DLStat dlStat;
dlStat.handle=loadLibs(srcFile,oldHandle);
#ifdef __linux__
dlStat.mTime=st.st_mtim;
#else
dlStat.mTime=st.st_mtimespec;
#endif
if(dlStat.handle)
{
_dlMap[filename]=dlStat;
@ -172,4 +180,4 @@ void* SharedLibManager::loadLibs(const std::string &sourceFile,void *oldHld) {
}
}
return Handle;
}
}