CMakeLists.txt 写的比较糙,有疑问欢迎咨询。
option(GPU ON) option(CUDNN ON) option(OPENCV ON) cmake_minimum_required(VERSION 3.1) project(darknet) SET(CMAKE_C_FLAGS "-pipe -O2 -Wall -W -fPIC") set(CMAKE_BUILD_TYPE "Release") add_definitions(-DGPU) message(STATUS "GPU") add_definitions(-DCUDNN) message(STATUS "CUDNN") add_definitions(-DOPENCV) message(STATUS "OPENCV") list(APPEND CUDA_NVCC_FLAGS "-std=c++11") find_package(CUDA REQUIRED) link_directories(/usr/local/cuda/lib64/) include_directories(/usr/local/lib /usr/local/cuda/bin/nvcc /usr/local/cuda/include/ /usr/local/cuda/lib64) SET(OpenCV_DIR /usr/share/OpenCV) find_package(OpenCV REQUIRED) find_package(Boost COMPONENTS system date_time thread chrono regex random REQUIRED) add_library(darkyl STATIC darknet.c) set(CUDA_NVCC_FLAGS -gencode arch=compute_50,code=[sm_50,compute_50];-G;-g) set(source_files cuda/activation_kernels.cu cuda/avgpool_layer_kernels.cu cuda/blas_kernels.cu cuda/col2im_kernels.cu cuda/convolutional_kernels.cu cuda/crop_layer_kernels.cu cuda/deconvolutional_kernels.cu cuda/dropout_layer_kernels.cu cuda/im2col_kernels.cu cuda/maxpool_layer_kernels.cu cuda/activation_layer.h cuda/activations.h cuda/avgpool_layer.h cuda/batchnorm_layer.h cuda/blas.h cuda/box.h cuda/classifier.h cuda/col2im.h cuda/connected_layer.h cuda/convolutional_layer.h cuda/cost_layer.h cuda/crnn_layer.h cuda/crop_layer.h cuda/cuda.h cuda/data.h cuda/deconvolutional_layer.h cuda/demo.h cuda/detection_layer.h cuda/detector.h cuda/dropout_layer.h cuda/gemm.h cuda/gru_layer.h cuda/im2col.h cuda/image.h cuda/iseg_layer.h cuda/l2norm_layer.h cuda/layer.h cuda/list.h cuda/local_layer.h cuda/logistic_layer.h cuda/lstm_layer.h cuda/matrix.h cuda/maxpool_layer.h cuda/network.h cuda/normalization_layer.h cuda/option_list.h cuda/parser.h cuda/region_layer.h cuda/reorg_layer.h cuda/rnn_layer.h cuda/route_layer.h cuda/shortcut_layer.h cuda/softmax_layer.h cuda/stb_image.h cuda/stb_image_write.h cuda/tree.h cuda/upsample_layer.h cuda/utils.h cuda/yolo_layer.h csrc/activation_layer.c csrc/activations.c csrc/art.c csrc/attention.c csrc/avgpool_layer.c csrc/batchnorm_layer.c csrc/blas.c csrc/box.c csrc/captcha.c csrc/cifar.c csrc/classifier.c csrc/coco.c csrc/col2im.c csrc/connected_layer.c csrc/convolutional_layer.c csrc/cost_layer.c csrc/crnn_layer.c csrc/crop_layer.c csrc/cuda.c csrc/darknet.c csrc/data.c csrc/deconvolutional_layer.c csrc/demo.c csrc/detection_layer.c csrc/detector.c csrc/dropout_layer.c csrc/gemm.c csrc/go.c csrc/gru_layer.c csrc/im2col.c csrc/image.c csrc/instance-segmenter.c csrc/iseg_layer.c csrc/l2norm_layer.c csrc/layer.c csrc/list.c csrc/local_layer.c csrc/logistic_layer.c csrc/lsd.c csrc/lstm_layer.c csrc/matrix.c csrc/maxpool_layer.c csrc/network.c csrc/nightmare.c csrc/normalization_layer.c csrc/option_list.c csrc/parser.c csrc/region_layer.c csrc/regressor.c csrc/reorg_layer.c csrc/rnn.c csrc/rnn_layer.c csrc/route_layer.c csrc/segmenter.c csrc/shortcut_layer.c csrc/softmax_layer.c csrc/super.c csrc/tag.c csrc/tree.c csrc/upsample_layer.c csrc/utils.c csrc/yolo.c csrc/yolo_layer.c cppsrc/image_opencv.cpp cppsrc/image_opencv.h cppsrc/image.h ) #add_executable(darknet darknet.c) cuda_add_executable(darknet ${source_files}) target_link_libraries(darknet ${Boost_LIBRARIES} ${OpenCV_LIBS}) target_link_libraries(darknet pthread -lcuda -lcudart -lcublas -lcurand -lcudnn) target_link_libraries(darknet m)