123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- cmake_minimum_required(VERSION 3.5)
- project(gsd_var)
- add_definitions(-std=c++17)
- add_definitions(-DAPI_EXPORTS)
- option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
- set(CMAKE_CXX_STANDARD 17)
- set(CMAKE_BUILD_TYPE Debug)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
- find_package(CUDA REQUIRED)
- set(LINK_LIB_LIST "")
- set(ENABLE_MYSQL ON CACHE BOOL "enable mysql")
- #查找mysql是否安装
- find_package(MYSQL QUIET)
- if(MYSQL_FOUND AND ENABLE_MYSQL)
- message(STATUS "找到mysqlclient库:\"${MYSQL_INCLUDE_DIR}\",ENABLE_MYSQL宏已打开")
- include_directories(${MYSQL_INCLUDE_DIR})
- include_directories(${MYSQL_INCLUDE_DIR}/mysql)
- add_definitions(-DENABLE_MYSQL)
- list(APPEND LINK_LIB_LIST ${MYSQL_LIBRARIES})
- endif()
- link_directories(/usr/local/lib)
- include_directories(${PROJECT_SOURCE_DIR}/3rdparty/rapidjson/include/)
- include_directories(${PROJECT_SOURCE_DIR}/3rdparty/httplib/)
- include_directories(${PROJECT_SOURCE_DIR}/3rdparty/CSerialPort/)
- include_directories(/usr/local/include/)
- include_directories(${PROJECT_SOURCE_DIR}/3rdparty/)
- include_directories(${PROJECT_SOURCE_DIR}/include/)
- include_directories(${PROJECT_SOURCE_DIR}/models/)
- include_directories(${PROJECT_SOURCE_DIR}/modules/)
- include_directories(${PROJECT_SOURCE_DIR}/plugins/)
- # if(WIN32)
- # enable_language(CUDA)
- # endif(WIN32)
- include_directories(${PROJECT_SOURCE_DIR}/yolov5)
- # include and link dirs of cuda and tensorrt, you need adapt them if yours are different
- # cuda
- include_directories(/usr/local/cuda/include)
- link_directories(/usr/local/cuda/lib64)
- # tensorrt
- include_directories(/usr/include/x86_64-linux-gnu/)
- link_directories(/usr/lib/x86_64-linux-gnu/)
- link_directories(${PROJECT_SOURCE_DIR}/lib)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -g -Wfatal-errors -D_MWAITXINTRIN_H_INCLUDED")
- # cuda_add_library(myplugins SHARED yololayer.cu)
- # target_link_libraries(myplugins nvinfer cudart)
- find_package(OpenCV)
- include_directories(${OpenCV_INCLUDE_DIRS})
- find_package(Drogon CONFIG REQUIRED)
- aux_source_directory(controllers CTL_SRC)
- aux_source_directory(filters FILTER_SRC)
- aux_source_directory(plugins PLUGIN_SRC)
- aux_source_directory(models MODEL_SRC)
- # aux_source_directory(modules MODULES_SRC)
- drogon_create_views(gsd_var${CMAKE_CURRENT_SOURCE_DIR}/views
- ${CMAKE_CURRENT_BINARY_DIR})
- # target_include_directories(${PROJECT_NAME}
- # PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
- # ${CMAKE_CURRENT_SOURCE_DIR}/models)
- cuda_add_executable(gsd_var main.cc ${PROJECT_SOURCE_DIR}/modules/InferTools.cpp ${PROJECT_SOURCE_DIR}/yolov5/calibrator.cpp ${PROJECT_SOURCE_DIR}/yolov5/preprocess.cu ${PROJECT_SOURCE_DIR}/yolov5/common.cpp)
- target_link_libraries(gsd_var nvinfer Drogon::Drogon ZLToolKit ${OpenCV_LIBS})
- target_link_libraries(gsd_var cudart)
- target_link_libraries(${PROJECT_NAME} myplugins)
-
- target_sources(gsd_var
- PRIVATE
- ${SRC_DIR}
- ${CTL_SRC}
- ${FILTER_SRC}
- ${PLUGIN_SRC}
- ${MODEL_SRC})
- if(UNIX)
- add_definitions(-O2 -pthread)
- endif(UNIX)
|