-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
CMakeLists.txt
179 lines (153 loc) · 4.77 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
cmake_minimum_required(VERSION 3.12)
project(obs-face-tracker VERSION 0.7.2)
set(PLUGIN_AUTHOR "Norihiro Kamae")
set(MACOS_BUNDLEID "net.nagater.obs-face-tracker")
set(MACOS_PACKAGE_UUID "A2EB2F73-9828-40C4-A307-F47282BB8D3F")
set(MACOS_INSTALLER_UUID "652CF739-5A6F-4DAC-9611-B068FAC15BF3")
set(PLUGIN_URL "https://obsproject.com/forum/resources/face-tracker.1294/")
set(LINUX_MAINTAINER_EMAIL "norihiro@nagater.net")
option(WITH_PTZ_TCP "Enable to connect PTZ camera through TCP socket" ON)
option(WITH_DLIB_SUBMODULE "Link dlib from submodule" ON)
option(ENABLE_MONITOR_USER "Enable monitor source for user" OFF)
option(ENABLE_DEBUG_DATA "Enable property to save error and control data" OFF)
option(WITH_DOCK "Enable dock" ON)
option(ENABLE_DATAGEN "Enable generating data" OFF)
set(CMAKE_PREFIX_PATH "${QTDIR}")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(plugin_additional_libs)
set(plugin_additional_incs)
if (WITH_PTZ_TCP)
set(CMAKE_POSITION_INDEPENDENT_CODE true)
set(WITH_VISCA_SERIAL OFF)
add_definitions("-DVISCA_API= ")
add_subdirectory(libvisca/visca)
set(plugin_additional_libs ${plugin_additional_libs} visca)
set(plugin_additional_incs ${plugin_additional_incs} libvisca/visca)
endif()
find_package(libobs REQUIRED)
find_package(obs-frontend-api REQUIRED)
include(cmake/ObsPluginHelpers.cmake)
find_qt(VERSION ${QT_VERSION} COMPONENTS Widgets Core Gui)
if (WITH_DLIB_SUBMODULE)
set(CMAKE_POSITION_INDEPENDENT_CODE True)
set(DLIB_NO_GUI_SUPPORT ON)
set(DLIB_PNG_SUPPORT OFF)
set(DLIB_GIF_SUPPORT OFF)
set(DLIB_USE_FFMPEG OFF)
set(DLIB_JPEG_SUPPORT OFF)
set(DLIB_LINK_WITH_SQLITE3 OFF)
set(DLIB_WEBP_SUPPORT OFF)
set(DLIB_JXL_SUPPORT OFF)
set(DLIB_TEST_COMPILE_ALL_SOURCE_CPP OFF)
add_subdirectory(dlib)
else()
find_package(dlib REQUIRED)
add_library(dlib ALIAS dlib::dlib)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
configure_file(
src/plugin-macros.h.in
plugin-macros.generated.h
)
configure_file(
installer/installer-Windows.iss.in
installer-Windows.generated.iss
)
configure_file(
ci/ci_includes.sh.in
ci/ci_includes.generated.sh
)
configure_file(
ci/ci_includes.cmd.in
ci/ci_includes.generated.cmd
)
set(PLUGIN_SOURCES
src/module-main.c
src/face-tracker.cpp
src/source_list.cc
src/face-tracker-preset.cpp
src/face-tracker-manager.cpp
src/face-tracker-ptz.cpp
src/face-tracker-monitor.cpp
src/face-detector-base.cpp
src/face-detector-dlib-hog.cpp
src/face-detector-dlib-cnn.cpp
src/face-tracker-base.cpp
src/face-tracker-dlib.cpp
src/texture-object.cpp
src/helper.cpp
src/ptz-backend.cpp
src/obsptz-backend.cpp
src/dummy-backend.cpp
)
if (WITH_PTZ_TCP)
set(PLUGIN_SOURCES ${PLUGIN_SOURCES} src/libvisca-thread.cpp)
endif()
if (WITH_DOCK)
set(PLUGIN_SOURCES
${PLUGIN_SOURCES}
ui/face-tracker-dock.cpp
ui/face-tracker-widget.cpp
)
endif()
add_library(${CMAKE_PROJECT_NAME} MODULE ${PLUGIN_SOURCES})
if (WITH_DOCK)
set(plugin_additional_incs ${plugin_additional_incs} src)
set(plugin_additional_libs ${plugin_additional_libs} Qt::Gui Qt::Widgets Qt::GuiPrivate)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/dlib
${plugin_additional_incs}
)
target_link_libraries(${CMAKE_PROJECT_NAME}
OBS::libobs
OBS::obs-frontend-api
dlib
${plugin_additional_libs}
)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
if(OS_WINDOWS)
# Enable Multicore Builds and disable FH4 (to not depend on VCRUNTIME140_1.DLL when building with VS2019)
if (MSVC)
add_definitions(/MP /d2FH4-)
add_definitions("-D_USE_MATH_DEFINES")
add_definitions("-D_CRT_SECURE_NO_WARNINGS") # to avoid a warning for `fopen`
add_definitions("-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR") # TODO: Remove once requiring OBS 30.2 or later.
endif()
target_link_libraries(${CMAKE_PROJECT_NAME} OBS::w32-pthreads)
endif()
if(OS_LINUX)
target_compile_options(${CMAKE_PROJECT_NAME}
PRIVATE
-Wall
-Wextra
-Wunused-function
-Werror
-Wno-error=deprecated-declarations # TODO: Replace obs_frontend_add_dock with the new API.
)
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE "-Wl,-z,defs")
endif()
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fvisibility=default")
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES PREFIX "")
set(MACOSX_PLUGIN_GUI_IDENTIFIER "${MACOS_BUNDLEID}")
set(MACOSX_PLUGIN_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}")
set(MACOSX_PLUGIN_SHORT_VERSION_STRING "1")
endif()
setup_plugin_target(${CMAKE_PROJECT_NAME})
configure_file(installer/installer-macOS.pkgproj.in installer-macOS.generated.pkgproj)
if(ENABLE_DATAGEN)
add_executable(face-detector-dlib-hog-datagen
src/face-detector-dlib-hog-datagen.cpp
)
target_include_directories(face-detector-dlib-hog-datagen PRIVATE
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(face-detector-dlib-hog-datagen
dlib
)
endif()