From 49503891eb45897f96dded68d633d9e37e6eda95 Mon Sep 17 00:00:00 2001 From: Kfir Itzhak Date: Wed, 9 Oct 2013 15:58:14 +0300 Subject: [PATCH] Added ZM_NO_FFMPEG option to skip ffmpeg checks and force building without ffmpeg --- CMakeLists.txt | 136 +++++++++++++++++++++++++------------------------ INSTALL | 1 + 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b1d1d61e..20433e588 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,6 +56,7 @@ set(ZM_WEB_GROUP "" CACHE STRING "The group apache or the local web server runs set(ZM_EXTRA_LIBS "" CACHE STRING "A list of optional libraries, separated by semicolons, e.g. ssl;theora") set(ZM_MYSQL_ENGINE "InnoDB" CACHE STRING "MySQL engine to use with database, default: InnoDB") set(ZM_NO_MMAP "OFF" CACHE BOOL "Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF") +set(ZM_NO_FFMPEG "OFF" CACHE BOOL "Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF") set(ZM_PERL_SUBPREFIX "${CMAKE_INSTALL_LIBDIR}/perl5" CACHE PATH "Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into /lib, default: ${CMAKE_INSTALL_LIBDIR}/perl5") set(ZM_PERL_USE_PATH "${CMAKE_INSTALL_PREFIX}/${ZM_PERL_SUBPREFIX}" CACHE PATH "Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: /") # Only required for cmakecacheimport: @@ -204,76 +205,79 @@ else(MYSQLCLIENT_LIBRARIES) message(FATAL_ERROR "zm requires mysqlclient but it was not found on your system") endif(MYSQLCLIENT_LIBRARIES) -# avformat (using find_library and find_path) -find_library(AVFORMAT_LIBRARIES avformat) -if(AVFORMAT_LIBRARIES) - set(HAVE_LIBAVFORMAT 1) - list(APPEND ZM_BIN_LIBS ${AVFORMAT_LIBRARIES}) - find_path(AVFORMAT_INCLUDE_DIR "libavformat/avformat.h") - if(AVFORMAT_INCLUDE_DIR) - include_directories(${AVFORMAT_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVFORMAT_INCLUDE_DIR}) - endif(AVFORMAT_INCLUDE_DIR) - mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR) - check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H) -endif(AVFORMAT_LIBRARIES) +# Do not check for ffmpeg if ZM_NO_FFMPEG is on +if(NOT ZM_NO_FFMPEG) + # avformat (using find_library and find_path) + find_library(AVFORMAT_LIBRARIES avformat) + if(AVFORMAT_LIBRARIES) + set(HAVE_LIBAVFORMAT 1) + list(APPEND ZM_BIN_LIBS ${AVFORMAT_LIBRARIES}) + find_path(AVFORMAT_INCLUDE_DIR "libavformat/avformat.h") + if(AVFORMAT_INCLUDE_DIR) + include_directories(${AVFORMAT_INCLUDE_DIR}) + set(CMAKE_REQUIRED_INCLUDES ${AVFORMAT_INCLUDE_DIR}) + endif(AVFORMAT_INCLUDE_DIR) + mark_as_advanced(FORCE AVFORMAT_LIBRARIES AVFORMAT_INCLUDE_DIR) + check_include_file("libavformat/avformat.h" HAVE_LIBAVFORMAT_AVFORMAT_H) + endif(AVFORMAT_LIBRARIES) -# avcodec (using find_library and find_path) -find_library(AVCODEC_LIBRARIES avcodec) -if(AVCODEC_LIBRARIES) - set(HAVE_LIBAVCODEC 1) - list(APPEND ZM_BIN_LIBS ${AVCODEC_LIBRARIES}) - find_path(AVCODEC_INCLUDE_DIR "libavcodec/avcodec.h") - if(AVCODEC_INCLUDE_DIR) - include_directories(${AVCODEC_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVCODEC_INCLUDE_DIR}) - endif(AVCODEC_INCLUDE_DIR) - mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR) - check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H) -endif(AVCODEC_LIBRARIES) + # avcodec (using find_library and find_path) + find_library(AVCODEC_LIBRARIES avcodec) + if(AVCODEC_LIBRARIES) + set(HAVE_LIBAVCODEC 1) + list(APPEND ZM_BIN_LIBS ${AVCODEC_LIBRARIES}) + find_path(AVCODEC_INCLUDE_DIR "libavcodec/avcodec.h") + if(AVCODEC_INCLUDE_DIR) + include_directories(${AVCODEC_INCLUDE_DIR}) + set(CMAKE_REQUIRED_INCLUDES ${AVCODEC_INCLUDE_DIR}) + endif(AVCODEC_INCLUDE_DIR) + mark_as_advanced(FORCE AVCODEC_LIBRARIES AVCODEC_INCLUDE_DIR) + check_include_file("libavcodec/avcodec.h" HAVE_LIBAVCODEC_AVCODEC_H) + endif(AVCODEC_LIBRARIES) -# avdevice (using find_library and find_path) -find_library(AVDEVICE_LIBRARIES avdevice) -if(AVDEVICE_LIBRARIES) - set(HAVE_LIBAVDEVICE 1) - list(APPEND ZM_BIN_LIBS ${AVDEVICE_LIBRARIES}) - find_path(AVDEVICE_INCLUDE_DIR "libavdevice/avdevice.h") - if(AVDEVICE_INCLUDE_DIR) - include_directories(${AVDEVICE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVDEVICE_INCLUDE_DIR}) - endif(AVDEVICE_INCLUDE_DIR) - mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR) - check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H) -endif(AVDEVICE_LIBRARIES) + # avdevice (using find_library and find_path) + find_library(AVDEVICE_LIBRARIES avdevice) + if(AVDEVICE_LIBRARIES) + set(HAVE_LIBAVDEVICE 1) + list(APPEND ZM_BIN_LIBS ${AVDEVICE_LIBRARIES}) + find_path(AVDEVICE_INCLUDE_DIR "libavdevice/avdevice.h") + if(AVDEVICE_INCLUDE_DIR) + include_directories(${AVDEVICE_INCLUDE_DIR}) + set(CMAKE_REQUIRED_INCLUDES ${AVDEVICE_INCLUDE_DIR}) + endif(AVDEVICE_INCLUDE_DIR) + mark_as_advanced(FORCE AVDEVICE_LIBRARIES AVDEVICE_INCLUDE_DIR) + check_include_file("libavdevice/avdevice.h" HAVE_LIBAVDEVICE_AVDEVICE_H) + endif(AVDEVICE_LIBRARIES) -# avutil (using find_library and find_path) -find_library(AVUTIL_LIBRARIES avutil) -if(AVUTIL_LIBRARIES) - set(HAVE_LIBAVUTIL 1) - list(APPEND ZM_BIN_LIBS ${AVUTIL_LIBRARIES}) - find_path(AVUTIL_INCLUDE_DIR "libavutil/avutil.h") - if(AVUTIL_INCLUDE_DIR) - include_directories(${AVUTIL_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${AVUTIL_INCLUDE_DIR}) - endif(AVUTIL_INCLUDE_DIR) - mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR) - check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H) - check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H) -endif(AVUTIL_LIBRARIES) + # avutil (using find_library and find_path) + find_library(AVUTIL_LIBRARIES avutil) + if(AVUTIL_LIBRARIES) + set(HAVE_LIBAVUTIL 1) + list(APPEND ZM_BIN_LIBS ${AVUTIL_LIBRARIES}) + find_path(AVUTIL_INCLUDE_DIR "libavutil/avutil.h") + if(AVUTIL_INCLUDE_DIR) + include_directories(${AVUTIL_INCLUDE_DIR}) + set(CMAKE_REQUIRED_INCLUDES ${AVUTIL_INCLUDE_DIR}) + endif(AVUTIL_INCLUDE_DIR) + mark_as_advanced(FORCE AVUTIL_LIBRARIES AVUTIL_INCLUDE_DIR) + check_include_file("libavutil/avutil.h" HAVE_LIBAVUTIL_AVUTIL_H) + check_include_file("libavutil/mathematics.h" HAVE_LIBAVUTIL_MATHEMATICS_H) + endif(AVUTIL_LIBRARIES) -# swscale (using find_library and find_path) -find_library(SWSCALE_LIBRARIES swscale) -if(SWSCALE_LIBRARIES) - set(HAVE_LIBSWSCALE 1) - list(APPEND ZM_BIN_LIBS ${SWSCALE_LIBRARIES}) - find_path(SWSCALE_INCLUDE_DIR "libswscale/swscale.h") - if(SWSCALE_INCLUDE_DIR) - include_directories(${SWSCALE_INCLUDE_DIR}) - set(CMAKE_REQUIRED_INCLUDES ${SWSCALE_INCLUDE_DIR}) - endif(SWSCALE_INCLUDE_DIR) - mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR) - check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H) -endif(SWSCALE_LIBRARIES) + # swscale (using find_library and find_path) + find_library(SWSCALE_LIBRARIES swscale) + if(SWSCALE_LIBRARIES) + set(HAVE_LIBSWSCALE 1) + list(APPEND ZM_BIN_LIBS ${SWSCALE_LIBRARIES}) + find_path(SWSCALE_INCLUDE_DIR "libswscale/swscale.h") + if(SWSCALE_INCLUDE_DIR) + include_directories(${SWSCALE_INCLUDE_DIR}) + set(CMAKE_REQUIRED_INCLUDES ${SWSCALE_INCLUDE_DIR}) + endif(SWSCALE_INCLUDE_DIR) + mark_as_advanced(FORCE SWSCALE_LIBRARIES SWSCALE_INCLUDE_DIR) + check_include_file("libswscale/swscale.h" HAVE_LIBSWSCALE_SWSCALE_H) + endif(SWSCALE_LIBRARIES) +endif(NOT ZM_NO_FFMPEG) # *** END OF LIBRARY CHECKS *** diff --git a/INSTALL b/INSTALL index be56312d1..dce0adbd1 100644 --- a/INSTALL +++ b/INSTALL @@ -48,6 +48,7 @@ Advanced: ZM_EXTRA_LIBS A list of optional libraries, separated by semicolons, e.g. ssl;theora ZM_MYSQL_ENGINE MySQL engine to use with database, default: InnoDB ZM_NO_MMAP Set to ON to not use mmap shared memory. Shouldn't be enabled unless you experience problems with the shared memory. default: OFF + ZM_NO_FFMPEG Set to ON to skip ffmpeg checks and force building ZM without ffmpeg. default: OFF ZM_PERL_SUBPREFIX Use a different directory for the zm perl modules. NOTE: This is a subprefix, e.g. lib will be turned into /lib, default: /perl5 ZM_PERL_USE_PATH Override the include path for zm perl modules. Useful if you are moving the perl modules without using the ZM_PERL_SUBPREFIX option. default: /