forked from leandromoreira/ffmpeg-libav-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
49 lines (39 loc) · 1.27 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.17)
project(libav_tutorial)
# set out direcroty
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# set ffmeg root directory
if(NOT FFMPEG_DEV_ROOT)
message(FATAL_ERROR "set FFMPEG_DEV_ROOT to use ffmpeg libraries")
endif()
# set ffmpeg develop environment
include_directories(${FFMPEG_DEV_ROOT}/include)
link_directories(${FFMPEG_DEV_ROOT}/lib)
link_libraries(
avcodec
avformat
avfilter
avdevice
swresample
swscale
avutil
)
# copy dlls
file(GLOB ffmpeg_shared_libries ${FFMPEG_DEV_ROOT}/bin/*dll)
file(COPY ${ffmpeg_shared_libries} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
# copy test file
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/small_bunny_1080p_60fps.mp4 DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
# add library
set(debug_src ${CMAKE_CURRENT_SOURCE_DIR}/video_debugging.c)
add_library(video_debug ${debug_src})
link_libraries(video_debug)
# add project/executables
file(GLOB srcs *.c)
list(REMOVE_ITEM srcs ${debug_src})
foreach(src ${srcs})
get_filename_component(TARGET ${src} NAME)
add_executable(${TARGET} ${src})
message(STATUS "${TARGET} added")
endforeach()