-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
145 lines (118 loc) · 6.13 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(RType_Server)
PROJECT(RType_Client)
MESSAGE("settings ...")
SET(SERVER_BIN RType_Server)
SET(CLIENT_BIN RType_Client)
if (UNIX)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -ggdb3 -O0 -W -Wall -Wextra -Werror")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -W -Wall -Wextra -Werror")
endif (UNIX)
SET(EXECUTABLE_SOURCE_DIR, {CMAKE_SOURCE_DIR})
SET(HEADER_S)
SET(HEADER_C)
SET(SOURCE_S
main_server.cpp)
SET(SOURCE_C
main_client.cpp)
MESSAGE("add subdirectories")
# CALL OTHER CMAKEFILES
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/components")
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/systems")
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/events")
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/utility")
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/NetworkRelay")
ADD_SUBDIRECTORY("${PROJECT_SOURCE_DIR}/Menu")
ADD_SUBDIRECTORY(Network)
ADD_SUBDIRECTORY(Threads)
ADD_SUBDIRECTORY(LibLoader)
ADD_SUBDIRECTORY(ECS)
# INCLUDE .hh / .hpp
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/utility)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/components)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/ECS)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/events)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/LibLoader)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Menu)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Network)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/utility/Timer)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/utility/DirectoryLister)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/systems)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Threads)
if (UNIX)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/SFML-src)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/SFML-src/include)
endif (UNIX)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/utility)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/NetworkRelay)
# CREATION OF EXECUTABLE FILES
ADD_EXECUTABLE(${SERVER_BIN} ${SOURCE_S} ${HEADER_S})
ADD_EXECUTABLE(${CLIENT_BIN} ${SOURCE_C} ${HEADER_C})
# COPY RESSOURCES
MESSAGE("Copy ressources files ...")
SET(RESSOURCES ${CMAKE_SOURCE_DIR}/Ressources)
FILE(COPY ${RESSOURCES} DESTINATION ${CMAKE_BINARY_DIR})
#RELEASE MODE
SET(CMAKE_BUILD_TYPE "Release")
MESSAGE("set build type : " ${CMAKE_BUILD_TYPE})
# COMPILE WITH SFML
if (UNIX)
MESSAGE("OS TYPE : UNIX")
TARGET_LINK_LIBRARIES (${CLIENT_BIN} /usr/lib/libsfml-window.so.2.1)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} /usr/lib/libsfml-system.so.2.1)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} /usr/lib/libsfml-network.so.2.1)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} /usr/lib/libsfml-audio.so.2.1)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} /usr/lib/libsfml-graphics.so.2.1)
TARGET_LINK_LIBRARIES (${SERVER_BIN} rt)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} pthread)
TARGET_LINK_LIBRARIES (${SERVER_BIN} pthread)
# TARGET_LINK_LIBRARIES (${SERVER_BIN} /usr/lib/libsfml-window.so.2.1)
# TARGET_LINK_LIBRARIES (${SERVER_BIN} /usr/lib/libsfml-system.so.2.1)
# TARGET_LINK_LIBRARIES (${SERVER_BIN} /usr/lib/libsfml-network.so.2.1)
# TARGET_LINK_LIBRARIES (${SERVER_BIN} /usr/lib/libsfml-audio.so.2.1)
# TARGET_LINK_LIBRARIES (${SERVER_BIN} /usr/lib/libsfml-graphics.so.2.1)
endif (UNIX)
if (WIN32)
SET(-DCMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE})
MESSAGE("OS TYPE : WINDOW")
ADD_DEFINITIONS(-DSFML_DYNAMIC)
if (CMAKE_BUILD_TYPE STREQUAL "Release")
SET(DLL ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/bin/Release)
FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/bin/Release)
FILE(COPY ${DLL} DESTINATION ${CMAKE_BINARY_DIR})
FILE(COPY ${RESSOURCES} DESTINATION ${CMAKE_BINARY_DIR}/Release)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/include)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-audio.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-graphics.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-main.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-system.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-window.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-audio.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-graphics.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-main.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-system.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/lib/sfml-window.lib)
else ()
SET(DLL ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/bin/Debug)
FILE(COPY ${DLL} DESTINATION ${CMAKE_BINARY_DIR})
FILE(COPY ${RESSOURCES} DESTINATION ${CMAKE_BINARY_DIR}/Release)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/SFML-src/Window/Release/include)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-audio-d.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-graphics-d.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-main-d.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-system-d.lib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-window-d.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-audio-d.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-graphics-d.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-main-d.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-system-d.lib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ${CMAKE_SOURCE_DIR}/SFML-src/Window/Debug/lib/sfml-window-d.lib)
endif ()
endif (WIN32)
# INCLUDE LIB
TARGET_LINK_LIBRARIES (${SERVER_BIN} Networklib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} ECSlib)
TARGET_LINK_LIBRARIES (${SERVER_BIN} Threadlib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} Networklib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} ECSlib)
TARGET_LINK_LIBRARIES (${CLIENT_BIN} Threadlib)