forked from enazoe/yolo-tensorrt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
16 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ api/ | |
*.pt | ||
*.onnx | ||
.ipynb_checkpoints | ||
*.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,31 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(yolo-trt) | ||
|
||
file(GLOB_RECURSE sources modules/*.hpp modules/*.cpp modules/*.h modules/*.cu extra/*.h) | ||
add_executable(yolo-trt samples/sample_detector.cpp) | ||
project(yolo-trt VERSION 1.0) | ||
enable_language(CUDA) | ||
|
||
set(CMAKE_CXX_COMPILIER "/usr/bin/g++") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -Wno-write-strings") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,$ORIGIN") | ||
|
||
#cuda | ||
#export PATH=/usr/local/cuda-11.0/bin:$PATH | ||
#include_directories(/usr/local/cuda/include) | ||
#link_directories(/usr/local/cuda/lib64) | ||
find_package(CUDA REQUIRED) | ||
|
||
message("-- CUDA version:${CUDA_VERSION}") | ||
|
||
if(CUDA_VERSION_MAJOR GREATER 9) | ||
message("-- CUDA ${CUDA_VERSION_MAJOR} detected") | ||
set( | ||
CUDA_NVCC_FLAGS | ||
${CUDA_NVCC_FLAGS}; | ||
) | ||
endif() | ||
|
||
#opencv | ||
#set(OpenCV_DIR /opt/opencv-4.1.2/share/OpenCV) | ||
find_package(OpenCV REQUIRED) | ||
if(Opencv_FOUND) | ||
message("found opencv") | ||
endif() | ||
|
||
#generate detector lib | ||
cuda_add_library(detector SHARED ${sources}) | ||
target_include_directories(detector PRIVATE extra/ modules/ ${OpenCV_INCLUDE_DIRS} ${CUDA_TOOLKIT_ROOT_DIR}/include ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}) | ||
#detector lib (cuda) | ||
file(GLOB_RECURSE sources modules/*.hpp modules/*.cpp modules/*.h modules/*.cu extra/*.h) | ||
add_library(detector SHARED ${sources}) | ||
target_include_directories(detector PRIVATE extra/ modules/ ${OpenCV_INCLUDE_DIRS} ${CUDA_TOOLKIT_ROOT_DIR}/include) | ||
target_link_libraries(detector nvinfer nvinfer_plugin nvcaffe_parser "stdc++fs") | ||
|
||
|
||
#sample | ||
add_executable(yolo-trt samples/sample_detector.cpp) | ||
target_include_directories(yolo-trt PRIVATE modules/ extra/) | ||
target_link_libraries(yolo-trt detector opencv_highgui opencv_imgproc opencv_core opencv_calib3d opencv_dnn) | ||
target_link_libraries(yolo-trt detector ${OpenCV_LIBS}) | ||
|
||
|
||
|