-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
137 lines (100 loc) · 2.31 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
#
# External dependencies
#
execute_process(COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/darknet)
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/darknet/libdarknet.so DESTINATION ${PROJECT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/darknet/libdarknet.a DESTINATION ${PROJECT_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
find_package(darknet REQUIRED)
# Enable automoc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(AUTOMOC_MOC_OPTIONS PROPERTIES FOLDER CMakeAutomocTargets)
set_property(GLOBAL PROPERTY AUTOMOC_FOLDER CMakeAutomocTargets)
# ENABLE CMP0020: Automatically link Qt executables to qtmain target on Windows.
set_policy(CMP0020 NEW)
#
# Executable name and options
#
# Target name
set(target yolo)
# Exit here if required dependencies are not met
if (NOT Qt5Core_FOUND)
message(STATUS "Plugin ${target} skipped: Qt5 not found")
return()
else()
message(STATUS "Plugin ${target}")
endif()
#
# Sources
#
file(GLOB sources
"src/*.cpp" "src/*.h" "src/*.hpp" "src/*.ui" "src/*.qrc")
#
# Create executable
#
# Build executable
add_library(${target}
${sources}
)
# Create namespaced alias
add_library(${META_PROJECT_NAME}::${target} ALIAS ${target})
#
# Project options
#
set_target_properties(${target}
PROPERTIES
${DEFAULT_PROJECT_OPTIONS}
FOLDER "${IDE_FOLDER}"
)
#
# Include directories
#
target_include_directories(${target}
PRIVATE
${DEFAULT_INCLUDE_DIRECTORIES}
${CMAKE_CURRENT_BINARY_DIR}
${PROJECT_BINARY_DIR}/source/include
${darknet_INCLUDE_DIRS}
)
#
# Libraries
#
target_link_libraries(${target}
PRIVATE
${DEFAULT_LIBRARIES}
${darknet_LIBRARIES}
annotator::annotatorplugin
)
#
# Compile definitions
#
target_compile_definitions(${target}
PRIVATE
${DEFAULT_COMPILE_DEFINITIONS}
)
#
# Compile options
#
target_compile_options(${target}
PRIVATE
${DEFAULT_COMPILE_OPTIONS}
)
#
# Linker options
#
target_link_libraries(${target}
PRIVATE
${DEFAULT_LINKER_OPTIONS}
)
#
# Deployment
#
# Executable
install(TARGETS ${target}
RUNTIME DESTINATION ${INSTALL_BIN}/plugins COMPONENT plugins
LIBRARY DESTINATION ${INSTALL_SHARED}/plugins COMPONENT plugins
BUNDLE DESTINATION ${INSTALL_BIN}/plugins COMPONENT plugins
)