From 9af2d339798215802d078b22edab01f842554b98 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Mon, 12 Nov 2007 07:22:48 +0000 Subject: Move from kdemultimedia svn path=/trunk/KDE/kdelibs/; revision=735587 --- modules/FindFFmpeg.cmake | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 modules/FindFFmpeg.cmake (limited to 'modules/FindFFmpeg.cmake') 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, +# +# 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) -- cgit v1.2.1 From 80cf7b857ae38ad933433dd977d408718fce7fe0 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 3 Dec 2007 15:55:23 +0000 Subject: Putting NOTFOUND together with other libs in a variable doesn't give good results; this could still be improved though, if some of these libs are indeed optional. svn path=/trunk/KDE/kdelibs/; revision=744437 --- modules/FindFFmpeg.cmake | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'modules/FindFFmpeg.cmake') diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 0ec576a9..9768949d 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -50,7 +50,18 @@ ENDIF (NOT WIN32) NO_DEFAULT_PATH ) - set(FFMPEG_LIBRARIES ${AVCODEC_LIBRARIES} ${AVFORMAT_LIBRARIES} ${AVUTIL_LIBRARIES}) + set(FFMPEG_LIBRARIES ) + if (AVCODEC_LIBRARIES) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVCODEC_LIBRARIES}) + endif (AVCODEC_LIBRARIES) + + if (AVFORMAT_LIBRARIES) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVFORMAT_LIBRARIES}) + endif (AVFORMAT_LIBRARIES) + + if (AVUTIL_LIBRARIES) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVUTIL_LIBRARIES}) + endif (AVUTIL_LIBRARIES) if (FFMPEG_LIBRARIES) set(FFMPEG_FOUND TRUE) -- cgit v1.2.1 From 9215cdab458b5fdc16343157dacd78ef82245ae1 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Wed, 16 Apr 2008 20:37:25 +0000 Subject: don't put set variables into the CACHE, per Brad King svn path=/trunk/KDE/kdelibs/; revision=797757 --- modules/FindFFmpeg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/FindFFmpeg.cmake') diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 9768949d..83f4dde8 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -24,7 +24,7 @@ IF (NOT WIN32) PKGCONFIG(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) ENDIF (NOT WIN32) - #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags} CACHE INTERNAL "The compilation flags for ffmpeg") + #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags}) find_path(FFMPEG_INCLUDE_DIR ffmpeg/avcodec.h PATHS -- cgit v1.2.1 From 5b528165287aea973e567f8894eb444f019adac9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 12 Jun 2008 18:28:52 +0000 Subject: Update to the current naming scheme of the headers (at least as of 0.4.9) svn path=/trunk/KDE/kdelibs/; revision=819960 --- modules/FindFFmpeg.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/FindFFmpeg.cmake') diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 83f4dde8..0f8ad9dd 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -26,7 +26,7 @@ IF (NOT WIN32) ENDIF (NOT WIN32) #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags}) - find_path(FFMPEG_INCLUDE_DIR ffmpeg/avcodec.h + find_path(FFMPEG_INCLUDE_DIR libavcodec/avcodec.h PATHS ${_FFMPEGIncDir} NO_DEFAULT_PATH -- cgit v1.2.1 From 4ac89e1a560941849a0365297c11e276a421bbf4 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 7 Jul 2008 14:44:28 +0000 Subject: Add some text explaining the FFMPEG include search paths svn path=/trunk/KDE/kdelibs/; revision=829102 --- modules/FindFFmpeg.cmake | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/FindFFmpeg.cmake') diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 0f8ad9dd..8baf0af7 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -26,6 +26,13 @@ IF (NOT WIN32) ENDIF (NOT WIN32) #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags}) + # + # #include is the new style for FFMPEG headers + # This has been verified at least since 0.4.9 + # Please do not change to the old format, since this will break for + # people who are using newer versions. Instead, upgrade your ffmpeg + # installation. + # find_path(FFMPEG_INCLUDE_DIR libavcodec/avcodec.h PATHS ${_FFMPEGIncDir} -- cgit v1.2.1 From d87b53240577e1228d49dd309092b1aea5c8621b Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Sun, 20 Jul 2008 22:36:02 +0000 Subject: -consistent lowercasing -use mark_as_advanced() for the right variables (i.e. the ones which go into the cache) -also search for the old style header so we can give a better error message Alex svn path=/trunk/KDE/kdelibs/; revision=835669 --- modules/FindFFmpeg.cmake | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'modules/FindFFmpeg.cmake') diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 8baf0af7..16233510 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -17,13 +17,14 @@ if (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) set(FFMPEG_FOUND TRUE) else (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) -IF (NOT WIN32) + +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) + include(UsePkgConfig) - PKGCONFIG(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) -ENDIF (NOT WIN32) + pkgconfig(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) +endif (NOT WIN32) #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags}) # @@ -39,6 +40,15 @@ ENDIF (NOT WIN32) NO_DEFAULT_PATH ) + # also search for the old style include dir, just for the purpose + # of giving a useful error message if an old libavcodec is installed + # and the user might wonder why it is not found + find_path(FFMPEG_INCLUDE_DIR_OLD_STYLE ffmpeg/avcodec.h + PATHS + ${_FFMPEGIncDir} + NO_DEFAULT_PATH + ) + find_library(AVCODEC_LIBRARIES NAMES avcodec PATHS ${_FFMPEGLinkDir} @@ -70,21 +80,33 @@ ENDIF (NOT WIN32) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVUTIL_LIBRARIES}) endif (AVUTIL_LIBRARIES) - if (FFMPEG_LIBRARIES) + if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) set(FFMPEG_FOUND TRUE) - endif (FFMPEG_LIBRARIES) + endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR) 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) + # only an old libavcodec was found ? + if (FFMPEG_INCLUDE_DIR_OLD_STYLE AND NOT FFMPEG_INCLUDE_DIR AND NOT FFmpeg_FIND_QUIETLY) + message(STATUS "Found old version of libavcodec, but a newer version is required.") + endif (FFMPEG_INCLUDE_DIR_OLD_STYLE AND NOT FFMPEG_INCLUDE_DIR AND NOT FFmpeg_FIND_QUIETLY) + if (FFmpeg_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find FFMPEG") + else (FFmpeg_FIND_REQUIRED) + if (NOT FFmpeg_FIND_QUIETLY) + message(STATUS "Could NOT find FFMPEG") + endif (NOT FFmpeg_FIND_QUIETLY) endif (FFmpeg_FIND_REQUIRED) endif (FFMPEG_FOUND) - MARK_AS_ADVANCED(FFMPEG_LIBRARIES) - MARK_AS_ADVANCED(FFMPEG_INCLUDE_DIR) + mark_as_advanced(AVCODEC_LIBRARIES + AVFORMAT_LIBRARIES + AVUTIL_LIBRARIES + FFMPEG_INCLUDE_DIR + FFMPEG_INCLUDE_DIR_OLD_STYLE) endif (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) -- cgit v1.2.1 From 784e9f347be5efef42ad23afbda12f6fc64d6093 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Mon, 22 Dec 2008 08:35:55 +0000 Subject: -use FindPkgConfig.cmake instead of UsePkgConfig.cmake Alex CCMAIL: kretz@kde.org Matthias: please check that it still works for you, it does on my machine (e.g. by running cmake -DMODULE=FFmpeg -P RunAllModuleTests.cmake in kdelibs/cmake/module-tests/ ) svn path=/trunk/KDE/kdelibs/; revision=900098 --- modules/FindFFmpeg.cmake | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'modules/FindFFmpeg.cmake') diff --git a/modules/FindFFmpeg.cmake b/modules/FindFFmpeg.cmake index 16233510..d6259b0c 100644 --- a/modules/FindFFmpeg.cmake +++ b/modules/FindFFmpeg.cmake @@ -2,30 +2,32 @@ # Once done this will define # # FFMPEG_FOUND - system has ffmpeg +# FFMPEG_INCLUDE_DIR - Include directory necessary for using the ffmpeg headers # FFMPEG_LIBRARIES - Link these to use ffmpeg # FFMPEG_DEFINITIONS - Compiler switches required for using ffmpeg # Copyright (c) 2006, Matthias Kretz, +# Copyright (c) 2008, Alexander Neundorf, # # 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) +if (FFMPEG_LIBRARIES) # in cache already set(FFMPEG_FOUND TRUE) -else (FFMPEG_LIBRARIES)# AND FFMPEG_DEFINITIONS) +else (FFMPEG_LIBRARIES) 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) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_LIBAVCODEC libavcodec) + set(FFMPEG_DEFINITIONS ${PC_LIBAVCODEC_CFLAGS_OTHER}) - pkgconfig(libavcodec _FFMPEGIncDir _FFMPEGLinkDir _FFMPEGLinkFlags _FFMPEGCflags) endif (NOT WIN32) - #set(FFMPEG_DEFINITIONS ${_FFMPEGCflags}) # # #include is the new style for FFMPEG headers @@ -35,38 +37,40 @@ endif (NOT WIN32) # installation. # find_path(FFMPEG_INCLUDE_DIR libavcodec/avcodec.h - PATHS - ${_FFMPEGIncDir} - NO_DEFAULT_PATH + HINTS + ${PC_LIBAVCODEC_INCLUDEDIR} + ${PC_LIBAVCODEC_INCLUDE_DIRS} ) # also search for the old style include dir, just for the purpose # of giving a useful error message if an old libavcodec is installed # and the user might wonder why it is not found find_path(FFMPEG_INCLUDE_DIR_OLD_STYLE ffmpeg/avcodec.h - PATHS - ${_FFMPEGIncDir} - NO_DEFAULT_PATH + HINTS + ${PC_LIBAVCODEC_INCLUDEDIR} + ${PC_LIBAVCODEC_INCLUDE_DIRS} ) find_library(AVCODEC_LIBRARIES NAMES avcodec - PATHS - ${_FFMPEGLinkDir} - NO_DEFAULT_PATH + HINTS + ${PC_LIBAVCODEC_LIBDIR} + ${PC_LIBAVCODEC_LIBRARY_DIRS} ) find_library(AVFORMAT_LIBRARIES NAMES avformat - PATHS - ${_FFMPEGLinkDir} - NO_DEFAULT_PATH + HINTS + ${PC_LIBAVCODEC_LIBDIR} + ${PC_LIBAVCODEC_LIBRARY_DIRS} ) find_library(AVUTIL_LIBRARIES NAMES avutil - PATHS - ${_FFMPEGLinkDir} - NO_DEFAULT_PATH + HINTS + ${PC_LIBAVCODEC_LIBDIR} + ${PC_LIBAVCODEC_LIBRARY_DIRS} ) + + set(FFMPEG_LIBRARIES ) if (AVCODEC_LIBRARIES) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${AVCODEC_LIBRARIES}) -- cgit v1.2.1