-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
94 lines (81 loc) · 1.98 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
cmake_minimum_required (VERSION 3.16)
# project name
project (househub)
# set cmake params
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# set(CMAKE_CXX_STANDARD 17)
# target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
add_compile_options(-std=c++17)
# conan build information
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt BASIC_SETUP BUILD missing CMAKE_TARGETS)
# project includes
include_directories(
include
)
# project sources
set(SOURCES
src/main.cpp
src/app.cpp
src/capturer.cpp
src/capturer_factory.cpp
src/config_manager.cpp
src/file_manager.cpp
src/video_out_stream.cpp
)
# add executable
add_executable (${PROJECT_NAME}
${SOURCES}
)
# includes
target_include_directories(${PROJECT_NAME}
PRIVATE
${PROJECT_SOURCE_DIR}/include
)
# link against conan packages
target_link_libraries(${PROJECT_NAME}
PRIVATE
stdc++fs
CONAN_PKG::opencv
CONAN_PKG::glog
CONAN_PKG::inih
)
IF (WIN32)
# install targets
install(
TARGETS
${PROJECT_NAME}
DESTINATION ${PROJECT_NAME}
)
# install ini
install(
FILES
${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.ini
DESTINATION ${PROJECT_NAME}
)
# TODO: install service
ELSE()
# install targets
install(
TARGETS
${PROJECT_NAME}
RUNTIME DESTINATION bin
)
# install ini
install(
FILES
${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.ini
DESTINATION /etc/${PROJECT_NAME}
)
# install service
install(
FILES
${PROJECT_SOURCE_DIR}/${PROJECT_NAME}.service
DESTINATION /etc/systemd/system/
)
ENDIF()