添加debug模式

This commit is contained in:
aozhiwei 2019-09-18 14:37:01 +08:00
parent 59541f5bb7
commit 45f2074288
3 changed files with 16 additions and 6 deletions

View File

@ -3,10 +3,15 @@ cmake_minimum_required(VERSION 2.8)
set(GAME_ID 2001) set(GAME_ID 2001)
set(CMAKE_BUILD_TYPE "Debug") if (${RELEASE})
set(CMAKE_BUILD_TYPE "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}") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DDEBUG")
include_directories( include_directories(
AFTER AFTER

View File

@ -186,12 +186,17 @@ bool App::Init(int argc, char* argv[])
} }
return false; return false;
} }
a8::XPrintf("gameserver starting node_id: %d instance_id:%d pid:%d game_id:%d\n", int debug_mode = 0;
#ifdef DEBUG
debug_mode = 1;
#endif
a8::XPrintf("gameserver starting node_id: %d instance_id:%d pid:%d game_id:%d debug_mode:%d\n",
{ {
node_id, node_id,
instance_id, instance_id,
getpid(), getpid(),
GAME_ID GAME_ID,
debug_mode
}); });
loop_mutex_ = new std::mutex(); loop_mutex_ = new std::mutex();

View File

@ -1,6 +1,6 @@
cd third_party/game2001/server/gameserver cd third_party/game2001/server/gameserver
#python ../tools/scripts/construct/build_pb.py --nohooks 1 #python ../tools/scripts/construct/build_pb.py --nohooks 1
cmake $1 . cmake -DRELEASE=1 .
make clean make clean
make make
cp ../bin/gameserver ../../../../bin/ cp ../bin/gameserver ../../../../bin/