-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
95 lines (80 loc) · 2.69 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
84
85
86
87
88
89
90
91
92
93
94
95
cmake_minimum_required(VERSION 3.9.1)
project(libavc C CXX)
if(NOT DEFINED SYSTEM_NAME)
set(SYSTEM_NAME ${CMAKE_HOST_SYSTEM_NAME})
endif()
if(NOT DEFINED SYSTEM_PROCESSOR)
set(SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
if(NOT "${SYSTEM_NAME}" STREQUAL "Darwin")
enable_language(ASM)
endif()
set(AVC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(AVC_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}")
option(ENABLE_MVC "Enables svcenc and svcdec builds" OFF)
option(ENABLE_SVC "Enables svcenc and svcdec builds" OFF)
option(ENABLE_TESTS "Enables gtest based unit tests" OFF)
if("${AVC_ROOT}" STREQUAL "${AVC_CONFIG_DIR}")
message(
FATAL_ERROR
"Building from within the libavc source tree is not supported.\n"
"Hint: Run these commands\n"
"$ rm -rf CMakeCache.txt CMakeFiles\n"
"$ mkdir -p ./build\n"
"$ cd ./build\n"
"And re-run CMake from the build directory.")
endif()
if("${SYSTEM_NAME}" STREQUAL "Android")
find_library(log-lib log QUIET)
if(NOT log-lib)
message(FATAL_ERROR "Could NOT find log library, retry after installing \
log library at sysroot.")
else()
message(STATUS "Found log-lib: ${log-lib}")
endif()
endif()
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
set(CMAKE_STATIC_LIBRARY_PREFIX "")
if(${CMAKE_CROSSCOMPILING})
set(THREADS_PTHREAD_ARG
"2"
CACHE STRING
"Refer https://gitlab.kitware.com/cmake/cmake/-/issues/16920" FORCE)
endif()
include("${AVC_ROOT}/cmake/utils.cmake")
libavc_add_compile_options()
libavc_add_definitions()
libavc_set_link_libraries()
include("${AVC_ROOT}/common/common.cmake")
include("${AVC_ROOT}/decoder/libavcdec.cmake")
if (${ENABLE_MVC})
include("${AVC_ROOT}/decoder/mvc/libmvcdec.cmake")
endif()
include("${AVC_ROOT}/encoder/libavcenc.cmake")
if (${ENABLE_SVC})
include("${AVC_ROOT}/common/svccommon.cmake")
include("${AVC_ROOT}/encoder/svc/libsvcenc.cmake")
include("${AVC_ROOT}/decoder/svc/libsvcdec.cmake")
endif()
include("${AVC_ROOT}/examples/avcdec/avcdec.cmake")
if (${ENABLE_MVC})
include("${AVC_ROOT}/examples/mvcdec/mvcdec.cmake")
endif()
include("${AVC_ROOT}/examples/avcenc/avcenc.cmake")
if (${ENABLE_SVC})
include("${AVC_ROOT}/examples/svcenc/svcenc.cmake")
include("${AVC_ROOT}/examples/svcdec/svcdec.cmake")
endif()
include("${AVC_ROOT}/fuzzer/avc_dec_fuzzer.cmake")
if (${ENABLE_MVC})
include("${AVC_ROOT}/fuzzer/mvc_dec_fuzzer.cmake")
endif()
include("${AVC_ROOT}/fuzzer/avc_enc_fuzzer.cmake")
if (${ENABLE_SVC})
include("${AVC_ROOT}/fuzzer/svc_enc_fuzzer.cmake")
include("${AVC_ROOT}/fuzzer/svc_dec_fuzzer.cmake")
endif()
if (${ENABLE_TESTS})
include("${AVC_ROOT}/tests/AvcEncTest.cmake")
endif()