NVIDIA Tegra X1 下OPencv+GPU在QT下配置

TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
TARGET = cudaQTS
CUDA_SOURCES += main.cu

INCLUDEPATH += /usr/include/opencv4 #添加头文件路径
LIBS += -L/usr/lib/aarch64-linux-gnu -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -lopencv_highgui -lopencv_objdetect  #添加需要链接的库
LIBS += -L"/usr/local/lib"     -L"/usr/local/cuda/lib64"     -lcudart     -lcufft
CUDA_SDK = "/usr/local/cuda-10.2/"   # Path to cuda SDK install
CUDA_DIR = "/usr/local/cuda-10.2/"            # Path to cuda toolkit install
#####系统类型,计算能力###########
SYSTEM_NAME = linux         # Depending on your system either ‘Win32‘, ‘x64‘, or ‘Win64‘
SYSTEM_TYPE = 64            # ‘32‘ or ‘64‘, depending on your system
CUDA_ARCH = sm_53           # Type of CUDA architecture, for example ‘compute_10‘, ‘compute_11‘, ‘sm_10‘
NVCC_OPTIONS = --use_fast_math
INCLUDEPATH += $$CUDA_DIR/include
QMAKE_LIBDIR += $$CUDA_DIR/lib64/
CUDA_OBJECTS_DIR = ./
CUDA_LIBS = cudart cufft
CUDA_INC = $$join(INCLUDEPATH,‘" -I"‘,‘-I"‘,‘"‘)
NVCC_LIBS = $$join(CUDA_LIBS,‘ -l‘,‘-l‘, ‘‘)
CONFIG(debug, debug|release) {
    # Debug mode
    cuda_d.input = CUDA_SOURCES
    cuda_d.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
    cuda_d.commands = $$CUDA_DIR/bin/nvcc -D_DEBUG $$NVCC_OPTIONS $$CUDA_INC $$NVCC_LIBS --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
    cuda_d.dependency_type = TYPE_C
    QMAKE_EXTRA_COMPILERS += cuda_d
}
else {
    # Release mode
    cuda.input = CUDA_SOURCES
    cuda.output = $$CUDA_OBJECTS_DIR/${QMAKE_FILE_BASE}_cuda.o
    cuda.commands = $$CUDA_DIR/bin/nvcc $$NVCC_OPTIONS $$CUDA_INC $$NVCC_LIBS --machine $$SYSTEM_TYPE -arch=$$CUDA_ARCH -O3 -c -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_NAME}
    cuda.dependency_type = TYPE_C
    QMAKE_EXTRA_COMPILERS += cuda
}
DISTFILES +=     main.cu

NVIDIA Tegra X1 下OPencv+GPU在QT下配置

上一篇:HZNU-AlternatingCat 训练实录


下一篇:使用Calendar类的一点注意事项