This commit is contained in:
azw 2023-11-11 13:39:55 +00:00
parent 816b1aedf2
commit eda56a2ca6
4 changed files with 21 additions and 8 deletions

View File

@ -78,7 +78,7 @@ set(EXECUTABLE_OUTPUT_PATH
) )
add_executable( add_executable(
wsproxy${GAME_ID} ${SRC_LIST} wsproxy ${SRC_LIST}
) )
add_custom_target(script_pb_protocol ALL) add_custom_target(script_pb_protocol ALL)
@ -86,10 +86,10 @@ add_custom_command(TARGET script_pb_protocol
PRE_BUILD PRE_BUILD
COMMAND python ../tools/scripts/construct/build_pb.py COMMAND python ../tools/scripts/construct/build_pb.py
) )
add_dependencies(wsproxy${GAME_ID} script_pb_protocol) add_dependencies(wsproxy script_pb_protocol)
target_link_libraries( target_link_libraries(
wsproxy${GAME_ID} wsproxy
pthread pthread
mysqlclient mysqlclient
protobuf protobuf
@ -106,12 +106,12 @@ target_link_libraries(
if (CMAKE_BUILD_TYPE STREQUAL "Debug") if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_link_libraries( target_link_libraries(
wsproxy${GAME_ID} wsproxy
behaviac_gcc_debug behaviac_gcc_debug
) )
else() else()
target_link_libraries( target_link_libraries(
wsproxy${GAME_ID} wsproxy
tcmalloc tcmalloc
behaviac_gcc_release behaviac_gcc_release
) )

View File

@ -84,7 +84,7 @@ static void SavePerfLog()
const std::string App::GetPkgName() const std::string App::GetPkgName()
{ {
return a8::Format("game%d_wsproxy", {GAME_ID}); return a8::Format("game%d_wsproxy", {App::Instance()->GetGameId()});
} }
void App::Init() void App::Init()
@ -496,3 +496,14 @@ void App::DispatchUdpMsg()
udp_working_msgnode_size_ = 0; udp_working_msgnode_size_ = 0;
} }
} }
int App::GetGameId() const
{
#ifdef DEBUG
std::string game_id = a8::XValue(getenv("_")).GetString();
a8::ReplaceString(game_id, "./wsproxy", "");
return a8::XValue(game_id);
#else
return GAME_ID;
#endif
}

View File

@ -40,6 +40,8 @@ public:
int GetMsgNodeSize() { return msgnode_size_;} int GetMsgNodeSize() { return msgnode_size_;}
int GetUdpMsgNodeSize() { return udp_msgnode_size_;} int GetUdpMsgNodeSize() { return udp_msgnode_size_;}
int GetGameId() const;
private: private:
void QuickExecute(); void QuickExecute();
void SlowerExecute(); void SlowerExecute();

View File

@ -12,9 +12,9 @@ void JsonDataMgr::Init()
{ {
if (!f8::IsOnlineEnv()) { if (!f8::IsOnlineEnv()) {
if (f8::IsTestEnv()) { if (f8::IsTestEnv()) {
work_path_ = a8::Format("../%d_test_config", {GAME_ID}); work_path_ = a8::Format("../%d_test_config", {App::Instance()->GetGameId()});
} else { } else {
work_path_ = a8::Format("../%d_dev_config", {GAME_ID}); work_path_ = a8::Format("../%d_dev_config", {App::Instance()->GetGameId()});
} }
} }