]> git.sesse.net Git - vlc/blobdiff - extras/buildsystem/cmake/include/config.cmake
Cmake: enable a bunch of modules - still a lot TODO
[vlc] / extras / buildsystem / cmake / include / config.cmake
index 219c229115d9819e842844de5560db1d67285824..ff2ec0ef2a7639d0217097cfa327e658b0f9d5b7 100644 (file)
@@ -1,9 +1,60 @@
+###########################################################
+# System Includes
+###########################################################
 include( CheckIncludeFile )
 include (CheckTypeSize)
 include (CheckCSourceCompiles)
 include (CheckSymbolExists)
 include (CheckLibraryExists)
 
+###########################################################
+# Options
+###########################################################
+# Options moved before the custom macro includes because those macros need path values, if the ENABLE_CONTRIB
+# has been set.
+
+OPTION( ENABLE_HTTPD           "Enable httpd server" ON )
+OPTION( ENABLE_STREAM_OUT      "Enable stream output plugins" ON )
+OPTION( ENABLE_VLM             "Enable vlm" ON )
+OPTION( ENABLE_DYNAMIC_PLUGINS "Enable dynamic plugin" ON )
+OPTION( UPDATE_CHECK           "Enable automatic new version checking" OFF )
+OPTION( ENABLE_NO_SYMBOL_CHECK "Don't check symbols of modules against libvlc. (Enabling this option speeds up compilation)" OFF )
+OPTION( ENABLE_CONTRIB         "Attempt to use VLC contrib system to get the third-party libraries" ON )
+OPTION( ENABLE_LOADER          "Enable the win32 codec loader" OFF )
+OPTION( ENABLE_NLS             "Enable translation of the program's messages" ON)
+
+if(ENABLE_CONTRIB)
+
+  set( CONTRIB_INCLUDE ${CMAKE_SOURCE_DIR}/extras/contrib/include)
+  set( CONTRIB_LIB ${CMAKE_SOURCE_DIR}/extras/contrib/lib)
+  set( CONTRIB_PROGRAM ${CMAKE_SOURCE_DIR}/extras/contrib/bin)
+  set( CMAKE_LIBRARY_PATH ${CONTRIB_LIB} ${CMAKE_LIBRARY_PATH} )
+  set( CMAKE_PROGRAM_PATH ${CONTRIB_PROGRAM} ${CMAKE_PROGRAM_PATH} )
+  set( CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
+
+  # include extras/contrib/include in the header search pathes
+  include_directories(${CONTRIB_INCLUDE})
+  set( CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${CONTRIB_INCLUDE} )
+  
+  # include the extras/contrib/bin to the search path, otherwise, when finding programs it will automatically
+  # default to system applications (e.g. we should favor the extras/contrib/bin/pkg-config over the system defined
+  # one).
+  if(WIN32)
+    set( ENV{PATH} "${CONTRIB_PROGRAM};$ENV{PATH}" )
+  else(WIN32)
+    set( ENV{PATH} "${CONTRIB_PROGRAM}:$ENV{PATH}" )
+  endif(WIN32)
+endif(ENABLE_CONTRIB)
+
+###########################################################
+# Custom Macro Includes
+###########################################################
+
 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_include_files.cmake )
 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_functions_exist.cmake )
 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_add_compile_flag.cmake )
@@ -11,16 +62,17 @@ include( ${CMAKE_SOURCE_DIR}/cmake/vlc_check_type.cmake )
 include( ${CMAKE_SOURCE_DIR}/cmake/pkg_check_modules.cmake )
 
 ###########################################################
-# VERSION
+# Versioning
 ###########################################################
 
-set(VLC_VERSION_MAJOR 0)
-set(VLC_VERSION_MINOR 9)
-set(VLC_VERSION_PATCH 0)
+set(VLC_VERSION_MAJOR "0")
+set(VLC_VERSION_MINOR "9")
+set(VLC_VERSION_PATCH "0")
 set(VLC_VERSION_EXTRA "-svn")
 set(VLC_VERSION ${VLC_VERSION_MAJOR}.${VLC_VERSION_MINOR}.${VLC_VERSION_PATCH}${VLC_VERSION_EXTRA})
 
 set(PACKAGE "vlc")
+set(PACKAGE_NAME "vlc") #for gettext
 set(PACKAGE_VERSION "${VLC_VERSION}")
 set(PACKAGE_STRING "vlc")
 set(VERSION_MESSAGE "vlc-${VLC_VERSION}")
@@ -32,15 +84,9 @@ set(PACKAGE_VERSION_MINOR "${VLC_VERSION_MINOR}")
 set(PACKAGE_VERSION_REVISION "${VLC_VERSION_PATCH}")
 
 ###########################################################
-# Options
+# Preflight Checks
 ###########################################################
 
-OPTION( ENABLE_HTTPD           "Enable httpd server" ON )
-OPTION( ENABLE_VLM             "Enable vlm" ON )
-OPTION( ENABLE_DYNAMIC_PLUGINS "Enable dynamic plugin" ON )
-OPTION( UPDATE_CHECK           "Enable automatic new version checking" OFF )
-OPTION( ENABLE_NO_SYMBOL_CHECK "Don't check symbols of modules against libvlc. (Enabling this option speeds up compilation)" OFF )
-
 IF (NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE "Debug" CACHE STRING  "build type determining compiler flags" FORCE )
 endif(NOT CMAKE_BUILD_TYPE )
@@ -54,6 +100,10 @@ endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
 set( HAVE_DYNAMIC_PLUGINS ${ENABLE_DYNAMIC_PLUGINS})
 set( LIBEXT ${CMAKE_SHARED_MODULE_SUFFIX})
 
+check_c_source_compiles(
+    "struct __attribute__((__packed__)) foo { int a; } b; int main(){return 0;}"
+    HAVE_ATTRIBUTE_PACKED)
+
 ###########################################################
 # Headers checks
 ###########################################################
@@ -83,10 +133,11 @@ find_package (Threads)
 ###########################################################
 # Functions/structures checks
 ###########################################################
+
 set(CMAKE_REQUIRED_LIBRARIES c)
 set(CMAKE_EXTRA_INCLUDE_FILES string.h)
-vlc_check_functions_exist(strcpy strcasecmp)
-vlc_check_functions_exist(strcasestr strdup)
+vlc_check_functions_exist(strcpy strcasecmp strncasecmp)
+vlc_check_functions_exist(strcasestr stristr strdup)
 vlc_check_functions_exist(strndup stricmp strnicmp)
 vlc_check_functions_exist(atof strtoll atoll lldiv)
 vlc_check_functions_exist(strlcpy stristr strnlen strsep)
@@ -126,6 +177,13 @@ set(CMAKE_EXTRA_INCLUDE_FILES)
 
 set(CMAKE_EXTRA_INCLUDE_FILES sys/mman.h)
 vlc_check_functions_exist(mmap)
+if(HAVE_MMAP)
+  vlc_enable_modules(access_mmap)
+endif(HAVE_MMAP)
+set(CMAKE_EXTRA_INCLUDE_FILES)
+
+set(CMAKE_EXTRA_INCLUDE_FILES locale.h)
+vlc_check_functions_exist(uselocale)
 set(CMAKE_EXTRA_INCLUDE_FILES)
 
 set(CMAKE_REQUIRED_LIBRARIES)
@@ -201,14 +259,20 @@ endif(NOT HAVE_CONNECT)
 ###########################################################
 # Other check
 ###########################################################
+
 include( ${CMAKE_SOURCE_DIR}/cmake/vlc_test_inline.cmake )
 
 ###########################################################
 # Platform check
 ###########################################################
+
 if(APPLE)
     include( ${CMAKE_SOURCE_DIR}/cmake/vlc_find_frameworks.cmake )
 
+    # Mac OS X (10.4 and 10.5)  can't poll a tty properly
+    # So we deactivate its uses
+    set(HAVE_POLL OFF)
+
     if(ENABLE_NO_SYMBOL_CHECK)
         set(DYNAMIC_LOOKUP "-undefined dynamic_lookup")
     else(ENABLE_NO_SYMBOL_CHECK)
@@ -290,6 +354,7 @@ if(APPLE)
         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\" "\;"
         COMMAND ln -sf VLC ${MacOS}/clivlc #useless?
         COMMAND printf "APPLVLC#" > ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/PkgInfo
+        COMMAND rm -Rf ${CMAKE_CURRENT_BINARY_DIR}/tmp
     )
     set( MacOS )
 
@@ -315,12 +380,11 @@ command_to_configvar( "${CMAKE_C_COMPILER} --version" VLC_COMPILER )
 command_to_configvar( "${CMAKE_C_COMPILER} --version" CONFIGURE_LINE )
 set( VLC_COMPILER "${CMAKE_C_COMPILER}" )
 
-
 ###########################################################
 # Modules: Following are all listed in options
 ###########################################################
 
-# This module will be enabled but user could disabled it
+# This modules are enabled by default but can still be disabled manually
 vlc_enable_modules(dummy logger memcpy)
 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)
 vlc_enable_modules(cvdsub svcdsub spudec subsdec subsusf t140 dvbsub cc mpeg_audio lpcm a52 dts cinepak flac)
@@ -337,8 +401,21 @@ vlc_enable_modules(access_filter_bandwidth)
 vlc_enable_modules(packetizer_mpegvideo packetizer_h264)
 vlc_enable_modules(packetizer_mpeg4video packetizer_mpeg4audio)
 vlc_enable_modules(packetizer_vc1)
-vlc_enable_modules(spatializer)
+vlc_enable_modules(spatializer atmo blendbench croppadd)
 vlc_enable_modules(asf)
+vlc_enable_modules(vmem visual growl_udp)
+
+set(enabled ${ENABLE_STREAM_OUT})
+vlc_register_modules(${enabled} access_output_dummy access_output_udp access_output_file access_output_http)
+vlc_register_modules(${enabled} mux_ps mux_avi mux_mp4 mux_asf mux_dummy mux_wav mux_mpjpeg)
+vlc_register_modules(${enabled} packetizer_copy)
+
+vlc_register_modules(${enabled} stream_out_dummy stream_out_standard stream_out_es stream_out_rtp stream_out_description vod_rtsp)
+vlc_register_modules(${enabled} stream_out_duplicate stream_out_display stream_out_transcode stream_out_bridge stream_out_mosaic_bridge stream_out_autodel)
+vlc_register_modules(${enabled} stream_out_gather)
+# vlc_register_modules(${enabled} stream_out_transrate)
+# vlc_register_modules(${enabled} rtcp)
+vlc_register_modules(${enabled} profile_parser)
 
 if(NOT mingwce)
    set(enabled ON)
@@ -354,7 +431,7 @@ vlc_register_modules(${enabled} converter_float a52tospdif dtstospdif audio_form
 set(enabled)
 
 if(NOT WIN32)
-   vlc_enable_modules(screensaver)
+   vlc_enable_modules(screensaver signals dynamicoverlay) #motion
 endif(NOT WIN32)
 
 # This module is disabled because the CMakeList.txt which
@@ -365,23 +442,8 @@ vlc_disable_modules(motion)
 ###########################################################
 # libraries
 ###########################################################
-OPTION( ENABLE_CONTRIB "Attempt to use VLC contrib system to get the third-party libraries" ON )
-if(ENABLE_CONTRIB)
-  set( CONTRIB_INCLUDE ${CMAKE_SOURCE_DIR}/extras/contrib/include)
-  set( CONTRIB_LIB ${CMAKE_SOURCE_DIR}/extras/contrib/lib)
-  set( CONTRIB_PROGRAM ${CMAKE_SOURCE_DIR}/extras/contrib/bin)
-  set( CMAKE_LIBRARY_PATH ${CONTRIB_LIB} ${CMAKE_LIBRARY_PATH} )
-  set( CMAKE_PROGRAM_PATH ${CONTRIB_PROGRAM} ${CMAKE_PROGRAM_PATH} )
-  set( CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
-  add_definitions(-I${CONTRIB_INCLUDE})
-endif(ENABLE_CONTRIB)
 
-set(CMAKE_REQUIRED_INCLUDES ${CONTRIB_INCLUDE})
+include_directories(${CONTRIB_INCLUDE})
 
 #fixme: use find_package(cddb 0.9.5)
 pkg_check_modules(LIBCDDB libcddb>=0.9.5)
@@ -413,13 +475,27 @@ endif (${ALSA_FOUND})
 
 find_package(FFmpeg)
 if(FFmpeg_FOUND)
-  vlc_check_include_files (ffmpeg/avcodec.h)
-  vlc_check_include_files (ffmpeg/avutil.h)
-  vlc_check_include_files (ffmpeg/swscale.h)
-  check_include_files ("stdint.h;postproc/postprocess.h" HAVE_POSTPROC_POSTPROCESS_H)
+  string(REPLACE ";" " " FFmpeg_CFLAGS "${FFmpeg_CFLAGS}")
+  set( CMAKE_REQUIRED_FLAGS_saved ${CMAKE_REQUIRED_FLAGS} )
+  set( CMAKE_REQUIRED_FLAGS ${FFmpeg_CFLAGS} )
+
+  vlc_check_include_files (ffmpeg/avcodec.h libavcodec/avcodec.h)
+  vlc_check_include_files (ffmpeg/avutil.h libavutil/avutil.h)
+  vlc_check_include_files (ffmpeg/swscale.h libswscale/swscale.h)
+  check_c_source_compiles( "#include <stdint.h>\n#include <postproc/postprocess.h>\nint main(){return 0;}" HAVE_POSTPROC_POSTPROCESS_H )
+  vlc_check_include_files (libpostproc/postprocess.h)
+  
+  message( STATUS "avcodec found ${HAVE_FFMPEG_AVCODEC_H} || ${HAVE_LIBAVCODEC_AVCODEC_H}")
+  message( STATUS "avutil found ${HAVE_FFMPEG_AVUTIL_H} || ${HAVE_LIBAVUTIL_AVUTIL_H}")
+  message( STATUS "swscale found ${HAVE_FFMPEG_SWSCALE_H} || ${HAVE_LIBSWSCALE_SWSCALE_H}")
+  message( STATUS "postprocess found ${HAVE_POSTPROC_POSTPROCESS_H} || ${HAVE_LIBPOSTPROC_POSTPROCESS_H}")
+
   vlc_enable_modules(ffmpeg)
-  vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS} )
+  vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS})
   vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
+  
+  set( CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_saved} )
+  set( CMAKE_REQUIRED_FLAGS_saved )
 endif(FFmpeg_FOUND)
 
 find_package(Lua)
@@ -437,7 +513,12 @@ if(QT4_FOUND)
   include_directories(${QT_INCLUDES})
   vlc_check_include_files (qt.h)
   vlc_enable_modules(qt4)
-  vlc_add_module_compile_flag(qt4 ${QT_CFLAGS} )
+  #execute_process leaves the trailing newline appended to the variable, unlike exec_program
+  #execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=prefix QtCore OUTPUT_VARIABLE QT4LOCALEDIR)
+  exec_program( ${PKG_CONFIG_EXECUTABLE} ARGS --variable=prefix QtCore OUTPUT_VARIABLE QT4LOCALEDIR)
+  set(QT4LOCALEDIR ${QT4LOCALEDIR}/share/qt4/translations )
+  vlc_add_module_compile_flag(qt4 ${QT_CFLAGS})
+  vlc_add_module_compile_flag(qt4 -DQT4LOCALEDIR=\\\\"${QT4LOCALEDIR}\\\\" )
   vlc_module_add_link_libraries(qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
 
   # Define our own qt4_wrap_ui macro to match wanted behaviour
@@ -501,6 +582,7 @@ if(Live555_FOUND)
   vlc_module_add_link_libraries(live555 ${Live555_LIBRARIES})
 endif(Live555_FOUND)
 
+set(CURSES_NEED_NCURSES TRUE)
 find_package(Curses)
 if(CURSES_LIBRARIES)
   vlc_enable_modules(ncurses)
@@ -515,6 +597,11 @@ if(X11_FOUND)
   vlc_module_add_link_libraries(panoramix ${X11_LIBRARIES})
 endif(X11_FOUND)
 
+vlc_check_include_files (linux/fb.h)
+if(HAVE_LINUX_FB_H)
+  vlc_enable_modules(fb)
+endif(HAVE_LINUX_FB_H)
+
 find_package(Mpeg2)
 if(Mpeg2_FOUND)
   vlc_enable_modules(libmpeg2)
@@ -524,17 +611,41 @@ endif(Mpeg2_FOUND)
 
 find_package(Dvbpsi)
 if(Dvbpsi_FOUND)
+  vlc_register_modules(${ENABLE_STREAM_OUT} mux_ts)
   vlc_enable_modules(ts)
-  set(CMAKE_REQUIRED_INCLUDES ${CONTRIB_INCLUDE})
   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)
-  vlc_module_add_link_libraries(ts ${Dvbpsi_LIBRARIES})
+  vlc_module_add_link_libraries(ts      ${Dvbpsi_LIBRARIES})
+  vlc_module_add_link_libraries(mux_ts  ${Dvbpsi_LIBRARIES})
+  vlc_module_add_link_libraries(dvb     ${Dvbpsi_LIBRARIES})
 endif(Dvbpsi_FOUND)
 
-
+vlc_check_include_files (id3tag.h zlib.h)
+if(HAVE_ID3TAG_H AND HAVE_ZLIB_H)
+  vlc_enable_modules(id3tag)
+  vlc_module_add_link_libraries(id3tag  "id3tag;z")
+endif(HAVE_ID3TAG_H AND HAVE_ZLIB_H)
+
+find_package(Taglib)
+if(Taglib_FOUND)
+  set(HAVE_TAGLIB 1)
+  vlc_enable_modules(taglib)
+  vlc_module_add_link_libraries(taglib "${Taglib_LIBRARIES};z")
+  vlc_add_module_compile_flag(taglib "${Taglib_CFLAGS}")
+endif(Taglib_FOUND)
+
+vlc_check_include_files (zlib.h)
+if(HAVE_ZLIB_H)
+  vlc_module_add_link_libraries(access_http z)
+  vlc_module_add_link_libraries(mkv z)
+  vlc_module_add_link_libraries(mp4 z)
+  vlc_module_add_link_libraries(stream_out_bridge z)
+  vlc_module_add_link_libraries(sap z)
+endif(HAVE_ZLIB_H)
 
 set(CMAKE_REQUIRED_INCLUDES)
 
 ###########################################################
 # Final configuration
 ###########################################################
+
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)