|
|
@ -1,11 +1,11 @@ |
|
|
|
cmake_minimum_required(VERSION 2.8.12) |
|
|
|
cmake_minimum_required(VERSION 3.1) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CUDA_ARCHITECTURES 60 61 62 70 72 75 86) |
|
|
|
set(CMAKE_CUDA_ARCHITECTURES 60 61 62 70 72 75 86 89 90) |
|
|
|
set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc) |
|
|
|
set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc) |
|
|
|
|
|
|
|
|
|
|
|
project(yolov8-seg LANGUAGES CXX CUDA) |
|
|
|
project(yolov8-seg LANGUAGES CXX CUDA) |
|
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3 -g") |
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -O3") |
|
|
|
set(CMAKE_CXX_STANDARD 14) |
|
|
|
set(CMAKE_CXX_STANDARD 14) |
|
|
|
set(CMAKE_BUILD_TYPE Release) |
|
|
|
set(CMAKE_BUILD_TYPE Release) |
|
|
|
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) |
|
|
|
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) |
|
|
@ -13,6 +13,7 @@ option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) |
|
|
|
# CUDA |
|
|
|
# CUDA |
|
|
|
find_package(CUDA REQUIRED) |
|
|
|
find_package(CUDA REQUIRED) |
|
|
|
message(STATUS "CUDA Libs: \n${CUDA_LIBRARIES}\n") |
|
|
|
message(STATUS "CUDA Libs: \n${CUDA_LIBRARIES}\n") |
|
|
|
|
|
|
|
get_filename_component(CUDA_LIB_DIR ${CUDA_LIBRARIES} DIRECTORY) |
|
|
|
message(STATUS "CUDA Headers: \n${CUDA_INCLUDE_DIRS}\n") |
|
|
|
message(STATUS "CUDA Headers: \n${CUDA_INCLUDE_DIRS}\n") |
|
|
|
|
|
|
|
|
|
|
|
# OpenCV |
|
|
|
# OpenCV |
|
|
@ -33,11 +34,12 @@ list(APPEND INCLUDE_DIRS |
|
|
|
${CUDA_INCLUDE_DIRS} |
|
|
|
${CUDA_INCLUDE_DIRS} |
|
|
|
${OpenCV_INCLUDE_DIRS} |
|
|
|
${OpenCV_INCLUDE_DIRS} |
|
|
|
${TensorRT_INCLUDE_DIRS} |
|
|
|
${TensorRT_INCLUDE_DIRS} |
|
|
|
./include |
|
|
|
include |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
list(APPEND ALL_LIBS |
|
|
|
list(APPEND ALL_LIBS |
|
|
|
${CUDA_LIBRARIES} |
|
|
|
${CUDA_LIBRARIES} |
|
|
|
|
|
|
|
${CUDA_LIB_DIR} |
|
|
|
${OpenCV_LIBRARIES} |
|
|
|
${OpenCV_LIBRARIES} |
|
|
|
${TensorRT_LIBRARIES} |
|
|
|
${TensorRT_LIBRARIES} |
|
|
|
) |
|
|
|
) |
|
|
@ -53,8 +55,7 @@ add_executable(${PROJECT_NAME} |
|
|
|
target_link_directories(${PROJECT_NAME} PUBLIC ${ALL_LIBS}) |
|
|
|
target_link_directories(${PROJECT_NAME} PUBLIC ${ALL_LIBS}) |
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE nvinfer nvinfer_plugin cudart ${OpenCV_LIBS}) |
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE nvinfer nvinfer_plugin cudart ${OpenCV_LIBS}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (${OpenCV_VERSION} VERSION_GREATER_EQUAL 4.7.0) |
|
|
|
if(${OpenCV_VERSION} VERSION_GREATER_EQUAL 4.7.0) |
|
|
|
|
|
|
|
message(STATUS "Build with -DBATCHED_NMS") |
|
|
|
message(STATUS "Build with -DBATCHED_NMS") |
|
|
|
add_definitions(-DBATCHED_NMS) |
|
|
|
add_definitions(-DBATCHED_NMS) |
|
|
|
endif() |
|
|
|
endif () |
|
|
|