-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (31 loc) · 1.3 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.1)
project(ffmpeg_video_player)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE REQUIRED)
if(FFMPEG_FOUND)
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
include_directories(${FFMPEG_INCLUDE_DIRS})
set(FFMPEG_LIBRARIES avformat avcodec swresample swscale avutil)
# Let the library know
add_definitions(-DHAS_FFMPEG)
else()
message(STATUS "FFMPEG not found, continuing without video playback support")
set(FFMPEG_LIBRARIES "")
endif()
# Main library
add_library(ffmpeg_video_player STATIC
src/VideoRead.cpp)
target_link_libraries(ffmpeg_video_player ${FFMPEG_LIBRARIES})
include_directories(include)
# set(FFMPEG_VIDEO_PLAYER_BUILD_EXAMPLES on)
# Examples
if(FFMPEG_VIDEO_PLAYER_BUILD_EXAMPLES)
add_executable(player_sdl
examples/SDLPlayerExample.cpp
examples/SDLWindow.cpp
examples/SDLWindow.h )
target_link_libraries(player_sdl ffmpeg_video_player SDL2)
endif()