Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/ketoo/NoahGameFrame into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
ketoo committed Nov 6, 2016
2 parents bd36c32 + 3f972be commit 0f4c784
Show file tree
Hide file tree
Showing 54 changed files with 558 additions and 100 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*.exe
*.out
*.app
*.dll

# Visaul Studio
*.iobj
Expand All @@ -28,6 +29,8 @@
*.log
*.ilk
*.user
*.exp
*.vc.db

# Codeblocks
*.layout
Expand Down
2 changes: 2 additions & 0 deletions Dependencies/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
add_subdirectory(Theron)
add_subdirectory(protobuf)
add_subdirectory(redis-cplusplus-client/msvc/anet_win32)
16 changes: 16 additions & 0 deletions Dependencies/Theron/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
IF( WIN32 )
message("win32_theron")
include_directories(Include)
file(GLOB TEMP_SRC Theron/*.cpp)
add_library(Theron ${TEMP_SRC})
set_target_properties( Theron PROPERTIES OUTPUT_NAME_DEBUG "Theron_d")
set_target_properties( Theron PROPERTIES PREFIX "")
set_target_properties( Theron PROPERTIES
FOLDER "NFDeps"
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
add_definitions(-DTHERON_USE_STD_THREADS -D_X64)
ELSE()
message("not win32")
ENDIF()
13 changes: 13 additions & 0 deletions Dependencies/build_dep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ cp -r -f ./src/.libs/*.so.* ../../_Out/Server/Release/
#cp -r -f ./src/.libs/*.so.* ../lib/
cd ../

# compiling Theron
cd Theron
chmod -R 755 *
make library mode=debug boost=off c++11=on posix=on shared=on
cp -r -f ./Lib/libtherond.a ../lib/Debug/
cp -r -f ./Lib/libtherond.a ../lib/
make clean
make library mode=release boost=off c++11=on posix=on shared=on
cp -r -f ./Lib/libtheron.a ../lib/Release/
cp -r -f ./Lib/libtheron.a ../lib/
make clean
cd ../


# TODO: other libs

Expand Down
3 changes: 2 additions & 1 deletion Dependencies/common/optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class optional
return *((T*)(&m_data));
}

throw std::exception("");
std::logic_error ex("Dependencies/common/optional.hpp::line 72 not init");
throw std::exception(ex);
}

bool operator == (const optional<T>& rhs) const
Expand Down
16 changes: 16 additions & 0 deletions Dependencies/redis-cplusplus-client/msvc/anet_win32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
IF( WIN32 )
message("win32_anet_win64")
aux_source_directory(. DIR_SRCS)

add_library(anet_win64 anet_win32.c)
set_target_properties( anet_win64 PROPERTIES OUTPUT_NAME_DEBUG "anet_win64_d")
set_target_properties( anet_win64 PROPERTIES PREFIX "")
set_target_properties( anet_win64 PROPERTIES
FOLDER "NFDeps"
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
ELSE()
message("not win32")
ENDIF()

1 change: 0 additions & 1 deletion NF.workspace
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<Project filename="NFServer/NFGameServerNet_ClientPlugin/NFGameServerNet_ClientPlugin.cbp" />
<Project filename="NFServer/NFGameServerNet_ServerPlugin/NFGameServerNet_ServerPlugin.cbp" />

<Project filename="NFServer/NFWorldLogicPlugin/NFWorldLogicPlugin.cbp" />
<Project filename="NFServer/NFWorldNet_ClientPlugin/NFWorldNet_ClientPlugin.cbp" />
<Project filename="NFServer/NFWorldNet_ServerPlugin/NFWorldNet_ServerPlugin.cbp" />

Expand Down
15 changes: 5 additions & 10 deletions NFComm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@

add_subdirectory(NFCore)

add_subdirectory(NFActorPlugin)
add_subdirectory(NFConfigPlugin)

add_subdirectory(NFPluginLoader)

add_subdirectory(NFCore)
add_subdirectory(NFKernelPlugin)

add_subdirectory(NFLogPlugin)

add_subdirectory(NFMessageDefine)

add_subdirectory(NFNet)
add_subdirectory(NFNet)
add_subdirectory(NFNoSqlPlugin)
add_subdirectory(NFPluginLoader)
41 changes: 41 additions & 0 deletions NFComm/NFActorPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
set(ProjectName "NFActorPlugin")
file(GLOB NFActorPlugin_ROOT_Cpp *.cpp)
file(GLOB NFActorPlugin_ROOT_CC *.cc)
file(GLOB NFActorPlugin_ROOT_Hpp *.h)

add_library(NFActorPlugin SHARED
${NFActorPlugin_ROOT_Cpp}
${NFActorPlugin_ROOT_CC}
${NFActorPlugin_ROOT_Hpp})

if(UNIX)
if (CMAKE_BUILD_TYPE MATCHES "Release")
target_link_libraries(NFActorPlugin libtheron.a)
else()
target_link_libraries(NFActorPlugin libtherond.a)
endif()
add_definitions(
-D_USRDLL
-D_LIB
-DPROTOBUF_USE_DLLS
-DNFDATABASEPLUGIN_EXPORTS
-DWIN32_LEAN_AND_MEAN
)
else()
add_dependencies(NFActorPlugin libprotobuf NFMessageDefine)
target_link_libraries(NFActorPlugin anet_win64 libprotobuf Theron NFMessageDefine)
add_definitions(
-D_USRDLL
-D_LIB
-DPROTOBUF_USE_DLLS
-DNFDATABASEPLUGIN_EXPORTS
-DWIN32_LEAN_AND_MEAN
)
endif()
set_target_properties( NFActorPlugin PROPERTIES OUTPUT_NAME_DEBUG "NFActorPlugin_d")
set_target_properties( NFActorPlugin PROPERTIES PREFIX "")
set_target_properties( NFActorPlugin PROPERTIES
FOLDER "NFSDK"
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
6 changes: 3 additions & 3 deletions NFComm/NFNet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ set_target_properties( NFNet PROPERTIES OUTPUT_NAME_DEBUG "NFNet_d")
set_target_properties( NFNet PROPERTIES PREFIX "")
set_target_properties( NFNet PROPERTIES
FOLDER "NFSDK"
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/_Out/Comm/
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/_Out/Comm/
LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/_Out/Comm/ )
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir})
if(UNIX)
if (CMAKE_BUILD_TYPE MATCHES "Release")
target_link_libraries(NFNet )
Expand Down
44 changes: 44 additions & 0 deletions NFComm/NFNoSqlPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
set(ProjectName "NFNoSqlPlugin")
file(GLOB NFNoSqlPlugin_ROOT_Cpp *.cpp)
file(GLOB NFNoSqlPlugin_ROOT_CC *.cc)
file(GLOB NFNoSqlPlugin_ROOT_Hpp *.h)

if(UNIX)
add_library(NFNoSqlPlugin SHARED
${NFNoSqlPlugin_ROOT_Cpp}
${NFNoSqlPlugin_ROOT_CC}
${NFNoSqlPlugin_ROOT_Hpp}
${SolutionDir}/Dependencies/redis-cplusplus-client/anet.c
${SolutionDir}/Dependencies/redis-cplusplus-client/anet.h)
target_include_directories(NFNoSqlPlugin PUBLIC
${SolutionDir}/Dependencies/redis-cplusplus-client/)
if (CMAKE_BUILD_TYPE MATCHES "Release")
target_link_libraries(NFNoSqlPlugin libtheron.a)
else()
target_link_libraries(NFNoSqlPlugin libtherond.a)
endif()
add_definitions(
-D_USRDLL
-DTHERON_CPP11
)
else()
add_library(NFNoSqlPlugin SHARED
${NFNoSqlPlugin_ROOT_Cpp}
${NFNoSqlPlugin_ROOT_CC}
${NFNoSqlPlugin_ROOT_Hpp})
target_include_directories(NFNoSqlPlugin PUBLIC
${SolutionDir}/Dependencies/redis-cplusplus-client/msvc/anet_win32/)
add_dependencies(NFNoSqlPlugin libprotobuf NFMessageDefine)
target_link_libraries(NFNoSqlPlugin anet_win64 libprotobuf Theron NFMessageDefine)
add_definitions(
-D_USRDLL
-DTHERON_CPP11
)
endif()
set_target_properties( NFNoSqlPlugin PROPERTIES OUTPUT_NAME_DEBUG "NFNoSqlPlugin_d")
set_target_properties( NFNoSqlPlugin PROPERTIES PREFIX "")
set_target_properties( NFNoSqlPlugin PROPERTIES
FOLDER "NFSDK"
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
17 changes: 12 additions & 5 deletions NFComm/NFPluginLoader/NFPluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,27 @@ std::string strArgvList;
std::string strPluginName;
std::string strAppName;
std::string strAppID;
std::string strTitleName;

#if NF_PLATFORM == NF_PLATFORM_WIN

#pragma comment( lib, "DbgHelp" )
// ����Dump�ļ�

void CreateDumpFile(const std::string& strDumpFilePathName, EXCEPTION_POINTERS* pException)
{
// ����Dump�ļ�
//Dump
HANDLE hDumpFile = CreateFile(strDumpFilePathName.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

// Dump��Ϣ
MINIDUMP_EXCEPTION_INFORMATION dumpInfo;
dumpInfo.ExceptionPointers = pException;
dumpInfo.ThreadId = GetCurrentThreadId();
dumpInfo.ClientPointers = TRUE;

// д��Dump�ļ�����
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpNormal, &dumpInfo, NULL, NULL);

CloseHandle(hDumpFile);
}

// ����Unhandled Exception�Ļص�����
long ApplicationCrashHandler(EXCEPTION_POINTERS* pException)
{
time_t t = time(0);
Expand Down Expand Up @@ -220,6 +218,15 @@ void ProcessParameter(int argc, char* argv[])
}
}

strTitleName = strAppName + strAppID;// +" PID" + NFGetPID();
strTitleName.replace(strTitleName.find("Server"), 6, "");
strTitleName = "NF" + strTitleName;
#if NF_PLATFORM == NF_PLATFORM_WIN
SetConsoleTitle(strTitleName.c_str());
#else
prctl(PR_SET_NAME, strTitleName.c_str());
//setproctitle(strTitleName.c_str());
#endif
}

int main(int argc, char* argv[])
Expand Down
14 changes: 10 additions & 4 deletions NFComm/NFPluginModule/NFPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,23 @@ typedef int64_t NFINT64;
//#define GOOGLE_GLOG_DLL_DECL=

///////////////////////////////////////////////////////////////
#include <string>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <sstream>
#include <stdio.h>
#include <common/lexical_cast.hpp>

#ifndef _MSC_VER
#include <sys/time.h>
#include <unistd.h>
#include <sys/prctl.h>
#define EPOCHFILETIME 11644473600000000ULL
#else
#include <windows.h>
#include <time.h>
#include <process.h>
#define EPOCHFILETIME 11644473600000000Ui64
#endif

Expand All @@ -290,10 +297,12 @@ typedef int64_t NFINT64;
#define NFSPRINTF sprintf_s
#define NFSTRICMP stricmp
#define NFSLEEP(s) Sleep(s)
#define NFGetPID() lexical_cast<std::string>(getpid())
#else
#define NFSPRINTF snprintf
#define NFSTRICMP strcasecmp
#define NFSLEEP(s) usleep(s)
#define NFGetPID() lexical_cast<std::string>(getpid())
#endif

#ifndef NF_DYNAMIC_PLUGIN
Expand Down Expand Up @@ -326,10 +335,7 @@ typedef int64_t NFINT64;
#define NF_SHARE_PTR std::shared_ptr
#define NF_NEW new

#include <string>
#include <algorithm>
#include <cmath>
#include <common/lexical_cast.hpp>

template<typename DTYPE>
bool NF_StrTo(const std::string& strValue, DTYPE& nValue)
{
Expand Down
17 changes: 3 additions & 14 deletions NFServer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_subdirectory(NFDataAgent_NosqlPlugin)
add_subdirectory(NFGameLogicPlugin)
add_subdirectory(NFGameServerNet_ClientPlugin)
add_subdirectory(NFGameServerNet_ServerPlugin)
add_subdirectory(NFGameServerPlugin)
Expand All @@ -11,17 +13,4 @@ add_subdirectory(NFProxyServerNet_ServerPlugin)
add_subdirectory(NFProxyLogicPlugin)
add_subdirectory(NFWorldLogicPlugin)
add_subdirectory(NFWorldNet_ClientPlugin)
add_subdirectory(NFWorldNet_ServerPlugin)













add_subdirectory(NFWorldNet_ServerPlugin)
32 changes: 32 additions & 0 deletions NFServer/NFDataAgent_NosqlPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
set(ProjectName "NFDataAgent_NosqlPlugin")
file(GLOB NFDataAgent_NosqlPlugin_ROOT_Cpp
*.cpp)

file(GLOB NFDataAgent_NosqlPlugin_ROOT_Hpp
*.h)

add_library(NFDataAgent_NosqlPlugin SHARED
${NFDataAgent_NosqlPlugin_ROOT_Cpp}
${NFDataAgent_NosqlPlugin_ROOT_Hpp})

set_target_properties( NFDataAgent_NosqlPlugin PROPERTIES OUTPUT_NAME_DEBUG "NFDataAgent_NosqlPlugin_d")
set_target_properties( NFDataAgent_NosqlPlugin PROPERTIES PREFIX "")
set_target_properties( NFDataAgent_NosqlPlugin PROPERTIES
FOLDER "NFServer/GameServer"
ARCHIVE_OUTPUT_DIRECTORY ${NFOutPutDir}
RUNTIME_OUTPUT_DIRECTORY ${NFOutPutDir}
LIBRARY_OUTPUT_DIRECTORY ${NFOutPutDir} )
link_NFSDK("NFDataAgent_NosqlPlugin")

if(UNIX)
add_definitions(
-D_USRDLL
-DELPP_NO_DEFAULT_LOG_FILE
)
else()
add_definitions(
-DWIN
-D_USRDLL
-DELPP_NO_DEFAULT_LOG_FILE
)
endif()
Loading

0 comments on commit 0f4c784

Please sign in to comment.