-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
61 lines (46 loc) · 2.14 KB
/
CMakeLists.txt
File metadata and controls
61 lines (46 loc) · 2.14 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
cmake_minimum_required(VERSION 3.28)
project(filetovideo)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_BUILD_TYPE DEBUG)
# set include directories
set(SrcDIR ${CMAKE_SOURCE_DIR}/src)
set(IncludeDIR ${CMAKE_SOURCE_DIR}/include)
set(CMAKE_INSTALL_BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
# enable testing
enable_testing()
add_test(NAME encode_decode_error COMMAND ${CMAKE_SOURCE_DIR}/tests/encode_decode_error.sh ${CMAKE_BINARY_DIR}/filetovideo ${CMAKE_SOURCE_DIR}/tests/data/lorem_ipsum_500p.txt)
add_test(NAME color COMMAND ${CMAKE_SOURCE_DIR}/tests/color.sh ${CMAKE_BINARY_DIR}/filetovideo ${CMAKE_SOURCE_DIR}/tests/data/lorem_ipsum_500p.txt)
add_test(NAME custom_dimensions COMMAND ${CMAKE_SOURCE_DIR}/tests/custom_dimensions.sh ${CMAKE_BINARY_DIR}/filetovideo ${CMAKE_SOURCE_DIR}/tests/data/lorem_ipsum_500p.txt)
add_test(NAME custom_dimensions_colored COMMAND ${CMAKE_SOURCE_DIR}/tests/custom_dimensions_colored.sh ${CMAKE_BINARY_DIR}/filetovideo ${CMAKE_SOURCE_DIR}/tests/data/lorem_ipsum_500p.txt)
include_directories(
${SrcDIR}
${IncludeDIR}
)
# get libraries
# avcodec
find_library(AVCODEC_LIBRARY avcodec)
if(NOT AVCODEC_LIBRARY)
message(FATAL_ERROR "avcodec library not found")
endif()
# avformat
find_library(AVFORMAT_LIBRARY avformat)
if(NOT AVFORMAT_LIBRARY)
message(FATAL_ERROR "avformat library not found")
endif()
# avutil
find_library(AVUTIL_LIBRARY avutil)
if(NOT AVUTIL_LIBRARY)
message(FATAL_ERROR "avutil library not found")
endif()
# swscale
find_library(SWSCALE_LIBRARY swscale)
if(NOT SWSCALE_LIBRARY)
message(FATAL_ERROR "swscale library not found")
endif()
file(GLOB_RECURSE SOURCE_FILES ${SrcDIR}/*.cpp ${SrcDIR}/*.c ${SrcDIR}/**/*.cpp ${SrcDIR}/**/*.c)
file(GLOB_RECURSE HEADER_FILES ${SrcDIR}/*.h ${SrcDIR}/*.hpp ${SrcDIR}/**/*.h ${SrcDIR}/**/*.hpp)
add_executable(filetovideo ${CMAKE_SOURCE_DIR}/src/main.cpp ${SOURCE_FILES})
target_link_directories(filetovideo PUBLIC ${CMAKE_SOURCE_DIR}/src/)
target_link_libraries(filetovideo ${AVCODEC_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY} ${FFMPEG_LIBRARY} ${SWSCALE_LIBRARY})
install(TARGETS filetovideo DESTINATION ${CMAKE_INSTALL_BINDIR})