-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
85 lines (67 loc) · 2.35 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
cmake_minimum_required(VERSION 3.20)
project(object-detection-inference)
set(CMAKE_CXX_STANDARD 17)
find_package(OpenCV REQUIRED)
find_package(glog REQUIRED)
# Define the default backend if not set from the command line
if(NOT DEFINED DEFAULT_BACKEND)
unset(DEFAULT_BACKEND CACHE)
set(DEFAULT_BACKEND "ONNX_RUNTIME" CACHE STRING "Default backend for inference" FORCE)
endif()
message(STATUS "Home path: $ENV{HOME}")
# Fetch the VideoCapture project from GitHub
include(FetchContent)
FetchContent_Declare(
VideoCapture
GIT_REPOSITORY https://github.com/olibartfast/VideoCapture.git
GIT_TAG master # or the specific tag/branch you want to use
)
FetchContent_MakeAvailable(VideoCapture)
message(STATUS "VideoCapture_SOURCE_DIR module path: ${VideoCapture_SOURCE_DIR}")
# Fetch the InferenceEngines project from GitHub
include(FetchContent)
FetchContent_Declare(
InferenceEngines
GIT_REPOSITORY https://github.com/olibartfast/inference-engines.git
GIT_TAG master # or the specific tag/branch you want to use
)
FetchContent_MakeAvailable(InferenceEngines)
message(STATUS "InferenceEngines_SOURCE_DIR module path: ${InferenceEngines_SOURCE_DIR}")
set(DETECTORS_ROOT ${CMAKE_CURRENT_LIST_DIR}/detectors)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
message(STATUS "Cmake module path: ${CMAKE_MODULE_PATH}")
# Add subdirectories
add_subdirectory(${DETECTORS_ROOT})
include(AddCompileDefinitions)
# Main executable
set(SOURCES main.cpp src/ObjectDetectionApp.cpp src/utils.cpp src/DetectorSetup.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_SOURCE_DIR}/inc
${VideoCapture_SOURCE_DIR}/include
${InferenceEngines_SOURCE_DIR}/include
)
target_include_directories(${PROJECT_NAME} PRIVATE
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/detectors/src
${OpenCV_INCLUDE_DIRS}
${GLOG_INCLUDE_DIRS}
${VideoCapture_SOURCE_DIR}/src
${InferenceEngines_SOURCE_DIR}/backends
${InferenceEngines_SOURCE_DIR}/backends/src
)
target_link_libraries(${PROJECT_NAME} PRIVATE
glog::glog
${OpenCV_LIBS}
DetectorsLib
InferenceEngines
VideoCapture
)
include(LinkBackend)
include(SetCompilerFlags)
# Option to enable unit tests
option(ENABLE_TESTS "Enable unit testing" OFF)
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(test)
endif()