-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenFrameworks.cmake
257 lines (217 loc) · 8.06 KB
/
openFrameworks.cmake
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
# - Find openFrameworks dependencies
#
# Find openframeworks dependencies on Linux and OS X
# This code set the following variables
# OPENFRAMEWORKS_LIBRARIES
# OPENFRAMEWORKS_INCLUDES
# Check the following dependencies
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0011 NEW)
# set (OPENFRAMEWORKS_PREFIX "/opt/openFrameworks")
# Set default libraries search path
if ( DEFINED OPENFRAMEWORKS_PREFIX )
MESSAGE ( "Searching libraries in ${OPENFRAMEWORKS_PREFIX}" )
set (OPENFRAMEWORKS_LIBRARY_PREFIX "${OPENFRAMEWORKS_PREFIX}/lib")
set (OPENFRAMEWORKS_INCLUDE_PREFIX "${OPENFRAMEWORKS_PREFIX}/include")
endif( DEFINED OPENFRAMEWORKS_PREFIX )
message ( "${OPENFRAMEWORKS_INCLUDE_PREFIX}")
message("${CMAKE_SYSTEM_NAME}")
if ( APPLE )
set (CMAKE_FIND_LIBRARY_PREFIXES "" "lib")
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" ".lib", ".so")
endif ()
MACRO (find_lib_inc varname libname incfile)
string(TOLOWER libname libnamelow)
find_library(${varname}_LIBRARIES ${libname} PATHS ${OPENFRAMEWORKS_LIBRARY_PREFIX})
if (NOT ${varname}_LIBRARIES})
find_library(${varname}_LIBRARIES ${libnamelow} PATHS ${OPENFRAMEWORKS_LIBRARY_PREFIX})
endif()
find_path(${varname}_INCLUDES NAMES ${incfile}
PATHS ${OPENFRAMEWORKS_INCLUDE_PREFIX}
/usr/local/X11R6/include
/usr/local/X11/include
/usr/X11/include
/sw/include
/opt/local/include
/usr/freeware/include
/usr/include/${libnamelow}
/usr/local/include/${libnamelow}
/opt/local/include/${libnamelow}
/usr/include/${libname}
/usr/local/include/${libname}
/opt/local/include/${libname}
)
if ( NOT ${varname}_LIBRARIES )
message ( FATAL_ERROR "Cannot find ${libname} library")
else()
message ( STATUS "Found ${libname} library")
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${${varname}_LIBRARIES} )
endif()
if ( NOT ${varname}_INCLUDES )
message ( FATAL_ERROR "Cannot find ${incfile}" )
else ()
set ( OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES} ${${varname}_INCLUDES} )
message ( STATUS "Found ${incfile} (${${varname}_INCLUDES})")
endif()
ENDMACRO(find_lib_inc)
find_lib_inc(POCO PocoFoundation "Poco/Poco.h")
find_lib_inc(GLEE GLee GLee.h)
find_lib_inc(FMODEX fmodex fmod.h)
find_lib_inc(RTAUDIO RtAudio RtAudio.h)
find_lib_inc(FREEIMAGE FreeImage FreeImage.h)
# freetype
include (FindFreetype)
if (NOT FREETYPE_FOUND)
message( FATAL_ERROR "Cannot find freetype 2 library")
else()
message( STATUS "Found Freetype2" )
endif()
if ( APPLE )
# find opengl framework
FIND_PATH( GLU_INCLUDES
glu.h
/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers)
if (GLU_INCLUDES)
message(STATUS "Found GLU")
set ( GLU_LIBRARY "-framework OpenGL")
else()
message(FATAL_ERROR "Cannot Find GLU")
endif()
else()
# find GLU
include(FindGLU)
if ( GLU_LIBRARY )
message (STATUS "Found GLU")
else ( GLU_LIBRARY )
message ( WARNING "Cannot find GLU")
endif (GLU_LIBRARY)
endif()
# find GLUT
include(FindGLUT)
if ( GLUT_LIBRARIES )
message ( STATUS "Found GLUT ${GLUT_LIBRARIES}")
else ( GLUT_LIBRARIES )
message ( FATAL_ERROR "Cannot find GLUT")
endif (GLUT_LIBRARIES)
if ( APPLE )
#include(FindQuickTime)
# FIND_PATH( QUICKTIME_INCLUDES
# QuickTime.h
# /System/Library/Frameworks/QuickTime.framework/Versions/A/Headers)
# if ( QUICKTIME_INCLUDES )
# message ( STATUS "Found QuickTime framework")
# set (QUICKTIME_LIBRARIES "-framework QuickTime")
# else()
# message (WARNING "Cannot find quicktime")
# endif()
find_library(QUICKTIME_LIBRARIES QuickTime)
if ( QUICKTIME_LIBRARIES )
message (STATUS "Found quicktime")
else()
message( FATAL_ERROR "Cannot find QuickTime")
endif()
### COREAUDIO
FIND_LIBRARY(COREAUDIO_LIBRARY CoreAudio)
if ( COREAUDIO_LIBRARY)
message (STATUS "Found CoreAudio library")
else ()
message (FATAL_ERROR "Cannot find CoreAudio")
endif()
### CARBON
FIND_LIBRARY(CARBON_LIBRARY Carbon)
if ( CARBON_LIBRARY )
message(STATUS "Found Carbon library")
else()
message( FATAL_ERROR "Cannot find Carbon")
endif ()
### COREFOUNDATION
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation )
if (COREFOUNDATION_LIBRARY)
message(STATUS "Found CoreFoundation library")
else()
message(FATAL_ERROR "Cannot find CoreFoundation")
endif()
endif()
if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
include(FindPkgConfig)
pkg_check_modules(UNICAP libunicap)
if ( UNICAP_LIBRARIES )
message ( STATUS "Found unicap")
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${UNICAP_LIBRARIES} )
set ( OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES} ${UNICAP_INCLUDE_DIRS} )
else()
message ( FATAL_ERROR "Cannot find unicap")
endif()
pkg_check_modules(GST gstreamer-app-0.10)
if ( GST_LIBRARIES )
message ( STATUS "Found Gstreamer")
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${GST_LIBRARIES} )
set ( OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES} ${GST_INCLUDE_DIRS} )
else()
message( FATAL_ERROR "Cannot find Gstreamer-app")
endif()
pkg_check_modules(GSTVIDEO gstreamer-video-0.10)
if ( GSTVIDEO_LIBRARIES )
message ( STATUS "Found Gstreamer-video")
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${GSTVIDEO_LIBRARIES} )
set ( OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES} ${GSTVIDEO_INCLUDE_DIRS} )
else()
message( FATAL_ERROR "Cannot find Gstreamer-video")
endif()
pkg_check_modules(AVFORMAT libavformat)
if ( AVFORMAT_LIBRARIES)
message ( STATUS "Found libavformat ${AVFORMAT_LIBRARIES} ${AVFORMAT_LDFLAGS} ${AVFORMAT_LDFLAGS_OTHER}")
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${AVFORMAT_LIBRARIES})
set ( OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES} ${AVFORMAT_INCLUDE_DIRS})
else()
message ( FATAL_ERROR "Cannot find libavformat" )
endif()
pkg_check_modules(SWSCALE libswscale)
if ( SWSCALE_LIBRARIES)
message ( STATUS "Found libswscale")
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${SWSCALE_LIBRARIES})
set ( OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES} ${SWSCALE_INCLUDE_DIRS})
else()
message ( FATAL_ERROR "Cannot find libswscale")
endif()
### LIBASOUND
find_library(ASOUND asound)
if (ASOUND)
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${ASOUND})
message ( STATUS "Found asound ${ASOUND}")
else()
message (FATAL_ERROR "Cannot find asound library")
endif()
### LIBRAW1394
find_library(RAW1394 raw1394)
if (RAW1394)
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES} ${RAW1394})
message ( STATUS "Found raw1394")
else()
message (FATAL_ERROR "Cannot find raw1394 library")
endif()
#find_lib_inc(UNICAP unicap unicap.h)
endif()
SET(OPENFRAMEWORKS_LIBRARIES
${OPENFRAMEWORKS_LIBRARIES}
${FREETYPE_LIBRARIES}
${GLUT_LIBRARIES}
${GLU_LIBRARY}
)
set(OPENFRAMEWORKS_INCLUDES ${OPENFRAMEWORKS_INCLUDES}
${FREETYPE_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}/freetype
${OPENFRAMEWORKS_INCLUDE_PREFIX})
if ( APPLE )
set (OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES}
${COREAUDIO_LIBRARY}
${COREFOUNDATION_LIBRARY}
${CARBON_LIBRARY}
${QUICKTIME_LIBRARIES})
endif()
if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
set ( OPENFRAMEWORKS_LIBRARIES ${OPENFRAMEWORKS_LIBRARIES}
${UNICAP_LIBRARIES})
endif()
#message("${OPENFRAMEWORKS_LIBRARIES}")
#message("${OPENFRAMEWORKS_INCLUDES}")