-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
184 lines (140 loc) · 2.66 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
PROJECT ("Remote")
#
# Variables
#
SET (REMOTE_BUNDLES_PATH ${CMAKE_SOURCE_DIR}/Bin)
SET (REMOTE_CLIENT_BUNDLE_PATH ${REMOTE_BUNDLES_PATH}/Client)
SET (REMOTE_SERVER_BUNDLE_PATH ${REMOTE_BUNDLES_PATH}/Server)
#
# CMake config
#
SET (
CMAKE_MODULE_PATH
${CMAKE_SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH}
)
#
# Dependencies
#
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.40.0 REQUIRED COMPONENTS system date_time regex)
find_package(LibVLC REQUIRED)
find_package(SDL)
#
# Include Directories
#
INCLUDE_DIRECTORIES (
${CMAKE_SOURCE_DIR}/Client/src
${CMAKE_SOURCE_DIR}/Server/src
${Boost_INCLUDE_DIR}
${LIBVLC_INCLUDE_DIR}
${SDL_INCLUDE_DIR}
)
#
# Sources
#
# Server
FILE (
GLOB_RECURSE
SERVER_SOURCE
${CMAKE_SOURCE_DIR}/Server/src/*
)
# Client
FILE (
GLOB_RECURSE
CLIENT_SOURCE
${CMAKE_SOURCE_DIR}/Client/src/*
)
#
# Exec
#
# Client
ADD_EXECUTABLE(
Client
MACOSX_BUNDLE
${CLIENT_SOURCE}
)
# Server
ADD_EXECUTABLE(
Server
${SERVER_SOURCE}
)
#
# Group source files
#
FILE (
GLOB
SOURCE_FOLDERS
${CMAKE_SOURCE_DIR}/Client/src/*
${CMAKE_SOURCE_DIR}/Server/src/*
)
FOREACH (FOLDER ${SOURCE_FOLDERS})
IF (IS_DIRECTORY ${FOLDER})
# Get directory name
GET_FILENAME_COMPONENT (
GROUP_NAME
${FOLDER}
NAME
)
# Get source files in directories
FILE (
GLOB_RECURSE
GROUP_SOURCE
${FOLDER}/*
)
SOURCE_GROUP (
${GROUP_NAME}
FILES
${GROUP_SOURCE}
)
ENDIF ()
ENDFOREACH ()
#
# Library linking
#
TARGET_LINK_LIBRARIES (
Client
${Boost_LIBRARIES}
${LIBVLC_LIBRARY}
${SDL_LIBRARY}/SDL.lib
)
TARGET_LINK_LIBRARIES (
Server
${Boost_LIBRARIES}
)
#
# Setup bundles
#
# Client bundle
SET_PROPERTY (
TARGET Client
PROPERTY RUNTIME_OUTPUT_DIRECTORY ${REMOTE_CLIENT_BUNDLE_PATH}
)
SET_PROPERTY (
TARGET Client
PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG ${REMOTE_CLIENT_BUNDLE_PATH}
)
SET_PROPERTY (
TARGET Client
PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE ${REMOTE_CLIENT_BUNDLE_PATH}
)
IF (APPLE)
# Mac Bundle (.app)
SET_PROPERTY (
TARGET Client
PROPERTY MACOSX_BUNDLE_ICON_FILE icon.icns
)
ENDIF (APPLE)
# Server bundle
SET_PROPERTY (
TARGET Server
PROPERTY RUNTIME_OUTPUT_DIRECTORY ${REMOTE_SERVER_BUNDLE_PATH}
)
SET_PROPERTY (
TARGET Server
PROPERTY RUNTIME_OUTPUT_DIRECTORY_DEBUG ${REMOTE_SERVER_BUNDLE_PATH}
)
SET_PROPERTY (
TARGET Server
PROPERTY RUNTIME_OUTPUT_DIRECTORY_RELEASE ${REMOTE_SERVER_BUNDLE_PATH}
)