a c++ server framework for mobile game which uses tinynet,google protobuf,mongodb and so on.
download or git from github:
$git clone [email protected]:yuyunliuhen/easy.git
$git clone [email protected]:yuyunliuhen/tinynet.git
$git clone [email protected]:yuyunliuhen/server_framework.git
(1) compiler or install boost
download from boost binaries: http://sourceforge.net/projects/boost/files/boost-binaries/, recommend 1.53 if you use vs2012.
(2) install scons
download from http://www.scons.org/download.php, the latest version is 2.3.3
(3) compiler mongodb c++ driver
git clone https://github.com/mongodb/mongo-cxx-driver.git (current latest stable version is 26compat) .
$cd easy/dep/mongo-cxx-driver, excute command at cmd:
scons --cpppath="C:\local\boost_1_53_0" --libpath="C:\local\boost_1_53_0\lib64-msvc-11.0" --64 --sharedclient --dynamic-windows --dbg=on
more detail:
mongodb windows
(4) compiler jansson
open easy/dep/jansson/win32/vs2012/jansson.sln and compiler it
(4) compiler protobuf
open easy/dep/protobufvsprojects/protobuf.sln and compiler it
(6) compile server framework
general proto files first, if not call this file, error will be happend when compiler later
general_proto_64.bat
use windwos command tools:VS2012 x64 Cross Tools Command Prompt
cmake -G "Visual Studio 11 Win64" .
msbuild.exe ALL_BUILD.vcxproj
(1) compile boost
download from boost:http://www.boost.org/
$tar zxvf boost_1_49_0.tar.gz
$cd boost_1_49_0
$./bootstrap.sh
$./b2 install
(2) compiler scons for mongodb cxx driver
download from scons:http://www.scons.org/
$tar zxvf scons-2.3.3.tar.gz
$cd scons-2.3.3 & python setup.py install
(3) compiler protobuf
$cd easy/dep/protobuf
$./configure & make
more detail:
google protobuf
(4) compiler jansson
$cd easy/dep/jansson
$./configure & make
(5) compiler mongodb
$cd .. & cd mongo-cxx-driver
$scons all (if you install boost is not default,you can use like this:scons --cpppath="/home/lee/install/include" --libpath="/home/lee/install/lib")
more detail:
mongodb linux
(6) compile server framework
$cd server_framework
$cmake . ( if you want to debug ,you should do cmake -DCMAKE_BUILD_TYPE=Debug .
$make
excute build_x64/x86.bat at windows(visual studio 2012 or later ) or build.sh at linux(gcc 4.8.1 or later ).
all dependency static/dynamic library and exe are build and place at dep directory, that is to say,protobuf,mongodb,protobuf is compiler ok,you can use it directly.
you can find file at config directory. it looks like that:
add or remove core/proxy server if you want.
set environment:
and then
$./bin/core 192.168.20.135 8881
$./bin/core 192.168.20.135 8882
$./bin/proxy 192.168.20.135 8871
$./bin/proxy 192.168.20.135 8872
$./bin/login 192.168.20.135 8861
test:
$./bin/test_client 192.168.20.135 8861