ソースを参照

CMake: Migrate FFmpeg package detection

Sam Edwards 7 年 前
コミット
3210302caf
3 ファイル変更27 行追加18 行削除
  1. 0 12
      dtool/Config.cmake
  2. 0 6
      dtool/LocalSetup.cmake
  3. 27 0
      dtool/Package.cmake

+ 0 - 12
dtool/Config.cmake

@@ -466,18 +466,6 @@ option(HAVE_VIDEO4LINUX
   "Set this to enable webcam support on Linux." ${IS_LINUX})
 
 
-# Is FFMPEG installed, and where?
-find_package(FFMPEG QUIET)
-find_package(SWScale QUIET)
-find_package(SWResample QUIET)
-
-package_option(FFMPEG
-  "Enables support for audio- and video-decoding using the FFMPEG library.")
-package_option(SWSCALE
-  "Enables support for FFMPEG's libswscale for video rescaling.")
-package_option(SWRESAMPLE
-  "Enables support for FFMPEG's libresample for audio resampling.")
-
 # Is ODE installed, and where?
 find_package(ODE QUIET)
 

+ 0 - 6
dtool/LocalSetup.cmake

@@ -291,12 +291,6 @@ else()
   message("- Did not find OpenCV")
 endif()
 
-if(HAVE_FFMPEG)
-  message("+ FFMPEG")
-else()
-  message("- Did not find FFMPEG")
-endif()
-
 if(HAVE_ODE)
   message("+ ODE")
 else()

+ 27 - 0
dtool/Package.cmake

@@ -146,6 +146,33 @@ package_option(ZLIB
 
 config_package(ZLIB "zlib")
 
+#
+# ------------ FFmpeg ------------
+#
+
+find_package(FFMPEG QUIET)
+find_package(SWScale QUIET)
+find_package(SWResample QUIET)
+
+package_option(FFMPEG
+  "Enables support for audio- and video-decoding using the FFmpeg library.")
+package_option(SWSCALE
+  "Enables support for FFmpeg's libswscale for video rescaling.")
+package_option(SWRESAMPLE
+  "Enables support for FFmpeg's libresample for audio resampling.")
+
+if(HAVE_SWSCALE AND HAVE_SWRESAMPLE)
+  set(ffmpeg_features "with swscale and swresample")
+elseif(HAVE_SWSCALE)
+  set(ffmpeg_features "with swscale")
+elseif(HAVE_SWRESAMPLE)
+  set(ffmpeg_features "with swresample")
+else()
+  set(ffmpeg_features "without resampling/rescaling support")
+endif()
+config_package(FFMPEG "FFmpeg" "${ffmpeg_features}")
+
+
 # Find and configure Miles Sound System
 find_package(Miles QUIET)
 #config_package(RAD_MSS "Miles Sound System")