mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
cmake: Find prebuilt ffmpeg on Windows
This commit is contained in:
parent
6c197a8f6a
commit
e03690f1f0
@ -61,30 +61,66 @@ macro(check_libav)
|
|||||||
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()
|
else()
|
||||||
# Attempt to find it through static means
|
if(WIN32)
|
||||||
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
|
add_library(avcodec STATIC IMPORTED)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${LIBAV_LDFLAGS})
|
set_target_properties(avcodec PROPERTIES
|
||||||
CHECK_CXX_SOURCE_COMPILES(
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
"extern \"C\" {
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avcodec.lib
|
||||||
#include <libavcodec/avcodec.h>
|
)
|
||||||
#include <libavformat/avformat.h>
|
|
||||||
#include <libavutil/mathematics.h>
|
add_library(avformat STATIC IMPORTED)
|
||||||
#include <libswscale/swscale.h>
|
set_target_properties(avformat PROPERTIES
|
||||||
}
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
int main(int argc, char **argv)
|
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/lib/avformat.lib
|
||||||
{
|
)
|
||||||
av_register_all();
|
|
||||||
return 0;
|
add_library(avutil STATIC IMPORTED)
|
||||||
}"
|
set_target_properties(avutil PROPERTIES
|
||||||
LIBAV_FOUND)
|
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/Externals/ffmpeg/include
|
||||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
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()
|
||||||
|
# Attempt to find it through static means
|
||||||
|
set(LIBAV_LDFLAGS avformat avcodec swscale avutil)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${LIBAV_LDFLAGS})
|
||||||
|
CHECK_CXX_SOURCE_COMPILES(
|
||||||
|
"extern \"C\" {
|
||||||
|
#include <libavcodec/avcodec.h>
|
||||||
|
#include <libavformat/avformat.h>
|
||||||
|
#include <libavutil/mathematics.h>
|
||||||
|
#include <libswscale/swscale.h>
|
||||||
|
}
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
av_register_all();
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
LIBAV_FOUND)
|
||||||
|
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)
|
||||||
include_directories(${LIBAV_INCLUDE_DIRS})
|
if(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
Block a user