forked from ketoo/NoahGameFrame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (81 loc) · 2.79 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
set_property(GLOBAL PROPERTY USE_FOLDERS On)
option(BUILD_TOOLS_ONLY "help string describing option")
cmake_minimum_required(VERSION 3.1)
macro(remove_file arg_list file_remove)
file(GLOB RemoveItems_Cpp ${file_remove})
list(REMOVE_ITEM ${arg_list} ${RemoveItems_Cpp})
endmacro(remove_file)
macro(link_NFSDK projName)
if(UNIX)
add_dependencies(${projName} NFNet NFCore NFMessageDefine)
target_link_libraries(${projName} NFCore protobuf NFMessageDefine NFNet event event_core)
else()
add_dependencies(${projName} NFNet NFCore NFMessageDefine)
target_link_libraries(${projName} NFCore)
endif()
endmacro(link_NFSDK)
macro(add_post_cmd_win strProjectName destDir ext dbgSuffix)
endmacro()
macro(add_post_cmd_linux strProjectName destDir ext dbgSuffix dllPrefix)
endmacro()
project(NoahFrame)
set(SolutionDir ${PROJECT_SOURCE_DIR})
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set(NFOutPutDir ${PROJECT_SOURCE_DIR}/_Out/Debug)
else()
set(NFOutPutDir ${PROJECT_SOURCE_DIR}/_Out/Release)
endif()
else()
set(NFOutPutDir ${PROJECT_SOURCE_DIR}/_Out/)
endif()
# message(STATUS "SolutionDir=" ${SolutionDir})
include_directories(
${SolutionDir}
${SolutionDir}/Dependencies/
${SolutionDir}/Dependencies/Theron/Include/
${SolutionDir}/Dependencies/Theron/Include/External/
${SolutionDir}/Dependencies/protobuf/
${SolutionDir}/Dependencies/protobuf/src/
${SolutionDir}/Dependencies/libevent/
${SolutionDir}/Dependencies/libevent/include/
${SolutionDir}/Dependencies/libevent/compat/
${SolutionDir}/Dependencies/lua/
)
#message("Build Type:"${CMAKE_BUILD_TYPE} ${CMAKE_CXX_FLAGS})
if(UNIX)
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O0 -Wall -g -ggdb -DDEBUG -fPIC")
else()
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++11 -O3 -Wall")
endif()
set(LDFLAGS "$ENV{LDFLAGS} -stdlib=libc++")
add_definitions(-std=c++11)
else()
SET ( CMAKE_CXX_FLAGS "-D_X64 -D_WINDOWS /EHsc" )
include_directories(${SolutionDir}/Dependencies/libevent/WIN32-Code/)
endif()
if(UNIX)
if( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set(DependenciesLibPath ${SolutionDir}/Dependencies/lib ${SolutionDir}/_Out/Debug/)
else()
set(DependenciesLibPath ${SolutionDir}/Dependencies/lib ${SolutionDir}/_Out/Release/)
endif()
else()
set(DependenciesLibPath ${SolutionDir}/Dependencies/lib ${SolutionDir}/_Out/)
endif()
link_directories(${DependenciesLibPath})
if(${BUILD_TOOLS_ONLY} STREQUAL "ON")
message("Build Tools Only")
add_subdirectory(NFTools)
else()
message("Build All")
add_subdirectory(Dependencies)
add_subdirectory(NFComm)
add_subdirectory(NFServer)
add_subdirectory(Tutorial)
add_subdirectory(NFTools)
endif()