diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/FindFFmpeg.cmake | 72 | ||||
| -rw-r--r-- | modules/FindFlac.cmake | 54 | ||||
| -rw-r--r-- | modules/FindOggVorbis.cmake | 86 | 
3 files changed, 212 insertions, 0 deletions
| diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake new file mode 100644 index 00000000..0ec576a9 --- /dev/null +++ b/modules/FindFFmpeg.cmake @@ -0,0 +1,72 @@ +# - Try to find ffmpeg +# Once done this will define +# +#  FFMPEG_FOUND - system has ffmpeg +#  FFMPEG_LIBRARIES - Link these to use ffmpeg +#  FFMPEG_DEFINITIONS - Compiler switches required for using ffmpeg + +# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) + +  # in cache already +  set(FFMPEG_FOUND TRUE) + +else (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) +IF (NOT WIN32) +  # use pkg-config to get the directories and then use these values +  # in the FIND_PATH() and FIND_LIBRARY() calls +  INCLUDE(UsePkgConfig) + +  PKGCONFIG(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) +ENDIF (NOT WIN32) +  #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags} CACHE INTERNAL "The compilation flags for ffmpeg") + +  find_path(FFMPEG_INCLUDE_DIR ffmpeg/avcodec.h +    PATHS +    ${_FFMPEGIncDir} +    NO_DEFAULT_PATH +  ) + +  find_library(AVCODEC_LIBRARIES NAMES avcodec +    PATHS +    ${_FFMPEGLinkDir} +    NO_DEFAULT_PATH +  ) + +  find_library(AVFORMAT_LIBRARIES NAMES avformat +    PATHS +    ${_FFMPEGLinkDir} +    NO_DEFAULT_PATH +  ) + +  find_library(AVUTIL_LIBRARIES NAMES avutil +    PATHS +    ${_FFMPEGLinkDir} +    NO_DEFAULT_PATH +  ) + +  set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVUTIL_LIBRARIES}) + +  if (FFMPEG_LIBRARIES) +     set(FFMPEG_FOUND TRUE) +  endif (FFMPEG_LIBRARIES) + +  if (FFMPEG_FOUND) +    if (NOT FFmpeg_FIND_QUIETLY) +      message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}") +    endif (NOT FFmpeg_FIND_QUIETLY) +  else (FFMPEG_FOUND) +    if (FFmpeg_FIND_REQUIRED) +      message(FATAL_ERROR "Could NOT find FFMPEG") +    endif (FFmpeg_FIND_REQUIRED) +  endif (FFMPEG_FOUND) + +  MARK_AS_ADVANCED(FFMPEG_LIBRARIES) +  MARK_AS_ADVANCED(FFMPEG_INCLUDE_DIR) + +endif (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) diff --git a/modules/FindFlac.cmake b/modules/FindFlac.cmake new file mode 100644 index 00000000..f1f54c42 --- /dev/null +++ b/modules/FindFlac.cmake @@ -0,0 +1,54 @@ +# - Try to find Flac, the Free Lossless Audio Codec +# Once done this will define +# +#  FLAC_FOUND - system has Flac +#  FLAC_INCLUDE_DIR - the Flac include directory +#  FLAC_LIBRARIES - Link these to use Flac +#  FLAC_OGGFLAC_LIBRARIES - Link these to use OggFlac + +# Copyright (c) 2006, Laurent Montel, <montel@kde.org> +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES) +    # Already in cache, be silent +    set(Flac_FIND_QUIETLY TRUE)	 +endif(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES) + +FIND_PATH(FLAC_INCLUDE_DIR FLAC/metadata.h) + +FIND_LIBRARY(FLAC_LIBRARIES NAMES FLAC ) + +FIND_LIBRARY(FLAC_OGG_LIBRARY NAMES OggFLAC) + +check_library_exists(FLAC FLAC__stream_encoder_set_write_callback "" HAVE_STREAM_ENCODER_WRITE_CALLBACK) + + + +IF(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES AND HAVE_STREAM_ENCODER_WRITE_CALLBACK) +   SET(FLAC_FOUND TRUE) +   IF (FLAC_OGG_LIBRARY) +      SET(FLAC_OGGFLAC_LIBRARIES ${FLAC_OGG_LIBRARY} ${FLAC_LIBRARIES}) +   ENDIF (FLAC_OGG_LIBRARY) +ELSE(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES AND HAVE_STREAM_ENCODER_WRITE_CALLBACK) +   SET(FLAC_FOUND FALSE) +ENDIF(FLAC_INCLUDE_DIR AND FLAC_LIBRARIES AND HAVE_STREAM_ENCODER_WRITE_CALLBACK) + +IF(FLAC_FOUND) +   IF(NOT Flac_FIND_QUIETLY) +      MESSAGE(STATUS "Found Flac: ${FLAC_LIBRARIES}") +   ENDIF(NOT Flac_FIND_QUIETLY) +ELSE(FLAC_FOUND) +   IF(Flac_FIND_REQUIRED) +      MESSAGE(FATAL_ERROR "Could not find Flac") +   ENDIF(Flac_FIND_REQUIRED) +   IF(NOT Flac_FIND_QUIETLY) +      MESSAGE(STATUS "Could not find Flac") +   ENDIF(NOT Flac_FIND_QUIETLY) +ENDIF(FLAC_FOUND) + +# show the FLAC_INCLUDE_DIR and FLAC_LIBRARIES variables only in the advanced view +MARK_AS_ADVANCED(FLAC_INCLUDE_DIR FLAC_LIBRARIES ) + diff --git a/modules/FindOggVorbis.cmake b/modules/FindOggVorbis.cmake new file mode 100644 index 00000000..79a9ab40 --- /dev/null +++ b/modules/FindOggVorbis.cmake @@ -0,0 +1,86 @@ +# - Try to find the OggVorbis libraries +# Once done this will define +# +#  OGGVORBIS_FOUND - system has OggVorbis +#  OGGVORBIS_VERSION - set either to 1 or 2 +#  OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory +#  OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis +#  OGG_LIBRARY         - The Ogg library +#  VORBIS_LIBRARY      - The Vorbis library +#  VORBISFILE_LIBRARY  - The VorbisFile library +#  VORBISENC_LIBRARY   - The VorbisEnc library + +# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +include (CheckLibraryExists) + +find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h) +find_path(OGG_INCLUDE_DIR ogg/ogg.h) + +find_library(OGG_LIBRARY NAMES ogg) +find_library(VORBIS_LIBRARY NAMES vorbis) +find_library(VORBISFILE_LIBRARY NAMES vorbisfile) +find_library(VORBISENC_LIBRARY NAMES vorbisenc) + + +if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) +   set(OGGVORBIS_FOUND TRUE) + +   set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY}) + +   set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES}) +   set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES}) +   check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) +   set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP}) + +   if (HAVE_LIBVORBISENC2) +      set (OGGVORBIS_VERSION 2) +   else (HAVE_LIBVORBISENC2) +      set (OGGVORBIS_VERSION 1) +   endif (HAVE_LIBVORBISENC2) + +else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) +   set (OGGVORBIS_VERSION) +   set(OGGVORBIS_FOUND FALSE) +endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY) + + +if (OGGVORBIS_FOUND) +   if (NOT OggVorbis_FIND_QUIETLY) +      message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}") +   endif (NOT OggVorbis_FIND_QUIETLY) +else (OGGVORBIS_FOUND) +   if (OggVorbis_FIND_REQUIRED) +      message(FATAL_ERROR "Could NOT find OggVorbis libraries") +   endif (OggVorbis_FIND_REQUIRED) +   if (NOT OggVorbis_FIND_QUITELY) +      message(STATUS "Could NOT find OggVorbis libraries") +   endif (NOT OggVorbis_FIND_QUITELY) +endif (OGGVORBIS_FOUND) + +#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H) +#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG) +#check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS) +#check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE) +#check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC) +#check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2) + +#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) +#    message(STATUS "Ogg/Vorbis found") +#    set (VORBIS_LIBS "-lvorbis -logg") +#    set (VORBISFILE_LIBS "-lvorbisfile") +#    set (VORBISENC_LIBS "-lvorbisenc") +#    set (OGGVORBIS_FOUND TRUE) +#    if (HAVE_LIBVORBISENC2) +#        set (HAVE_VORBIS 2) +#    else (HAVE_LIBVORBISENC2) +#        set (HAVE_VORBIS 1) +#    endif (HAVE_LIBVORBISENC2) +#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) +#    message(STATUS "Ogg/Vorbis not found") +#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC) + | 
