-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
80 lines (68 loc) · 1.96 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
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(FairMOT)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(Eigen3 REQUIRED NO_MODULE
PATHS ./third_party/eigen
NO_DEFAULT_PATH
)
find_package(OpenCV REQUIRED
PATHS ./third_party/opencv4
NO_DEFAULT_PATH
)
set(CMAKE_PREFIX_PATH
"${PROJECT_SOURCE_DIR}/third_party/libtorch/share/cmake")
find_package(Torch REQUIRED)
find_package(Python3 COMPONENTS Development)
set(CMAKE_PREFIX_PATH
"${PROJECT_SOURCE_DIR}/third_party/torchvision/share/cmake")
find_package(TorchVision REQUIRED)
set(FairMOT_CXX_WARNING_FLAGS "\
-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy \
-Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op \
-Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Weffc++ \
-Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow \
-Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default \
-Wundef -Wno-unused"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FairMOT_CXX_WARNING_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-fopenmp -ftree-vectorize -march=native")
if (FairMOT_PROFILE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
endif ()
set(SOURCES
src/Decoder.cpp
src/FairMot.cpp
src/KalmanFilter.cpp
src/Matching.cpp
src/STrack.cpp
src/Utils.cpp
)
if (FairMOT_EVAL)
set(SOURCES
${SOURCES}
src/main_eval.cpp
)
else ()
set(SOURCES
${SOURCES}
src/main.cpp
)
endif ()
add_executable(FairMOT ${SOURCES})
include_directories(${OpenCV_INCLUDE_DIRS})
target_include_directories(FairMOT
PRIVATE
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/third_party/mini
)
target_link_libraries(FairMOT
stdc++fs
Eigen3::Eigen
${OpenCV_LIBS}
Python3::Python
${TORCH_LIBRARIES}
TorchVision::TorchVision
)
set_property(TARGET FairMOT PROPERTY CXX_STANDARD 14)