cmake: Find prebuilt ffmpeg on Windows
This commit is contained in:
parent
6c197a8f6a
commit
e03690f1f0
|
@ -60,6 +60,40 @@ macro(check_libav)
|
||||||
if(PKG_CONFIG_FOUND)
|
if(PKG_CONFIG_FOUND)
|
||||||
pkg_check_modules(LIBAV libavcodec>=54.35.0 libavformat>=54.20.4
|
pkg_check_modules(LIBAV libavcodec>=54.35.0 libavformat>=54.20.4
|
||||||
libswscale>=2.1.1 libavutil>=52.3.0)
|
libswscale>=2.1.1 libavutil>=52.3.0)
|
||||||
|
else()
|
||||||
|
if(WIN32)
|
||||||
|
add_library(avcodec STATIC IMPORTED)
|
||||||
|
set_target_properties(avcodec PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avcodec.lib
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(avformat STATIC IMPORTED)
|
||||||
|
set_target_properties(avformat PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avformat.lib
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(avutil STATIC IMPORTED)
|
||||||
|
set_target_properties(avutil PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avutil.lib
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(swresample STATIC IMPORTED)
|
||||||
|
set_target_properties(swresample PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/swresample.lib
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(swscale STATIC IMPORTED)
|
||||||
|
set_target_properties(swscale PROPERTIES
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/swscale.lib
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LIBAV_FOUND ON)
|
||||||
|
set(LIBAV_LIBRARIES avcodec avformat avutil swresample swscale)
|
||||||
else()
|
else()
|
||||||
# Attempt to find it through static means
|
# Attempt to find it through static means
|
||||||
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
|
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
|
||||||
|
@ -79,12 +113,14 @@ macro(check_libav)
|
||||||
LIBAV_FOUND)
|
LIBAV_FOUND)
|
||||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
if(LIBAV_FOUND)
|
if(LIBAV_FOUND)
|
||||||
message(STATUS "libav/ffmpeg found, enabling AVI frame dumps")
|
message(STATUS "libav/ffmpeg found, enabling AVI frame dumps")
|
||||||
add_definitions(-DHAVE_LIBAV)
|
add_definitions(-DHAVE_LIBAV)
|
||||||
|
if(LIBAV_INCLUDE_DIRS)
|
||||||
include_directories(${LIBAV_INCLUDE_DIRS})
|
include_directories(${LIBAV_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(STATUS "libav/ffmpeg not found, disabling AVI frame dumps")
|
message(STATUS "libav/ffmpeg not found, disabling AVI frame dumps")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue