]> git.sesse.net Git - vlc/blob - extras/buildsystem/cmake/include/config.cmake
Remove useless and unfinished seamcarving resizer plugin. (We don't want experimentat...
[vlc] / extras / buildsystem / cmake / include / config.cmake
1 ###########################################################
2 # System Includes
3 ###########################################################
4 include( CheckIncludeFile )
5 include (CheckTypeSize)
6 include (CheckCSourceCompiles)
7 include (CheckSymbolExists)
8 include (CheckLibraryExists)
9
10 ###########################################################
11 # Options
12 ###########################################################
13 # Options moved before the custom macro includes because those macros need path values, if the ENABLE_CONTRIB
14 # has been set.
15
16 OPTION( ENABLE_HTTPD           "Enable httpd server" ON )
17 OPTION( ENABLE_STREAM_OUT      "Enable stream output plugins" ON )
18 OPTION( ENABLE_VLM             "Enable vlm" ON )
19 OPTION( ENABLE_DYNAMIC_PLUGINS "Enable dynamic plugin" ON )
20 OPTION( UPDATE_CHECK           "Enable automatic new version checking" OFF )
21 OPTION( ENABLE_NO_SYMBOL_CHECK "Don't check symbols of modules against libvlc. (Enabling this option speeds up compilation)" OFF )
22 OPTION( ENABLE_CONTRIB         "Attempt to use VLC contrib system to get the third-party libraries" ON )
23 OPTION( ENABLE_LOADER          "Enable the win32 codec loader" OFF )
24 OPTION( ENABLE_NLS             "Enable translation of the program's messages" ON)
25
26 if(ENABLE_CONTRIB)
27
28   set( CONTRIB_INCLUDE ${CMAKE_SOURCE_DIR}/extras/contrib/include)
29   set( CONTRIB_LIB ${CMAKE_SOURCE_DIR}/extras/contrib/lib)
30   set( CONTRIB_PROGRAM ${CMAKE_SOURCE_DIR}/extras/contrib/bin)
31   set( CMAKE_LIBRARY_PATH ${CONTRIB_LIB} ${CMAKE_LIBRARY_PATH} )
32   set( CMAKE_PROGRAM_PATH ${CONTRIB_PROGRAM} ${CMAKE_PROGRAM_PATH} )
33   set( CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${CONTRIB_LIB}" )
34   set( CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${CONTRIB_LIB}" )
35   set( CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
36   set( CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
37   set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
38   set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
39
40   # include extras/contrib/include in the header search pathes
41   include_directories(${CONTRIB_INCLUDE})
42   set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CONTRIB_INCLUDE} )
43   
44   # include the extras/contrib/bin to the search path, otherwise, when finding programs it will automatically
45   # default to system applications (e.g. we should favor the extras/contrib/bin/pkg-config over the system defined
46   # one).
47   if(WIN32)
48     set( ENV{PATH} "${CONTRIB_PROGRAM};$ENV{PATH}" )
49   else(WIN32)
50     set( ENV{PATH} "${CONTRIB_PROGRAM}:$ENV{PATH}" )
51   endif(WIN32)
52 endif(ENABLE_CONTRIB)
53
54 ###########################################################
55 # Custom Macro Includes
56 ###########################################################
57
58 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_include_files.cmake )
59 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_functions_exist.cmake )
60 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_add_compile_flag.cmake )
61 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_type.cmake )
62 include( ${CMAKE_SOURCE_DIR}/cmake/pkg_check_modules.cmake )
63
64 ###########################################################
65 # Versioning
66 ###########################################################
67
68 set(VLC_VERSION_MAJOR "0")
69 set(VLC_VERSION_MINOR "9")
70 set(VLC_VERSION_PATCH "0")
71 set(VLC_VERSION_EXTRA "-svn")
72 set(VLC_VERSION ${VLC_VERSION_MAJOR}.${VLC_VERSION_MINOR}.${VLC_VERSION_PATCH}${VLC_VERSION_EXTRA})
73
74 set(PACKAGE "vlc")
75 set(PACKAGE_NAME "vlc") #for gettext
76 set(PACKAGE_VERSION "${VLC_VERSION}")
77 set(PACKAGE_STRING "vlc")
78 set(VERSION_MESSAGE "vlc-${VLC_VERSION}")
79 set(COPYRIGHT_MESSAGE "Copyright © the VideoLAN team")
80 set(COPYRIGHT_YEARS "2001-2008")
81 set(PACKAGE_VERSION_EXTRA "${VLC_VERSION_EXTRA}")
82 set(PACKAGE_VERSION_MAJOR "${VLC_VERSION_MAJOR}")
83 set(PACKAGE_VERSION_MINOR "${VLC_VERSION_MINOR}")
84 set(PACKAGE_VERSION_REVISION "${VLC_VERSION_PATCH}")
85
86 ###########################################################
87 # Preflight Checks
88 ###########################################################
89
90 IF (NOT CMAKE_BUILD_TYPE)
91     set(CMAKE_BUILD_TYPE "Debug" CACHE STRING  "build type determining compiler flags" FORCE )
92 endif(NOT CMAKE_BUILD_TYPE )
93
94 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
95     set(DEBUG ON)
96     add_definitions(-DDEBUG=1)
97     set(NDEBUG OFF)
98 endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
99
100 set( HAVE_DYNAMIC_PLUGINS ${ENABLE_DYNAMIC_PLUGINS})
101 set( LIBEXT ${CMAKE_SHARED_MODULE_SUFFIX})
102
103 check_c_source_compiles(
104     "struct __attribute__((__packed__)) foo { int a; } b; int main(){return 0;}"
105     HAVE_ATTRIBUTE_PACKED)
106
107 ###########################################################
108 # Headers checks
109 ###########################################################
110
111 vlc_check_include_files (malloc.h stdbool.h locale.h)
112 vlc_check_include_files (stddef.h stdlib.h sys/stat.h)
113 vlc_check_include_files (stdio.h stdint.h inttypes.h)
114 vlc_check_include_files (signal.h unistd.h dirent.h)
115 vlc_check_include_files (netinet/in.h netinet/udplite.h)
116 vlc_check_include_files (arpa/inet.h net/if.h)
117 vlc_check_include_files (netdb.h fcntl.h sys/time.h poll.h)
118 vlc_check_include_files (errno.h time.h alloca.h)
119 vlc_check_include_files (limits.h)
120
121 vlc_check_include_files (string.h strings.h getopt.h)
122
123 vlc_check_include_files (dlfcn.h dl.h)
124
125 vlc_check_include_files (kernel/OS.h)
126 vlc_check_include_files (memory.h)
127 vlc_check_include_files (mach-o/dyld.h)
128
129 vlc_check_include_files (pthread.h)
130
131 find_package (Threads)
132
133 ###########################################################
134 # Functions/structures checks
135 ###########################################################
136
137 set(CMAKE_REQUIRED_LIBRARIES c)
138 set(CMAKE_EXTRA_INCLUDE_FILES string.h)
139 vlc_check_functions_exist(strcpy strcasecmp strncasecmp)
140 vlc_check_functions_exist(strcasestr stristr strdup)
141 vlc_check_functions_exist(strndup stricmp strnicmp)
142 vlc_check_functions_exist(atof strtoll atoll lldiv)
143 vlc_check_functions_exist(strlcpy stristr strnlen strsep)
144 vlc_check_functions_exist(strtod strtof strtol stroul)
145 vlc_check_functions_exist(stroull)
146 set(CMAKE_EXTRA_INCLUDE_FILES)
147
148 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
149 vlc_check_functions_exist(vasprintf)
150 set(CMAKE_EXTRA_INCLUDE_FILES)
151
152 set(CMAKE_EXTRA_INCLUDE_FILES libc.h)
153 vlc_check_functions_exist(fork)
154 set(CMAKE_EXTRA_INCLUDE_FILES)
155
156 set(CMAKE_EXTRA_INCLUDE_FILES stdlib.h)
157 vlc_check_functions_exist(putenv getenv setenv)
158 vlc_check_functions_exist(putenv getenv setenv)
159 set(CMAKE_EXTRA_INCLUDE_FILES)
160
161 set(CMAKE_EXTRA_INCLUDE_FILES stdio.h)
162 vlc_check_functions_exist(snprintf asprintf)
163 vlc_check_functions_exist(putenv getenv setenv)
164 set(CMAKE_EXTRA_INCLUDE_FILES)
165
166 set(CMAKE_EXTRA_INCLUDE_FILES unistd.h)
167 vlc_check_functions_exist(isatty getcwd getuid swab)
168 set(CMAKE_EXTRA_INCLUDE_FILES)
169
170 set(CMAKE_EXTRA_INCLUDE_FILES sys/stat.h)
171 vlc_check_functions_exist(lstat fstat stat)
172 set(CMAKE_EXTRA_INCLUDE_FILES)
173
174 set(CMAKE_EXTRA_INCLUDE_FILES arpa/inet.h)
175 vlc_check_functions_exist(inet_aton inet_ntop inet_pton)
176 set(CMAKE_EXTRA_INCLUDE_FILES)
177
178 set(CMAKE_EXTRA_INCLUDE_FILES sys/mman.h)
179 vlc_check_functions_exist(mmap)
180 if(HAVE_MMAP)
181   vlc_enable_modules(access_mmap)
182 endif(HAVE_MMAP)
183 set(CMAKE_EXTRA_INCLUDE_FILES)
184
185 set(CMAKE_EXTRA_INCLUDE_FILES locale.h)
186 vlc_check_functions_exist(uselocale)
187 set(CMAKE_EXTRA_INCLUDE_FILES)
188
189 set(CMAKE_REQUIRED_LIBRARIES)
190
191 check_library_exists(poll poll "" HAVE_POLL)
192
193 check_c_source_compiles(
194 "#include <langinfo.h>
195 int main() { char* cs = nl_langinfo(CODESET); }"
196 HAVE_LANGINFO_CODESET)
197
198 vlc_check_type("struct addrinfo" "sys/socket.h;netdb.h")
199 if(HAVE_STRUCT_ADDRINFO)
200   set(HAVE_ADDRINFO ON)
201 endif(HAVE_STRUCT_ADDRINFO)
202 vlc_check_type("struct timespec" "time.h")
203
204 check_c_source_compiles (
205 "#include <stdint.h> \n #ifdef UINTMAX \n #error no uintmax
206  #endif
207  int main() { return 0;}" HAVE_STDINT_H_WITH_UINTMAX)
208
209 check_symbol_exists(ntohl "sys/param.h"  NTOHL_IN_SYS_PARAM_H)
210 check_symbol_exists(scandir "dirent.h"   HAVE_SCANDIR)
211 check_symbol_exists(localtime_r "time.h" HAVE_LOCALTIME_R)
212 check_symbol_exists(alloca "alloca.h"    HAVE_ALLOCA)
213
214 check_symbol_exists(va_copy "stdarg.h"   HAVE_VACOPY)
215 check_symbol_exists(__va_copy "stdarg.h" HAVE___VA_COPY)
216
217
218 check_symbol_exists(getnameinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETNAMEINFO)
219 check_symbol_exists(getaddrinfo "sys/types.h;sys/socket.h;netdb.h" HAVE_GETADDRINFO)
220 if(NOT HAVE_GETADDRINFO)
221     check_library_exists(getaddrinfo nsl "" HAVE_GETADDRINFO)
222 endif(NOT HAVE_GETADDRINFO)
223
224 vlc_check_functions_exist(iconv)
225 if(NOT HAVE_ICONV)
226     set(LIBICONV "iconv")
227     check_library_exists(iconv iconv "" HAVE_ICONV)
228 endif(NOT HAVE_ICONV)
229 set(CMAKE_REQUIRED_LIBRARIES ${LIBICONV})
230 CHECK_C_SOURCE_COMPILES(" #include <iconv.h>
231  int main() { return iconv(0, (char **)0, 0, (char**)0, 0); }" ICONV_NO_CONST)
232 if( ICONV_NO_CONST )
233   set( ICONV_CONST "const" )
234 else( ICONV_NO_CONST )
235   set( ICONV_CONST " ")
236 endif( ICONV_NO_CONST )
237 set(CMAKE_REQUIRED_LIBRARIES)
238
239 check_library_exists(rt clock_nanosleep "" HAVE_CLOCK_NANOSLEEP)
240 if (HAVE_CLOCK_NANOSLEEP)
241     set(LIBRT "rt")
242 endif (HAVE_CLOCK_NANOSLEEP)
243
244 check_library_exists(m pow "" HAVE_LIBM)
245 if (HAVE_LIBM)
246     set (LIBM "m")
247 endif (HAVE_LIBM)
248
249 check_symbol_exists(connect "sys/types.h;sys/socket.h" HAVE_CONNECT)
250 if(NOT HAVE_CONNECT)
251     check_library_exists(connect socket "" HAVE_CONNECT)
252     if(NOT HAVE_CONNECT)
253         vlc_module_add_link_libraries(libvlc connect)
254         vlc_module_add_link_libraries(cdda   connect)
255         vlc_module_add_link_libraries(cddax  connect)
256     endif(NOT HAVE_CONNECT)
257 endif(NOT HAVE_CONNECT)
258
259 ###########################################################
260 # Other check
261 ###########################################################
262
263 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_test_inline.cmake )
264
265 ###########################################################
266 # Platform check
267 ###########################################################
268
269 if(APPLE)
270     include( ${CMAKE_SOURCE_DIR}/cmake/vlc_find_frameworks.cmake )
271
272     # Mac OS X (10.4 and 10.5)  can't poll a tty properly
273     # So we deactivate its uses
274     set(HAVE_POLL OFF)
275
276     if(ENABLE_NO_SYMBOL_CHECK)
277         set(DYNAMIC_LOOKUP "-undefined dynamic_lookup")
278     else(ENABLE_NO_SYMBOL_CHECK)
279         set(DYNAMIC_LOOKUP)
280     endif(ENABLE_NO_SYMBOL_CHECK)
281     set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS
282      "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} ${DYNAMIC_LOOKUP}")
283     set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
284      "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} ${DYNAMIC_LOOKUP}")
285
286     # For pre-10.5
287     set( CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_C_FLAGS} -fno-common")
288
289     set(SYS_DARWIN 1)
290     add_definitions(-std=gnu99) # Hack for obj-c files to be compiled with gnu99
291     vlc_enable_modules(macosx minimal_macosx opengllayer
292                        access_eyetv quartztext auhal)
293
294     # On Pre-10.5
295     vlc_module_add_link_flags (ffmpeg "-read_only_relocs warning")
296
297    # vlc_check_include_files (ApplicationServices/ApplicationServices.h)
298    # vlc_check_include_files (Carbon/Carbon.h)
299    # vlc_check_include_files (CoreAudio/CoreAudio.h)
300
301    # check_symbol_exists (CFLocaleCopyCurrent "CoreFoundation/CoreFoundation.h" "" HAVE_CFLOCALECOPYCURRENT)
302    # check_symbol_exists (CFPreferencesCopyAppValue "CoreFoundation/CoreFoundation.h" "" HAVE_CFPREFERENCESCOPYAPPVALUE)
303
304     vlc_find_frameworks(Cocoa Carbon OpenGL AGL IOKit Quicktime
305                         WebKit QuartzCore Foundation ApplicationServices
306                         CoreAudio AudioUnit AudioToolbox)
307     vlc_module_add_link_libraries(macosx
308         ${Cocoa_FRAMEWORKS}
309         ${IOKit_FRAMEWORKS}
310         ${OpenGL_FRAMEWORKS}
311         ${AGL_FRAMEWORKS}
312         ${Quicktime_FRAMEWORKS}
313         ${WebKit_FRAMEWORKS})
314     vlc_module_add_link_libraries(minimal_macosx
315         ${Cocoa_FRAMEWORKS}
316         ${Carbon_FRAMEWORKS}
317         ${OpenGL_FRAMEWORKS}
318         ${AGL_FRAMEWORKS})
319     vlc_module_add_link_libraries(access_eyetv
320         ${Foundation_FRAMEWORKS})
321     vlc_module_add_link_libraries(opengllayer
322          ${Cocoa_FRAMEWORKS}
323          ${QuartzCore_FRAMEWORKS}
324          ${OpenGL_FRAMEWORKS} )
325     vlc_module_add_link_libraries(quartztext
326          ${Carbon_FRAMEWORKS}
327          ${ApplicationServices_FRAMEWORKS} )
328     vlc_module_add_link_libraries(auhal
329          ${Carbon_FRAMEWORKS}
330          ${CoreAudio_FRAMEWORKS}
331          ${AudioUnit_FRAMEWORKS}
332          ${AudioToolbox_FRAMEWORKS} )
333     vlc_module_add_link_libraries(mp4 ${IOKit_FRAMEWORKS} )
334     vlc_module_add_link_libraries(mkv ${IOKit_FRAMEWORKS} )
335
336     add_executable(VLC MACOSX_BUNDLE src/vlc.c)
337     target_link_libraries(VLC libvlc)
338     set( MacOS ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/MacOS )
339     add_custom_command(
340         TARGET VLC
341         POST_BUILD
342         COMMAND rm -Rf ${CMAKE_CURRENT_BINARY_DIR}/tmp
343         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tmp/modules/gui/macosx
344         COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx
345         COMMAND for i in vlc.xcodeproj Resources README.MacOSX.rtf\; do cp -R ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx\; done
346         COMMAND for i in AUTHORS COPYING THANKS\;do cp ${CMAKE_CURRENT_SOURCE_DIR}/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp\; done
347         COMMAND for i in AppleRemote.h AppleRemote.m about.h about.m applescript.h applescript.m controls.h controls.m equalizer.h equalizer.m intf.h intf.m macosx.m misc.h misc.m open.h open.m output.h output.m playlist.h playlist.m playlistinfo.h playlistinfo.m prefs_widgets.h prefs_widgets.m prefs.h prefs.m vout.h voutqt.m voutgl.m wizard.h wizard.m extended.h extended.m bookmarks.h bookmarks.m sfilters.h sfilters.m update.h update.m interaction.h interaction.m embeddedwindow.h embeddedwindow.m fspanel.h fspanel.m vout.m\; do cp ${CMAKE_CURRENT_SOURCE_DIR}/modules/gui/macosx/$$i ${CMAKE_CURRENT_BINARY_DIR}/tmp/modules/gui/macosx\; done
348         COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx && xcodebuild -target vlc | grep -vE '^\([ \\t]|$$\)' && cd ../../../../ && cp ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Info.plist ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents && cp -R ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Resources/English.lproj ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources
349         COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/Resources ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents
350         COMMAND find -d ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources -type d -name \\.svn -exec rm -rf {} "\;"
351         COMMAND rm -rf ${MacOS}/modules ${MacOS}/locale ${MacOS}/share
352         COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/share ${MacOS}/share
353         COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/modules ${MacOS}/modules
354         COMMAND find ${CMAKE_BINARY_DIR}/po -name *.gmo -exec sh -c \"mkdir -p ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES\; ln -s {} ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES/vlc.mo\" "\;"
355         COMMAND ln -sf VLC ${MacOS}/clivlc #useless?
356         COMMAND printf "APPLVLC#" > ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/PkgInfo
357         COMMAND rm -Rf ${CMAKE_CURRENT_BINARY_DIR}/tmp
358     )
359     set( MacOS )
360
361 endif(APPLE)
362
363 ###########################################################
364 # info
365 ###########################################################
366
367 macro(command_to_configvar command var)
368  execute_process(
369   COMMAND sh -c "${command}"
370   OUTPUT_VARIABLE ${var}
371   OUTPUT_STRIP_TRAILING_WHITESPACE)
372  string( REPLACE "\n" "\\n" ${var} "${${var}}")
373 endmacro(command_to_configvar)
374
375 command_to_configvar( "whoami" VLC_COMPILE_BY )
376 command_to_configvar( "hostname" VLC_COMPILE_HOST )
377 command_to_configvar( "hostname" VLC_COMPILE_DOMAIN )
378 command_to_configvar( "${CMAKE_C_COMPILER} --version" VLC_COMPILER )
379 # FIXME: WTF? this is not the configure line!
380 command_to_configvar( "${CMAKE_C_COMPILER} --version" CONFIGURE_LINE )
381 set( VLC_COMPILER "${CMAKE_C_COMPILER}" )
382
383 ###########################################################
384 # Modules: Following are all listed in options
385 ###########################################################
386
387 # This modules are enabled by default but can still be disabled manually
388 vlc_enable_modules(dummy logger memcpy)
389 vlc_enable_modules(mpgv mpga m4v m4a h264 vc1 demux_cdg cdg ps pva avi mp4 rawdv rawvid nsv real aiff mjpeg demuxdump flacsys tta)
390 vlc_enable_modules(cvdsub svcdsub spudec subsdec subsusf t140 dvbsub cc mpeg_audio lpcm a52 dts cinepak flac)
391 vlc_enable_modules(deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise grain extract sharpen)
392 vlc_enable_modules(converter_fixed mono)
393 vlc_enable_modules(trivial_resampler ugly_resampler)
394 vlc_enable_modules(trivial_channel_mixer trivial_mixer)
395 vlc_enable_modules(playlist export nsc xtag)
396 vlc_enable_modules(i420_rgb grey_yuv rawvideo blend scale image logo magnify puzzle colorthres)
397 vlc_enable_modules(wav araw subtitle vobsub adpcm a52sys dtssys au ty voc xa nuv smf)
398 vlc_enable_modules(access_directory access_file access_udp access_tcp)
399 vlc_enable_modules(access_http access_mms access_ftp)
400 vlc_enable_modules(access_filter_bandwidth)
401 vlc_enable_modules(packetizer_mpegvideo packetizer_h264)
402 vlc_enable_modules(packetizer_mpeg4video packetizer_mpeg4audio)
403 vlc_enable_modules(packetizer_vc1)
404 vlc_enable_modules(spatializer atmo blendbench croppadd)
405 vlc_enable_modules(asf cmml)
406 vlc_enable_modules(vmem visual growl_udp)
407
408 set(enabled ${ENABLE_STREAM_OUT})
409 vlc_register_modules(${enabled} access_output_dummy access_output_udp access_output_file access_output_http)
410 vlc_register_modules(${enabled} mux_ps mux_avi mux_mp4 mux_asf mux_dummy mux_wav mux_mpjpeg)
411 vlc_register_modules(${enabled} packetizer_copy)
412
413 vlc_register_modules(${enabled} stream_out_dummy stream_out_standard stream_out_es stream_out_rtp stream_out_description vod_rtsp)
414 vlc_register_modules(${enabled} stream_out_duplicate stream_out_display stream_out_transcode stream_out_bridge stream_out_mosaic_bridge stream_out_autodel)
415 vlc_register_modules(${enabled} stream_out_gather)
416 # vlc_register_modules(${enabled} stream_out_transrate)
417 # vlc_register_modules(${enabled} rtcp)
418 vlc_register_modules(${enabled} profile_parser)
419
420 if(NOT mingwce)
421    set(enabled ON)
422 endif(NOT mingwce)
423 vlc_register_modules(${enabled} access_fake access_filter_timeshift access_filter_record access_filter_dump)
424 vlc_register_modules(${enabled} gestures rc telnet hotkeys showintf marq podcast shout sap fake folder)
425 vlc_register_modules(${enabled} rss mosaic wall motiondetect clone crop erase bluescreen alphamask gaussianblur)
426 vlc_register_modules(${enabled} i420_yuy2 i422_yuy2 i420_ymga i422_i420 yuy2_i422 yuy2_i420 chroma_chain)
427 vlc_register_modules(${enabled} aout_file linear_resampler bandlimited_resampler)
428 vlc_register_modules(${enabled} float32_mixer spdif_mixer simple_channel_mixer)
429 vlc_register_modules(${enabled} dolby_surround_decoder headphone_channel_mixer normvol equalizer param_eq)
430 vlc_register_modules(${enabled} converter_float a52tospdif dtstospdif audio_format)
431 set(enabled)
432
433 if(NOT WIN32)
434    vlc_enable_modules(screensaver signals dynamicoverlay) #motion
435 endif(NOT WIN32)
436
437 # This module is disabled because the CMakeList.txt which
438 # is generated isn't correct. We'll put that back
439 # when cmake will be accepted as default build system
440 vlc_disable_modules(motion)
441
442 ###########################################################
443 # libraries
444 ###########################################################
445
446 include_directories(${CONTRIB_INCLUDE})
447
448 #fixme: use find_package(cddb 0.9.5)
449 pkg_check_modules(LIBCDDB libcddb>=0.9.5)
450 if(${LIBCDDB_FOUND})
451   vlc_module_add_link_libraries(cdda ${LIBCDDB_LIBRARIES})
452   vlc_add_module_compile_flag(cdda ${LIBCDDB_CFLAGS} )
453 endif(${LIBCDDB_FOUND})
454
455 find_package(Dlopen)
456 set(HAVE_DL_DLOPEN ${Dlopen_FOUND})
457
458 # Advanced Linux Sound Architecture (ALSA)
459 pkg_check_modules(ALSA alsa>=1.0.0-rc4)
460 if (${ALSA_FOUND})
461   set (HAVE_ALSA_NEW_API "1")
462 else (${ALSA_FOUND})
463   pkg_check_modules(ALSA alsa)
464 endif (${ALSA_FOUND})
465
466 if (${ALSA_FOUND})
467   set (HAVE_ALSA "1")
468   vlc_enable_modules(alsa)
469   vlc_add_module_compile_flag(alsa ${ALSA_CFLAGS})
470   vlc_module_add_link_libraries(alsa ${ALSA_LIBRARIES})
471 endif (${ALSA_FOUND})
472
473 # Open Sound System (OSS)
474 # TODO
475
476 find_package(FFmpeg)
477 if(FFmpeg_FOUND)
478   string(REPLACE ";" " " FFmpeg_CFLAGS "${FFmpeg_CFLAGS}")
479   set( CMAKE_REQUIRED_FLAGS_saved ${CMAKE_REQUIRED_FLAGS} )
480   set( CMAKE_REQUIRED_FLAGS ${FFmpeg_CFLAGS} )
481
482   vlc_check_include_files (ffmpeg/avcodec.h libavcodec/avcodec.h)
483   vlc_check_include_files (ffmpeg/avutil.h libavutil/avutil.h)
484   vlc_check_include_files (ffmpeg/swscale.h libswscale/swscale.h)
485   check_c_source_compiles( "#include <stdint.h>\n#include <postproc/postprocess.h>\nint main(){return 0;}" HAVE_POSTPROC_POSTPROCESS_H )
486   vlc_check_include_files (libpostproc/postprocess.h)
487   
488   message( STATUS "avcodec found ${HAVE_FFMPEG_AVCODEC_H} || ${HAVE_LIBAVCODEC_AVCODEC_H}")
489   message( STATUS "avutil found ${HAVE_FFMPEG_AVUTIL_H} || ${HAVE_LIBAVUTIL_AVUTIL_H}")
490   message( STATUS "swscale found ${HAVE_FFMPEG_SWSCALE_H} || ${HAVE_LIBSWSCALE_SWSCALE_H}")
491   message( STATUS "postprocess found ${HAVE_POSTPROC_POSTPROCESS_H} || ${HAVE_LIBPOSTPROC_POSTPROCESS_H}")
492
493   vlc_enable_modules(ffmpeg)
494   vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS})
495   vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
496   
497   set( CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_saved} )
498   set( CMAKE_REQUIRED_FLAGS_saved )
499 endif(FFmpeg_FOUND)
500
501 find_package(Lua)
502 if(Lua_FOUND)
503   set(HAVE_LUA TRUE)
504   vlc_enable_modules(lua)
505   vlc_check_include_files (lua.h lualib.h)
506   vlc_add_module_compile_flag(lua ${Lua_CFLAGS} )
507   vlc_module_add_link_libraries(lua ${Lua_LIBRARIES})
508 endif(Lua_FOUND)
509
510 find_package(Qt4)
511 if(QT4_FOUND)
512   set(HAVE_QT4 TRUE)
513   include_directories(${QT_INCLUDES})
514   vlc_check_include_files (qt.h)
515   vlc_enable_modules(qt4)
516   #execute_process leaves the trailing newline appended to the variable, unlike exec_program
517   #execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=prefix QtCore OUTPUT_VARIABLE QT4LOCALEDIR)
518   exec_program( ${PKG_CONFIG_EXECUTABLE} ARGS --variable=prefix QtCore OUTPUT_VARIABLE QT4LOCALEDIR)
519   set(QT4LOCALEDIR ${QT4LOCALEDIR}/share/qt4/translations )
520   vlc_add_module_compile_flag(qt4 ${QT_CFLAGS})
521   vlc_add_module_compile_flag(qt4 -DQT4LOCALEDIR=\\\\"${QT4LOCALEDIR}\\\\" )
522   vlc_module_add_link_libraries(qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
523
524   # Define our own qt4_wrap_ui macro to match wanted behaviour
525   MACRO (VLC_QT4_WRAP_UI outfiles )
526     FOREACH (it ${ARGN})
527      string(REPLACE ".ui" ".h" outfile "${it}")
528       GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
529       SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
530       ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
531         COMMAND mkdir -p `dirname ${outfile}`
532         COMMAND ${QT_UIC_EXECUTABLE}
533         ARGS -o ${outfile} ${infile}
534         MAIN_DEPENDENCY ${infile})
535       SET(${outfiles} ${${outfiles}} ${outfile})
536     ENDFOREACH (it)
537   ENDMACRO (VLC_QT4_WRAP_UI)
538
539   MACRO (VLC_QT4_GENERATE_MOC outfiles flags )
540     string(REGEX MATCHALL "[^\\ ]+" flags_list ${flags})
541     FOREACH (it ${ARGN})
542       string(REPLACE ".hpp" ".moc.cpp" outfile "${it}")
543       GET_FILENAME_COMPONENT(infile ${it} ABSOLUTE)
544       SET(outfile ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
545       ADD_CUSTOM_COMMAND(OUTPUT ${outfile}
546         COMMAND mkdir -p `dirname ${outfile}`
547         COMMAND ${QT_MOC_EXECUTABLE} 
548         ARGS ${flags_list}
549         ARGS -I ${CMAKE_BINARY_DIR}/include
550         ARGS -o ${outfile} ${infile}
551         MAIN_DEPENDENCY ${it}
552         )
553       SET(${outfiles} ${${outfiles}} ${outfile})
554     ENDFOREACH (it)
555   ENDMACRO (VLC_QT4_GENERATE_MOC)
556
557
558 endif(QT4_FOUND)
559
560 find_package(OpenGL)
561 if(OPENGL_FOUND)
562   vlc_enable_modules(opengl)
563   vlc_check_include_files (gl/gl.h)
564   vlc_check_include_files (gl/glu.h)
565   vlc_check_include_files (gl/glx.h)
566   vlc_add_module_compile_flag(opengl ${OPENGL_CFLAGS})
567   vlc_module_add_link_libraries(opengl ${OPENGL_LIBRARIES})
568 endif(OPENGL_FOUND)
569
570 find_package(Matroska 0.7.7)
571 if(Matroska_FOUND)
572   vlc_enable_modules(mkv)
573   vlc_check_include_files (matroska/KaxAttachments.h)
574   vlc_check_include_files (matroska/KaxVersion.h)
575   vlc_module_add_link_libraries(mkv ${Matroska_LIBRARIES})
576 endif(Matroska_FOUND)
577
578 find_package(Live555)
579 if(Live555_FOUND)
580   vlc_enable_modules(live555)
581   vlc_add_module_compile_flag(live555 ${Live555_CFLAGS})
582   vlc_module_add_link_libraries(live555 ${Live555_LIBRARIES})
583 endif(Live555_FOUND)
584
585 set(CURSES_NEED_NCURSES TRUE)
586 find_package(Curses)
587 if(CURSES_LIBRARIES)
588   vlc_enable_modules(ncurses)
589   vlc_module_add_link_libraries(ncurses ${CURSES_LIBRARIES})
590 endif(CURSES_LIBRARIES)
591
592 find_package(X11)
593 if(X11_FOUND)
594   vlc_enable_modules(x11 panoramix)
595   vlc_check_include_files (X11/Xlib.h)
596   vlc_module_add_link_libraries(x11       ${X11_LIBRARIES})
597   vlc_module_add_link_libraries(panoramix ${X11_LIBRARIES})
598 endif(X11_FOUND)
599
600 vlc_check_include_files (linux/fb.h)
601 if(HAVE_LINUX_FB_H)
602   vlc_enable_modules(fb)
603 endif(HAVE_LINUX_FB_H)
604
605 find_package(Mpeg2)
606 if(Mpeg2_FOUND)
607   vlc_enable_modules(libmpeg2)
608   check_include_files ("stdint.h;mpeg2dec/mpeg2.h" HAVE_MPEG2DEC_MPEG2_H)
609   vlc_module_add_link_libraries(libmpeg2 ${Mpeg2_LIBRARIES})
610 endif(Mpeg2_FOUND)
611
612 find_package(Dvbpsi)
613 if(Dvbpsi_FOUND)
614   vlc_register_modules(${ENABLE_STREAM_OUT} mux_ts)
615   vlc_enable_modules(ts)
616   check_include_files ("stdint.h;dvbpsi/dvbpsi.h;dvbpsi/demux.h;dvbpsi/descriptor.h;dvbpsi/pat.h;dvbpsi/pmt.h;dvbpsi/sdt.h;dvbpsi/dr.h" HAVE_DVBPSI_DR_H)
617   vlc_module_add_link_libraries(ts      ${Dvbpsi_LIBRARIES})
618   vlc_module_add_link_libraries(mux_ts  ${Dvbpsi_LIBRARIES})
619   vlc_module_add_link_libraries(dvb     ${Dvbpsi_LIBRARIES})
620 endif(Dvbpsi_FOUND)
621
622 vlc_check_include_files (id3tag.h zlib.h)
623 if(HAVE_ID3TAG_H AND HAVE_ZLIB_H)
624   vlc_enable_modules(id3tag)
625   vlc_module_add_link_libraries(id3tag  "id3tag;z")
626 endif(HAVE_ID3TAG_H AND HAVE_ZLIB_H)
627
628 find_package(Taglib)
629 if(Taglib_FOUND)
630   set(HAVE_TAGLIB 1)
631   vlc_enable_modules(taglib)
632   vlc_module_add_link_libraries(taglib "${Taglib_LIBRARIES};z")
633   vlc_add_module_compile_flag(taglib "${Taglib_CFLAGS}")
634 endif(Taglib_FOUND)
635
636 vlc_check_include_files (zlib.h)
637 if(HAVE_ZLIB_H)
638   vlc_module_add_link_libraries(access_http z)
639   vlc_module_add_link_libraries(mkv z)
640   vlc_module_add_link_libraries(mp4 z)
641   vlc_module_add_link_libraries(stream_out_bridge z)
642   vlc_module_add_link_libraries(sap z)
643 endif(HAVE_ZLIB_H)
644
645 set(CMAKE_REQUIRED_INCLUDES)
646
647 ###########################################################
648 # Final configuration
649 ###########################################################
650
651 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)