-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
61 lines (48 loc) · 1.83 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
include(FetchContent)
cmake_minimum_required(VERSION 3.26)
project(never_cli)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
set(CMAKE_INSTALL_PREFIX "/usr/local")
message("When installed, executable binaries will be available in ${CMAKE_INSTALL_PREFIX}")
## DEP: pkg-config
find_package(PkgConfig REQUIRED)
## DEP: curl
find_package(CURL REQUIRED)
## DEP: spdlog
find_package(spdlog REQUIRED)
## DEP: MQTT
# find_package(eclipse-paho-mqtt-c REQUIRED)
## DEP: json
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
FetchContent_MakeAvailable(json)
## DEP: ffmpeg
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec
libswresample
libswscale
libavutil
)
## DEP: gstreamer
pkg_check_modules(GSTLIBS REQUIRED
gobject-2.0
gstreamer-1.0
glib-2.0
)
## Target: nvr_record
add_executable(nvr_record nvr_record/record.cpp common.cpp common.h nvr_record/recorder.cpp nvr_record/recorder.h)
target_link_libraries(nvr_record PRIVATE CURL::libcurl PkgConfig::LIBAV -lm nlohmann_json::nlohmann_json spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>)
install(TARGETS nvr_record DESTINATION bin)
## Target: nvr_stream
add_executable(nvr_stream common.cpp common.h nvr_stream/streamer.cpp nvr_stream/stream.cpp nvr_stream/streamer.h
nvr_stream/janus.cpp
nvr_stream/janus.h
)
target_link_libraries(nvr_stream PRIVATE gstreamer-1.0 gobject-2.0 glib-2.0 curl nlohmann_json::nlohmann_json spdlog::spdlog $<$<BOOL:${MINGW}>:ws2_32>)
target_include_directories(nvr_stream PRIVATE ${GSTLIBS_INCLUDE_DIRS})
target_link_directories(nvr_stream PRIVATE ${GSTLIBS_LIBRARY_DIRS})
install(TARGETS nvr_stream DESTINATION bin)