From addb77b5d5c02e9ba8fcbc51c2b7a25a56064e30 Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Tue, 24 Mar 2020 21:41:56 +0800 Subject: [PATCH 1/4] suport tarsnode deploy in domain --- servant/libservant/Application.cpp | 6 ++++-- servant/libservant/EndpointManager.cpp | 20 ++++++++++---------- servant/libservant/StatReport.cpp | 11 ++++++----- servant/libservant/TarsConfig.cpp | 5 +++-- servant/libservant/TarsCurrent.cpp | 14 ++++++++++++-- servant/libservant/TarsLogger.cpp | 8 ++++---- servant/servant/Application.h | 1 + servant/servant/EndpointManager.h | 1 - servant/servant/TarsConfig.h | 2 +- servant/servant/TarsCurrent.h | 6 ++++++ servant/servant/TarsLogger.h | 2 +- 11 files changed, 48 insertions(+), 28 deletions(-) diff --git a/servant/libservant/Application.cpp b/servant/libservant/Application.cpp index 109c2de..6e86a7d 100644 --- a/servant/libservant/Application.cpp +++ b/servant/libservant/Application.cpp @@ -97,6 +97,7 @@ std::string ServerConfig::Key; bool ServerConfig::VerifyClient = false; #endif +map ServerConfig::Context; /////////////////////////////////////////////////////////////////////////////////////////// TC_Config Application::_conf; @@ -475,7 +476,7 @@ bool Application::cmdLoadProperty(const string& command, const string& params, s ServerConfig::Config = _conf.get("/tars/application/server"); - TarsRemoteConfig::getInstance()->setConfigInfo(_communicator, ServerConfig::Config, ServerConfig::Application, ServerConfig::ServerName, ServerConfig::BasePath,setDivision()); + TarsRemoteConfig::getInstance()->setConfigInfo(_communicator, ServerConfig::Config, ServerConfig::Application, ServerConfig::ServerName, ServerConfig::BasePath,setDivision(), 5); ServerConfig::Notify = _conf.get("/tars/application/server"); @@ -1049,6 +1050,7 @@ void Application::initializeServer() ServerConfig::BackPacketLimit = TC_Common::strto(_conf.get("/tars/application/server", "100*1024*1024")); ServerConfig::BackPacketMin = TC_Common::strto(_conf.get("/tars/application/server", "1024")); + ServerConfig::Context["node_name"] = ServerConfig::LocalIp; #if TARS_SSL ServerConfig::CA = _conf.get("/tars/application/server"); ServerConfig::Cert = _conf.get("/tars/application/server"); @@ -1149,7 +1151,7 @@ void Application::initializeServer() /////////////////////////////////////////////////////////////////////////////////////////////////// //初始化到信息中心代理 cout << OUT_LINE << "\n" << TC_Common::outfill("[set remote notify] ") << "OK" << endl; - TarsRemoteNotify::getInstance()->setNotifyInfo(_communicator, ServerConfig::Notify, ServerConfig::Application, ServerConfig::ServerName, setDivision()); + TarsRemoteNotify::getInstance()->setNotifyInfo(_communicator, ServerConfig::Notify, ServerConfig::Application, ServerConfig::ServerName, setDivision(), ServerConfig::LocalIp); /////////////////////////////////////////////////////////////////////////////////////////////////// //初始化到Node的代理 diff --git a/servant/libservant/EndpointManager.cpp b/servant/libservant/EndpointManager.cpp index fbbf2ae..7a74694 100644 --- a/servant/libservant/EndpointManager.cpp +++ b/servant/libservant/EndpointManager.cpp @@ -389,16 +389,16 @@ void QueryEpBase::refreshReg(GetEndpointType type, const string & sName) { case E_ALL: { - iRet = _queryFPrx->findObjectById4Any(_objName,activeEp,inactiveEp); + iRet = _queryFPrx->findObjectById4Any(_objName,activeEp,inactiveEp, ServerConfig::Context); break; } case E_STATION: { - iRet = _queryFPrx->findObjectByIdInSameStation(_objName,sName,activeEp,inactiveEp); + iRet = _queryFPrx->findObjectByIdInSameStation(_objName,sName,activeEp,inactiveEp, ServerConfig::Context); } case E_SET: { - iRet = _queryFPrx->findObjectByIdInSameSet(_objName,sName,activeEp,inactiveEp); + iRet = _queryFPrx->findObjectByIdInSameSet(_objName,sName,activeEp,inactiveEp, ServerConfig::Context); break; } case E_DEFAULT: @@ -408,11 +408,11 @@ void QueryEpBase::refreshReg(GetEndpointType type, const string & sName) { //指定set调用时,指定set的优先级最高 string setId = _invokeSetId.empty()?ClientConfig::SetDivision:_invokeSetId; - iRet = _queryFPrx->findObjectByIdInSameSet(_objName,setId,activeEp,inactiveEp); + iRet = _queryFPrx->findObjectByIdInSameSet(_objName,setId,activeEp,inactiveEp, ServerConfig::Context); } else { - iRet = _queryFPrx->findObjectByIdInSameGroup(_objName,activeEp,inactiveEp); + iRet = _queryFPrx->findObjectByIdInSameGroup(_objName,activeEp,inactiveEp, ServerConfig::Context); } break; } @@ -425,17 +425,17 @@ void QueryEpBase::refreshReg(GetEndpointType type, const string & sName) { case E_ALL: { - _queryFPrx->async_findObjectById4Any(this,_objName); + _queryFPrx->async_findObjectById4Any(this,_objName, ServerConfig::Context); break; } case E_STATION: { - _queryFPrx->async_findObjectByIdInSameStation(this,_objName,sName); + _queryFPrx->async_findObjectByIdInSameStation(this,_objName,sName, ServerConfig::Context); break; } case E_SET: { - _queryFPrx->async_findObjectByIdInSameSet(this,_objName,sName); + _queryFPrx->async_findObjectByIdInSameSet(this,_objName,sName, ServerConfig::Context); break; } case E_DEFAULT: @@ -445,11 +445,11 @@ void QueryEpBase::refreshReg(GetEndpointType type, const string & sName) { //指定set调用时,指定set的优先级最高 string setId = _invokeSetId.empty()?ClientConfig::SetDivision:_invokeSetId; - _queryFPrx->async_findObjectByIdInSameSet(this,_objName,setId); + _queryFPrx->async_findObjectByIdInSameSet(this,_objName,setId, ServerConfig::Context); } else { - _queryFPrx->async_findObjectByIdInSameGroup(this,_objName); + _queryFPrx->async_findObjectByIdInSameGroup(this,_objName, ServerConfig::Context); } break; } diff --git a/servant/libservant/StatReport.cpp b/servant/libservant/StatReport.cpp index a30a023..5fda852 100755 --- a/servant/libservant/StatReport.cpp +++ b/servant/libservant/StatReport.cpp @@ -19,6 +19,7 @@ #include "util/tc_timeprovider.h" #include "servant/TarsLogger.h" #include "servant/Communicator.h" +#include "servant/Application.h" #include namespace tars @@ -36,7 +37,7 @@ StatReport::StatReport(size_t iEpollNum) , _epollNum(iEpollNum) , _retValueNumLimit(10) { - srand(time(NULL)); + srand(time(NULL)); for(size_t i = 0 ; i < _epollNum; i++) { @@ -477,7 +478,7 @@ int StatReport::reportMicMsg(MapStatMicMsg& msg,bool bFromClient) if(_statPrx) { TLOGTARS("[TARS][StatReport::reportMicMsg send size:" << mTemp.size()<<"]"<< endl); - _statPrx->tars_set_timeout(_reportTimeout)->async_reportMicMsg(NULL,mTemp,bFromClient); + _statPrx->tars_set_timeout(_reportTimeout)->async_reportMicMsg(NULL,mTemp,bFromClient, ServerConfig::Context); } iLen = iTemLen; mTemp.clear(); @@ -499,7 +500,7 @@ int StatReport::reportMicMsg(MapStatMicMsg& msg,bool bFromClient) if(_statPrx) { TLOGTARS("[TARS][StatReport::reportMicMsg send size:" << mTemp.size()<<"]"<< endl); - _statPrx->tars_set_timeout(_reportTimeout)->async_reportMicMsg(NULL,mTemp,bFromClient); + _statPrx->tars_set_timeout(_reportTimeout)->async_reportMicMsg(NULL,mTemp,bFromClient, ServerConfig::Context); } } return 0; @@ -690,7 +691,7 @@ int StatReport::reportSampleMsg() if(_statPrx) { TLOGTARS("[TARS][StatReport::reportSampleMsg send size:" << vTemp.size()<< "]"<< endl); - _statPrx->tars_set_timeout(_reportTimeout)->async_reportSampleMsg(NULL,vTemp); + _statPrx->tars_set_timeout(_reportTimeout)->async_reportSampleMsg(NULL,vTemp, ServerConfig::Context); } iLen = iTemLen; vTemp.clear(); @@ -702,7 +703,7 @@ int StatReport::reportSampleMsg() if(_statPrx) { TLOGTARS("[TARS][StatReport::reportSampleMsg send size:" << vTemp.size()<< "]"<< endl); - _statPrx->tars_set_timeout(_reportTimeout)->async_reportSampleMsg(NULL,vTemp); + _statPrx->tars_set_timeout(_reportTimeout)->async_reportSampleMsg(NULL,vTemp, ServerConfig::Context); } } diff --git a/servant/libservant/TarsConfig.cpp b/servant/libservant/TarsConfig.cpp index 40d2ce4..077d17e 100755 --- a/servant/libservant/TarsConfig.cpp +++ b/servant/libservant/TarsConfig.cpp @@ -18,6 +18,7 @@ #include "util/tc_file.h" #include "servant/Communicator.h" #include "servant/TarsNotify.h" +#include "servant/Application.h" #include namespace tars @@ -108,7 +109,7 @@ string TarsRemoteConfig::getRemoteFile(const string &sFileName, bool bAppConfigO { if(_setdivision.empty()) { - ret = _configPrx->loadConfig(_app, (bAppConfigOnly ? "" : _serverName), sFileName, stream); + ret = _configPrx->loadConfig(_app, (bAppConfigOnly ? "" : _serverName), sFileName, stream, ServerConfig::Context); } else { @@ -118,7 +119,7 @@ string TarsRemoteConfig::getRemoteFile(const string &sFileName, bool bAppConfigO confInfo.filename = sFileName; confInfo.bAppOnly = bAppConfigOnly; confInfo.setdivision = _setdivision; - ret = _configPrx->loadConfigByInfo(confInfo,stream); + ret = _configPrx->loadConfigByInfo(confInfo,stream, ServerConfig::Context); } break; diff --git a/servant/libservant/TarsCurrent.cpp b/servant/libservant/TarsCurrent.cpp index 7ab277e..df5e440 100644 --- a/servant/libservant/TarsCurrent.cpp +++ b/servant/libservant/TarsCurrent.cpp @@ -60,10 +60,20 @@ TarsCurrent::~TarsCurrent() } } +const string &TarsCurrent::getHostName() const +{ + auto it = _request.context.find("node_name"); + if(it != _request.context.end()) + { + return it->second; + } + return _data->ip(); + +} + const string &TarsCurrent::getIp() const { - return _data->ip(); - // return _ip; + return _data->ip(); } int TarsCurrent::getPort() const diff --git a/servant/libservant/TarsLogger.cpp b/servant/libservant/TarsLogger.cpp index 41a8454..0669f82 100644 --- a/servant/libservant/TarsLogger.cpp +++ b/servant/libservant/TarsLogger.cpp @@ -84,7 +84,7 @@ void RollWriteT::operator()(ostream &of, const deque > &ds) { try { - _logPrx->logger(DYEING_DIR, DYEING_FILE, "roll", "%Y%m%d", vRemoteDyeing); + _logPrx->logger(DYEING_DIR, DYEING_FILE, "roll", "%Y%m%d", vRemoteDyeing, ServerConfig::Context); } catch(exception &ex) { @@ -254,7 +254,7 @@ void RemoteTimeWriteT::sync2remote(const vector &v) stInfo.sSepar = _timeWrite->_separ; stInfo.sLogType = _timeWrite->_logType; - _timeWrite->_logPrx->loggerbyInfo(stInfo,v); + _timeWrite->_logPrx->loggerbyInfo(stInfo,v, ServerConfig::Context); if (_timeWrite->_reportSuccPtr) { @@ -276,7 +276,7 @@ void RemoteTimeWriteT::sync2remoteDyeing(const vector &v) { try { - _timeWrite->_logPrx->logger(DYEING_DIR, DYEING_FILE, "", _timeWrite->_format, v); + _timeWrite->_logPrx->logger(DYEING_DIR, DYEING_FILE, "", _timeWrite->_format, v, ServerConfig::Context); } catch(exception &ex) { @@ -418,7 +418,7 @@ void TimeWriteT::operator()(ostream &of, const deque > &buf { try { - _logPrx->logger(DYEING_DIR, DYEING_FILE, "day", "%Y%m%d", vDyeingLog); + _logPrx->logger(DYEING_DIR, DYEING_FILE, "day", "%Y%m%d", vDyeingLog, ServerConfig::Context); } catch(exception &ex) { diff --git a/servant/servant/Application.h b/servant/servant/Application.h index a85ac7d..66aca63 100644 --- a/servant/servant/Application.h +++ b/servant/servant/Application.h @@ -140,6 +140,7 @@ struct ServerConfig static std::string Key; static bool VerifyClient; #endif + static map Context; //框架内部用, 传递节点名称(以域名形式部署时) }; class PropertyReport; diff --git a/servant/servant/EndpointManager.h b/servant/servant/EndpointManager.h index f4ff397..84e9e74 100644 --- a/servant/servant/EndpointManager.h +++ b/servant/servant/EndpointManager.h @@ -246,7 +246,6 @@ protected: */ set _inactiveEndpoints; - private: /////////以下是请求主控的策略信息///////////////// diff --git a/servant/servant/TarsConfig.h b/servant/servant/TarsConfig.h index d52f8c8..09b4a5a 100644 --- a/servant/servant/TarsConfig.h +++ b/servant/servant/TarsConfig.h @@ -57,7 +57,7 @@ public: * * @return int */ - int setConfigInfo(const CommunicatorPtr &comm, const string &obj, const string & app, const string &serverName, const string& basePath,const string& setdivision="",int maxBakNum=5); + int setConfigInfo(const CommunicatorPtr &comm, const string &obj, const string & app, const string &serverName, const string& basePath,const string& setdivision="",int maxBakNum = 5); /** * 读取ConfigServer上配置文件到本地,并备份原文件 diff --git a/servant/servant/TarsCurrent.h b/servant/servant/TarsCurrent.h index b59e20e..50335cb 100644 --- a/servant/servant/TarsCurrent.h +++ b/servant/servant/TarsCurrent.h @@ -56,6 +56,12 @@ public: const string &getIp() const; /** + * get host name + * @return + */ + const string &getHostName() const; + + /** * 获取端口 * @return int */ diff --git a/servant/servant/TarsLogger.h b/servant/servant/TarsLogger.h index 2645860..c948f03 100755 --- a/servant/servant/TarsLogger.h +++ b/servant/servant/TarsLogger.h @@ -529,7 +529,7 @@ public: * @param server, 服务名称 * @param logpath, 日志路径 */ - void setLogInfo(const CommunicatorPtr &comm, const string &obj, const string &sApp, const string &sServer, const string &sLogpath,const string& setdivision="", const bool &bLogStatReport = false); + void setLogInfo(const CommunicatorPtr &comm, const string &obj, const string &sApp, const string &sServer, const string &sLogpath,const string& setdivision="", const bool &bLogStatReport=false); /** * 初始化设置时间格式("%Y%m%d") From 3df918dce218e478aac56dbb739e9a7abe9778b4 Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Tue, 24 Mar 2020 21:47:20 +0800 Subject: [PATCH 2/4] fix windows debug/release --- cmake/Common.cmake | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmake/Common.cmake b/cmake/Common.cmake index 410921b..8ac6773 100755 --- a/cmake/Common.cmake +++ b/cmake/Common.cmake @@ -74,11 +74,7 @@ ELSE () ENDIF (UNIX) #------------------------------------------------------------- -IF(WIN32) -set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/tars2cpp.exe") -ELSE() set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp") -ENDIF() message("----------------------------------------------------") From dd2c1549bb37b9032e610c790ee2838ec808d2fd Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Tue, 24 Mar 2020 21:49:16 +0800 Subject: [PATCH 3/4] fix Thirdparty.cmake --- cmake/Thirdparty.cmake | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/cmake/Thirdparty.cmake b/cmake/Thirdparty.cmake index 34ef86d..14b8432 100755 --- a/cmake/Thirdparty.cmake +++ b/cmake/Thirdparty.cmake @@ -74,11 +74,11 @@ if (WIN32) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/gtest + CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/gtest SOURCE_DIR ${CMAKE_BINARY_DIR}/src/gtest-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND cmake --build . --config release - INSTALL_COMMAND cmake --build . --config release --target install + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install # LOG_CONFIGURE 1 # LOG_BUILD 1 URL_MD5 82358affdd7ab94854c8ee73a180fc53 @@ -89,13 +89,13 @@ else() DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/gtest + CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/gtest SOURCE_DIR ${CMAKE_BINARY_DIR}/src/gtest-lib BUILD_IN_SOURCE 1 BUILD_COMMAND make # LOG_CONFIGURE 1 # LOG_BUILD 1 - # INSTALL_COMMAND cmake -P ${RUN_PROTOBUF_INSTALL_FILE} + # INSTALL_COMMAND ${CMAKE_COMMAND} -P ${RUN_PROTOBUF_INSTALL_FILE} URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd ) endif() @@ -122,13 +122,13 @@ if (TARS_PROTOBUF) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/protobuf -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON + CONFIGURE_COMMAND ${CMAKE_COMMAND} cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/protobuf -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND cmake --build . --config release + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release # LOG_CONFIGURE 1 # LOG_BUILD 1 - INSTALL_COMMAND cmake --build . --config release --target install + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install URL_MD5 fb59398329002c98d4d92238324c4187 ) else () @@ -140,13 +140,13 @@ if (TARS_PROTOBUF) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/protobuf -DBUILD_SHARED_LIBS=OFF + CONFIGURE_COMMAND ${CMAKE_COMMAND} cmake -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/protobuf -DBUILD_SHARED_LIBS=OFF SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib BUILD_IN_SOURCE 1 BUILD_COMMAND make # LOG_CONFIGURE 1 # LOG_BUILD 1 - # INSTALL_COMMAND cmake -P ${RUN_PROTOBUF_INSTALL_FILE} + # INSTALL_COMMAND ${CMAKE_COMMAND} -P ${RUN_PROTOBUF_INSTALL_FILE} URL_MD5 fb59398329002c98d4d92238324c4187 ) @@ -200,7 +200,7 @@ if (TARS_SSL) BUILD_COMMAND make # LOG_CONFIGURE 1 # LOG_BUILD 1 - # INSTALL_COMMAND cmake -P ${RUN_SSL_INSTALL_FILE} + # INSTALL_COMMAND ${CMAKE_COMMAND} -P ${RUN_SSL_INSTALL_FILE} URL_MD5 3be209000dbc7e1b95bcdf47980a3baa ) @@ -226,13 +226,13 @@ if (TARS_MYSQL) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/mysql -DBUILD_CONFIG=mysql_release + CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/mysql -DBUILD_CONFIG=mysql_release SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib BUILD_IN_SOURCE 1 - BUILD_COMMAND cmake --build . --config release + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release # LOG_CONFIGURE 1 # LOG_BUILD 1 - INSTALL_COMMAND cmake --build . --config release --target install + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install URL_MD5 62de01beffc48348708c983a585b4dc1 ) @@ -244,13 +244,13 @@ if (TARS_MYSQL) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDISABLE_SHARED=1 + CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DDISABLE_SHARED=1 SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib BUILD_IN_SOURCE 1 BUILD_COMMAND make mysqlclient # LOG_CONFIGURE 1 # LOG_BUILD 1 - # INSTALL_COMMAND cmake --build . --config release --target install + # INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install URL_MD5 98ca2071f9d4c6b73146cc0455f6b914 ) @@ -280,13 +280,13 @@ if (TARS_HTTP2) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON + CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib BUILD_IN_SOURCE 1 # LOG_BUILD 1 # LOG_CONFIGURE 1 - BUILD_COMMAND cmake --build . --config release - INSTALL_COMMAND cmake --build . --config release --target install + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install URL_MD5 5df375bbd532fcaa7cd4044b54b1188d ) @@ -296,7 +296,7 @@ if (TARS_HTTP2) DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download PREFIX ${CMAKE_BINARY_DIR} INSTALL_DIR ${CMAKE_SOURCE_DIR} - CONFIGURE_COMMAND cmake . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON + CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib BUILD_IN_SOURCE 1 # LOG_BUILD 1 From 08228ba58811849e2edbed5168e47bbbc7ed9029 Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Tue, 24 Mar 2020 22:31:26 +0800 Subject: [PATCH 4/4] fix windows deploy, use mysql-tool & fix cmakelist, remote DEBUG/RELEASE --- cmake/Common.cmake | 6 ++++++ tools/CMakeLists.txt | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/Common.cmake b/cmake/Common.cmake index 8ac6773..2f65ba5 100755 --- a/cmake/Common.cmake +++ b/cmake/Common.cmake @@ -14,6 +14,12 @@ ENDIF() set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/lib) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin) +endforeach() set(_USE_OPENTRACKING $ENV{_USE_OPENTRACKING}) if(_USE_OPENTRACKING) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 88d0503..d61f771 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -6,7 +6,12 @@ include_directories(${util_SOURCE_DIR}/include) link_libraries(tarsutil) function(tars2language TARGET) - set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin") + set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin") + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/bin) + endforeach() include_directories(${PROJECT_SOURCE_DIR}/tarsparse)