forked from LectureCut/Render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
83 lines (68 loc) · 2.28 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.0)
set (CMAKE_CXX_STANDARD 23)
project (render)
if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
set(BUILD_SHARED_LIBS TRUE)
set(WINDOWS_LIBS
bcrypt
secur32
mfplat
mfuuid
strmiids
Ws2_32
)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
# TODO: debug
set(CMAKE_C_FLAGS_DEBUG "/fsanitize=address")
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /O2")
else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG")
endif()
find_package(OpenMP REQUIRED)
find_path(AVCODEC_INCLUDE_DIR libavcodec/avcodec.h REQUIRED)
find_library(AVCODEC_LIBRARY avcodec REQUIRED)
find_path(AVFORMAT_INCLUDE_DIR libavformat/avformat.h REQUIRED)
find_library(AVFORMAT_LIBRARY avformat REQUIRED)
find_library(AVUTIL_LIBRARY avutil REQUIRED)
find_library(SWRESAMPLE_LIBRARY swresample REQUIRED)
find_library(OPENH264_LIBRARY openh264 REQUIRED)
find_library(X264_LIBRARY x264 REQUIRED)
include_directories(
${AVCODEC_INCLUDE_DIR}
${AVFORMAT_INCLUDE_DIR}
)
set (sources
src/render.cpp
src/pipeline/segmentation.cpp
src/pipeline/join.cpp
src/pipeline/video.cpp
src/pipeline/audio.cpp
)
add_library (${PROJECT_NAME} SHARED ${sources})
# set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE -s)
target_link_libraries(${PROJECT_NAME}
PRIVATE
OpenMP::OpenMP_CXX
${AVCODEC_LIBRARY}
${AVFORMAT_LIBRARY}
${AVUTIL_LIBRARY}
${SWRESAMPLE_LIBRARY}
${OPENH264_LIBRARY}
${X264_LIBRARY}
${WINDOWS_LIBS}
)