From a27bd57c6ebe1a9035614c7b8999c34d0c1013aa Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 16 Dec 2019 19:56:14 +0800 Subject: [PATCH] 1 --- server/bin/monitor.sh | 1 + server/bin/monitor_game2002.py | 30 ------------- server/gameserver/CMakeLists.txt | 74 ++++++++++++++++++++++---------- third_party/behaviac | 2 +- 4 files changed, 54 insertions(+), 53 deletions(-) create mode 100644 server/bin/monitor.sh delete mode 100644 server/bin/monitor_game2002.py diff --git a/server/bin/monitor.sh b/server/bin/monitor.sh new file mode 100644 index 0000000..8a98205 --- /dev/null +++ b/server/bin/monitor.sh @@ -0,0 +1 @@ +python ../../third_party/tools/scripts/server/monitor.py gameserver2001 '-n1 -i1' diff --git a/server/bin/monitor_game2002.py b/server/bin/monitor_game2002.py deleted file mode 100644 index 76509a3..0000000 --- a/server/bin/monitor_game2002.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -import os -import time - -def getRuningProgramPids(progname): - pids = [] - lines = os.popen('ps -ef | grep %s' % progname).readlines() - for l in lines: - line = '' - oldc = '' - for c in l.strip(): - if c in [' ', '\t'] and c == oldc: - continue - oldc = c - line += c - line = line.split(' ') - - if line[7] == './%s' % progname: - pids.append(line[1]) - return pids - -def monitor_gs(): - while True: - pids = getRuningProgramPids('gameserver2002') - if len(pids) <= 0: - print('zzzz') - os.popen('nohup ./gameserver2002 -n1 -i1 -f1,2,4>> gameserver2002.out 2>&1 &') - time.sleep(2) - -monitor_gs() diff --git a/server/gameserver/CMakeLists.txt b/server/gameserver/CMakeLists.txt index cd49868..bc6d026 100644 --- a/server/gameserver/CMakeLists.txt +++ b/server/gameserver/CMakeLists.txt @@ -3,10 +3,15 @@ cmake_minimum_required(VERSION 2.8) set(GAME_ID 2002) -set(CMAKE_BUILD_TYPE "Debug") -#set(CMAKE_BUILD_TYPE "Release") -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -std=gnu++11 -DGAME_ID=${GAME_ID}") -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}") +if (${RELEASE}) + set(CMAKE_BUILD_TYPE "Release") + message("release mode") +else() + set(CMAKE_BUILD_TYPE "Debug") + message("debug mode") +endif() +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DNDEBUG") +set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DDEBUG") include_directories( AFTER @@ -19,6 +24,7 @@ include_directories( ../../third_party ../../third_party/behaviac/inc ../../third_party/recastnavigation/Detour/Include + ../../third_party/recastnavigation/DetourTileCache/Include . ) @@ -40,6 +46,9 @@ aux_source_directory(../../third_party/recastnavigation/Detour/Source SRC_LIST ) +aux_source_directory(../../third_party/recastnavigation/DetourTileCache/Source + SRC_LIST +) execute_process( COMMAND touch -a cs_proto.pb.h @@ -62,7 +71,7 @@ set(EXECUTABLE_OUTPUT_PATH ) add_executable( - gameserver ${SRC_LIST} + gameserver${GAME_ID} ${SRC_LIST} ) add_custom_target(script_pb_protocol ALL) @@ -70,21 +79,42 @@ add_custom_command(TARGET script_pb_protocol PRE_BUILD COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=cs_proto,cs_msgid,ss_proto,ss_msgid,metatable --python_out=../tools/robot/virtualclient ) -add_dependencies(gameserver script_pb_protocol) +add_dependencies(gameserver${GAME_ID} script_pb_protocol) -target_link_libraries( - gameserver - pthread - mysqlclient - protobuf - rt - dl - util - crypto - ssl - jsoncpp - curl - hiredis - tinyxml2 - behaviac_gcc_release -) +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + target_link_libraries( + gameserver${GAME_ID} + pthread + mysqlclient + protobuf + rt + dl + util + crypto + ssl + jsoncpp + curl + hiredis + tinyxml2 + tcmalloc + behaviac_gcc_debug + ) +else() + target_link_libraries( + gameserver${GAME_ID} + pthread + mysqlclient + protobuf + rt + dl + util + crypto + ssl + jsoncpp + curl + hiredis + tinyxml2 + tcmalloc + behaviac_gcc_release + ) +endif() diff --git a/third_party/behaviac b/third_party/behaviac index b9f2f20..2404145 160000 --- a/third_party/behaviac +++ b/third_party/behaviac @@ -1 +1 @@ -Subproject commit b9f2f205afe3226fa06b6a3b9e62fcd6eaca63b8 +Subproject commit 240414570ee2848291d24ff8d3102dc43d4104a3