CMakeLists.txt 5.88 KB
Newer Older
oscar's avatar
oscar committed
1 2 3
cmake_minimum_required(VERSION 3.0.2)
project(jfx_tracking)

oscar's avatar
oscar committed
4
set(KF_CUDA ON)
oscar's avatar
oscar committed
5
set(QICHECHENG ON)
oscar's avatar
oscar committed
6 7 8 9 10 11 12 13 14 15 16

add_definitions(-D_DEBUG)
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g  -O0")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g  -O0")
        set(CMAKE_BUILD_TYPE Debug)

#add_subdirectory(yolov5)
#add_subdirectory(track)
## Compile as C++11, supported in ROS Kinetic and newer
add_compile_options(-std=c++11)

oscar's avatar
oscar committed
17
find_package(OpenCV REQUIRED)
oscar's avatar
oscar committed
18 19
find_package(yaml-cpp REQUIRED)
include_directories(${YAML_CPP_INCLUDE_DIR})
oscar's avatar
oscar committed
20
add_definitions(-D_QICHECHENG_)
oscar's avatar
oscar committed
21

oscar's avatar
oscar committed
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
#find_package(CUDA REQUIRED)

#if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
#    message("embed_platform on")
#    include_directories(/usr/local/cuda/targets/aarch64-linux/include)
#    link_directories(/usr/local/cuda/targets/aarch64-linux/lib)
#else()
#    message("embed_platform off")
#    include_directories(/usr/local/cuda/include /host/home/sata1/hs_data/code/RunOnTensorRT/trt_soft/TensorRT-7.0.0.11/include )
#    link_directories(/usr/local/cuda/lib64 /host/home/sata1/hs_data/code/RunOnTensorRT/trt_soft/TensorRT-7.0.0.11/lib )
#endif()

#set(JFX_YOLOV5_PATH yolov5)
#set(JFX_COMMON_LIBS_PATH ${PROJECT_SOURCE_DIR}/../jfx_common_libs)

#include_directories(${JFX_YOLOV5_PATH})
#include_directories(${JFX_YOLOV5_PATH}/modules)
#include_directories(${JFX_COMMON_LIBS_PATH}/utils)
#include_directories(${JFX_COMMON_LIBS_PATH}/coordinate)
#include_directories(${JFX_COMMON_LIBS_PATH}/tracker)


## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
oscar's avatar
oscar committed
47 48
if(QICHECHENG)
else()
oscar's avatar
oscar committed
49 50 51 52 53 54 55
find_package(catkin REQUIRED COMPONENTS
        #camera_info_manager
        #cv_bridge
        #dynamic_reconfigure
        #image_transport
        roscpp
        rospy
oscar's avatar
oscar committed
56
        sensor_msgs
oscar's avatar
oscar committed
57
        std_srvs
oscar's avatar
oscar committed
58
        jfx_common_msgs
oscar's avatar
oscar committed
59 60 61 62 63 64 65 66 67 68
        )

catkin_package(
        CATKIN_DEPENDS
        #camera_info_manager
        #cv_bridge
        #dynamic_reconfigure
        #image_transport
        roscpp
        rospy
oscar's avatar
oscar committed
69
        sensor_msgs
oscar's avatar
oscar committed
70
        std_srvs
oscar's avatar
oscar committed
71
        jfx_common_msgs
oscar's avatar
oscar committed
72 73
        DEPENDS
        OpenCV
oscar's avatar
oscar committed
74
)
oscar's avatar
oscar committed
75 76
endif()

oscar's avatar
oscar committed
77 78 79 80 81

###########
## Build ##
###########

oscar's avatar
oscar committed
82 83
if(KF_CUDA)
add_definitions(-D_KF_IOU_CUDA_)
oscar's avatar
oscar committed
84
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
oscar's avatar
oscar committed
85 86 87
find_package(CUDA REQUIRED)
include_directories(/usr/local/cuda/include)
link_directories(/usr/local/cuda/lib64)
oscar's avatar
oscar committed
88
set(CUDA_NVCC_PLAGS ${CUDA_NVCC_PLAGS};-std=c++11;-g;-G;-gencode;arch=compute_75;code=sm_75)
oscar's avatar
oscar committed
89
include_directories(${PROJECT_SOURCE_DIR}/src/BaseTracker/kf_gpu)
oscar's avatar
oscar committed
90 91 92
cuda_add_library(kf_cuda SHARED 
            src/BaseTracker/kf_gpu/bev_overlap_online.cu 
            src/BaseTracker/kf_gpu/kalman_update_batch_online.cu)
oscar's avatar
oscar committed
93
target_link_libraries(kf_cuda cudart cublas)
oscar's avatar
oscar committed
94
endif()
oscar's avatar
oscar committed
95

oscar's avatar
oscar committed
96 97 98 99 100 101

include_directories(
        /usr/local/include
        src
        src/tracker
        src/BaseTracker
oscar's avatar
oscar committed
102
        src/BaseTracker/kf_gpu
oscar's avatar
oscar committed
103
        src/log
oscar's avatar
oscar committed
104
        src/common
oscar's avatar
oscar committed
105
        src/coordinate
oscar's avatar
oscar committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119
        ${catkin_INCLUDE_DIRS}
)

link_directories(/usr/local/lib)
link_directories(/usr/local/cuda/lib64)
link_directories(/usr/lib/aarch64-linux-gnu)
link_directories(/usr/lib/aarch64-linux-gnu/tegra)

#file(GLOB_RECURSE COORDINATE_SRC_FILES
#        ${PROJECT_SOURCE_DIR}/../jfx_common_libs/coordinate/*.cpp
#)
file(GLOB_RECURSE TRACKER_SRC_FILES
        ${PROJECT_SOURCE_DIR}/src/tracker/kalman_filter.cpp
        ${PROJECT_SOURCE_DIR}/src/tracker/munkres.cpp
oscar's avatar
oscar committed
120
        ${PROJECT_SOURCE_DIR}/src/coordinate/*.cpp
oscar's avatar
oscar committed
121 122 123 124
)

add_executable(${PROJECT_NAME}_node
        src/jfx_tracking.cpp
oscar's avatar
oscar committed
125 126
        src/TrackingRos.cpp
        src/common/Component.cpp
oscar's avatar
oscar committed
127 128 129 130
        src/BaseTracker/Iou.cpp
        src/BaseTracker/BaseTrack.cpp
        src/BaseTracker/Track3D.cpp
        src/BaseTracker/Track2D.cpp
oscar's avatar
oscar committed
131
        src/log/jfx_log.cpp
oscar's avatar
oscar committed
132 133 134 135 136
        #${COORDINATE_SRC_FILES}
        ${TRACKER_SRC_FILES}
)

target_link_libraries(${PROJECT_NAME}_node
oscar's avatar
oscar committed
137
        glog
oscar's avatar
oscar committed
138 139 140 141
        #nvinfer
        #cudart
        #yolov5plugins
        ${catkin_LIBRARIES}
oscar's avatar
oscar committed
142
        ${OpenCV_LIBS}
oscar's avatar
oscar committed
143
        yaml-cpp
oscar's avatar
oscar committed
144 145
        )

oscar's avatar
oscar committed
146
if(KF_CUDA)
oscar's avatar
oscar committed
147
target_link_libraries(${PROJECT_NAME}_node kf_cuda)
oscar's avatar
oscar committed
148
endif()
oscar's avatar
oscar committed
149

oscar's avatar
oscar committed
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 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
#add_executable(cv_test
#        src/test.cpp
#        ${COORDINATE_SRC_FILES}
#        ${TRACKER_SRC_FILES}
#)
#
#target_link_libraries(cv_test
#        ${catkin_LIBRARIES}
#        ${OpenCV_LIBS}
#        yaml-cpp
#        )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
#   scripts/my_python_script
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
#   FILES_MATCHING PATTERN "*.h"
#   PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
#   # myfile1
#   # myfile2
#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_jfx_vision.cpp)
# if(TARGET ${PROJECT_NAME}-test)
#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)