-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
328 lines (297 loc) · 9.42 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
cmake_minimum_required(VERSION 3.2)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake_modules")
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
message(STATUS "find ccache")
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
project(ofApp)
set(APP ofApp)
include(cotire)
set(COTIRE_MINIMUM_NUMBER_OF_TARGET_SOURCES 1)
set_directory_properties(PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "")
set(OF_PLATFORM x86 CACHE STRING "Platform architecture. No need to be modified by default.")
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT OF_32BIT)
set(ARCH_BIT 64)
else()
set(ARCH_BIT 32)
endif()
# include(../of/openFrameworks.cmake)
set(OF_ROOT_DIR ../of)
if(CMAKE_BUILD_TYPE MATCHES Release)
set(OF_LIB_DIR "${OF_ROOT_DIR}/lib-linux/release-${OF_PLATFORM}-${ARCH_BIT}")
elseif(CMAKE_BUILD_TYPE MATCHES Debug)
set(OF_LIB_DIR "${OF_ROOT_DIR}/lib-linux/debug-${OF_PLATFORM}-${ARCH_BIT}")
endif()
set(OF_AUDIO ON CACHE BOOL "Compile audio features of openFrameworks")
set(OF_VIDEO ON CACHE BOOL "Compile video features of openFrameworks")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/bin")
find_package(PkgConfig REQUIRED)
pkg_check_modules(CAIRO REQUIRED cairo)
pkg_check_modules(FONTCONFIG REQUIRED fontconfig)
find_package(OpenGL REQUIRED)
find_package(X11 REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Pixman REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(Freetype REQUIRED)
find_package(GLEW REQUIRED)
find_package(Boost COMPONENTS filesystem system REQUIRED)
find_package(ALSA REQUIRED)
find_package(OpenAL REQUIRED)
find_package(MPG123 REQUIRED)
find_package(Sndfile REQUIRED)
find_package(UDev REQUIRED)
find_package(Glib REQUIRED)
find_package(GStreamer REQUIRED)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
set(OPENFRAMEWORKS_INCLUDE_DIRS
"${OF_ROOT_DIR}/src/openframeworks"
"${OF_ROOT_DIR}/src/openframeworks/3d"
"${OF_ROOT_DIR}/src/openframeworks/app"
"${OF_ROOT_DIR}/src/openframeworks/communication"
"${OF_ROOT_DIR}/src/openframeworks/events"
"${OF_ROOT_DIR}/src/openframeworks/gl"
"${OF_ROOT_DIR}/src/openframeworks/graphics"
"${OF_ROOT_DIR}/src/openframeworks/math"
"${OF_ROOT_DIR}/src/openframeworks/sound"
"${OF_ROOT_DIR}/src/openframeworks/types"
"${OF_ROOT_DIR}/src/openframeworks/utils"
"${OF_ROOT_DIR}/src/openframeworks/video"
"${OF_ROOT_DIR}/src/freeimage"
"${OF_ROOT_DIR}/src/freeimage/OpenEXR"
"${OF_ROOT_DIR}/src/freeimage/OpenEXR/Half"
"${OF_ROOT_DIR}/src/freeimage/OpenEXR/Iex"
"${OF_ROOT_DIR}/src/freeimage/OpenEXR/IlmImf"
"${OF_ROOT_DIR}/src/freeimage/OpenEXR/IlmThread"
"${OF_ROOT_DIR}/src/freeimage/OpenEXR/Imath"
"${OF_ROOT_DIR}/src/glew"
"${OF_ROOT_DIR}/src/glew/include"
"${OF_ROOT_DIR}/src/glfw"
"${OF_ROOT_DIR}/src/glfw/include"
"${OF_ROOT_DIR}/src/glfw/include/GLFW"
"${OF_ROOT_DIR}/src/kissfft"
"${OF_ROOT_DIR}/src/kissfft/tools"
"${OF_ROOT_DIR}/src/libtess2"
"${OF_ROOT_DIR}/src/libtess2/Include"
"${OF_ROOT_DIR}/src/libtess2/Source"
"${OF_ROOT_DIR}/src/poco"
"${OF_ROOT_DIR}/src/poco/Crypto/include"
"${OF_ROOT_DIR}/src/poco/Foundation/include"
"${OF_ROOT_DIR}/src/poco/Net/include"
"${OF_ROOT_DIR}/src/poco/NetSSL_OpenSSL/include"
"${OF_ROOT_DIR}/src/poco/Util/include"
"${OF_ROOT_DIR}/src/poco/XML/include"
"${OF_ROOT_DIR}/src/poco/Zip/include"
"${OF_ROOT_DIR}/src/rtaudio"
"${OF_ROOT_DIR}/src/rtaudio/include"
"${OF_ROOT_DIR}/src/utf8cpp"
"${OF_ROOT_DIR}/src/utf8cpp/include"
# ${X11_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
${PIXMAN_INCLUDE_DIRS}
${CAIRO_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${FONTCONFIG_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
# ${ALSA_INCLUDE_DIRS}
# ${OPENAL_INCLUDE_DIR}
# ${MPG123_INCLUDE_DIRS}
# ${SNDFILE_INCLUDE_DIR}
${UDEV_INCLUDE_DIR}
${GLIB_INCLUDE_DIRS}
${GTK3_INCLUDE_DIRS}
${GSTREAMER_INCLUDE_DIRS}
)
file(GLOB_RECURSE OPENFRAMEWORKS_LIBS "${OF_LIB_DIR}/*.so")
if(NOT OPENFRAMEWORKS_LIBS)
message(FATAL_ERROR "No shared openFrameworks libraries found in ${OF_LIB_DIR} folder.")
endif()
set(OPENFRAMEWORKS_LIBRARIES
${OPENFRAMEWORKS_LIBS}
# ${X11_Xi_LIB}
# ${X11_LIBRARIES}
# ${X11_Xrandr_LIB}
# ${X11_Xcursor_LIB}
# ${X11_Xxf86vm_LIB}
# ${X11_Xinerama_LIB}
${ZLIB_LIBRARIES}
${CAIRO_LIBRARIES}
${PIXMAN_LIBRARIES}
${OPENGL_LIBRARIES}
${OPENSSL_LIBRARIES}
${FREETYPE_LIBRARIES}
${FONTCONFIG_LIBRARIES}
${FREEIMAGE_LIBRARIES}
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${GLEW_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
#${ALSA_LIBRARIES}
#${OPENAL_LIBRARY}
#${MPG123_LIBRARIES}
#${SNDFILE_LIBRARIES}
${UDEV_LIBRARIES}
${GLIB_LIBRARIES}
${GTK3_LIBRARIES}
${GSTREAMER_LIBRARIES}
${GSTREAMER_APP_LIBRARIES}
${GSTREAMER_BASE_LIBRARIES}
${GSTREAMER_VIDEO_LIBRARIES}
)
#if(NOT OF_AUDIO)
# list(APPEND OPENFRAMEWORKS_DEFINITIONS -DTARGET_NO_SOUND)
#else()
# find_package(ALSA REQUIRED)
# find_package(OpenAL REQUIRED)
# find_package(MPG123 REQUIRED)
# find_package(Sndfile REQUIRED)
#
# list(APPEND OPENFRAMEWORKS_INCLUDE_DIRS
# ${ALSA_INCLUDE_DIRS}
# ${OPENAL_INCLUDE_DIR}
# ${MPG123_INCLUDE_DIRS}
# ${SNDFILE_INCLUDE_DIR}
# )
#
# list(APPEND OPENFRAMEWORKS_LIBRARIES
# ${ALSA_LIBRARIES}
# ${OPENAL_LIBRARY}
# ${MPG123_LIBRARIES}
# ${SNDFILE_LIBRARIES}
# )
#endif()
#
#if(NOT OF_VIDEO)
# list(APPEND OPENFRAMEWORKS_DEFINITIONS -DTARGET_NO_VIDEO)
#else()
# list(APPEND OPENFRAMEWORKS_DEFINITIONS -DOF_USING_GTK)
#
# find_package(UDev REQUIRED)
# find_package(Glib REQUIRED)
# find_package(GStreamer REQUIRED)
# pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
#
# list(APPEND OPENFRAMEWORKS_INCLUDE_DIRS
# ${UDEV_INCLUDE_DIR}
# ${GLIB_INCLUDE_DIRS}
# ${GTK3_INCLUDE_DIRS}
# ${GSTREAMER_INCLUDE_DIRS}
# )
#
# list(APPEND OPENFRAMEWORKS_LIBRARIES
# ${UDEV_LIBRARIES}
# ${GLIB_LIBRARIES}
# ${GTK3_LIBRARIES}
# ${GSTREAMER_LIBRARIES}
# ${GSTREAMER_APP_LIBRARIES}
# ${GSTREAMER_BASE_LIBRARIES}
# ${GSTREAMER_VIDEO_LIBRARIES}
# )
#endif()
#message(STATUS ${OPENFRAMEWORKS_INCLUDE_DIRS})
message(STATUS "openframeworks libraries:${OPENFRAMEWORKS_LIBRARIES}")
include_directories(${OPENFRAMEWORKS_INCLUDE_DIRS})
#
#if(CMAKE_C_COMPILER_ID STREQUAL Clang)
#
# set(RELEASE_C_FLAGS_CLANG "
# ${RELEASE_C_FLAGS_CLANG}
# -Wno-switch
# -Wno-c++11-narrowing
# -Wno-ignored-attributes
# -Wno-deprecated-register
# ")
#
# set(DEBUG_C_FLAGS_CLANG "
# ${DEBUG_C_FLAGS_CLANG}
# -Wno-switch
# -Wno-c++11-narrowing
# -Wno-ignored-attributes
# -Wno-deprecated-register
# ")
#
#endif()
#if(CMAKE_CXX_COMPILER_ID STREQUAL Clang)
#
# set(CXX_FLAGS_CLANG "
# ${RELEASE_CXX_FLAGS_CLANG}
# -Wno-switch
# -Wno-c++11-narrowing
# -Wno-ignored-attributes
# -Wno-deprecated-register
# ")
#
# set(CXX_COLORIZATION "-fcolor-diagnostics")
# set(O_C_FLAG -O0)
# set(O_CXX_FLAG -O0)
# set(PIC_FLAG -fPIC)
# set(CPP11_FLAG -std=gnu++14)
# set(RELEASE_FLAGS "
# ${RELEASE_FLAGS}
# -g1
#")
#endif()
set(CMAKE_CXX_FLAGS
"-std=c++11 -fPIC -Wno-switch -Wno-c++11-narrowing -Wno-ignored-attributes -Wno-deprecated-register"
)
#// LIVECODING /////////////////////////////////////////////////////////////////
set(OF_ENABLE_LIVECODING ON CACHE BOOL "")
message("++ OF_ENABLE_LIVECODING: " ${OF_ENABLE_LIVECODING})
if(OF_ENABLE_LIVECODING)
add_definitions(-DRCCPP)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(RuntimeCompiledCPlusPlus/Aurora)
include_directories(RuntimeCompiledCPlusPlus/Aurora)
# list(APPEND OPENFRAMEWORKS_LIBRARIES RuntimeCompiler RuntimeObjectSystem)
set(OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} RuntimeCompiler RuntimeObjectSystem)
endif()
#///////////////////////////////////////////////////////////////////////////////
# ofxaddon(addons/ofxImGui)
set(OFXADDON_DIR ${CMAKE_CURRENT_LIST_DIR}/addons/ofxImGui)
include_directories("${CMAKE_CURRENT_LIST_DIR}/addons/ofxImGui/src")
include_directories("${CMAKE_CURRENT_LIST_DIR}/addons/ofxImGui/libs")
include_directories("${CMAKE_CURRENT_LIST_DIR}/addons/ofxImGui/libs/imgui/src")
file(GLOB_RECURSE OFXHEADERS
"${OFXADDON_DIR}/src/*.h"
"${OFXADDON_DIR}/src/*.hh"
"${OFXADDON_DIR}/src/*.hpp"
"${OFXADDON_DIR}/libs/*.h"
"${OFXADDON_DIR}/libs/*.hh"
"${OFXADDON_DIR}/libs/*.hpp"
)
file(GLOB_RECURSE OFXSOURCES
"${OFXADDON_DIR}/src/*.c"
"${OFXADDON_DIR}/src/*.cc"
"${OFXADDON_DIR}/src/*.cpp"
"${OFXADDON_DIR}/libs/*.c"
"${OFXADDON_DIR}/libs/*.cc"
"${OFXADDON_DIR}/libs/*.cpp"
)
if(OFXSOURCES)
set(OFXADDONS_SOURCES ${OFXADDONS_SOURCES} ${OFXSOURCES})
endif()
set(SOURCES
src/main.cpp
src/ofApp.cpp
src/ofLive.cpp
)
add_executable(
${APP}
${SOURCES}
${OFXADDONS_SOURCES}
)
target_link_libraries(
${APP}
${OPENFRAMEWORKS_LIBRARIES}
)
cotire(${APP})