qt ubuntu16.04下qmake备忘

#-------------------------------------------------
#
# Project created by QtCreator 2014-04-03T18:12:01
#
#-------------------------------------------------

QT       += core
QT       -= gui

TARGET = CUDA_helloworld
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp

# GLM
INCLUDEPATH += /usr/local/glm

# C++ flag
QMAKE_CXXFLAGS_RELEASE=-O3

# CUDA stuff
CUDA_SOURCES += kernel2.cu\

# uncomment below to also import include CUDA SDK
#CUDA_SDK = /contrib/projects/cuda-sdk/C
#INCLUDEPATH += $$CUDA_SDK/common/inc/
#INCLUDEPATH += $$CUDA_SDK/../shared/inc/
#QMAKE_LIBDIR += $$CUDA_SDK/lib
#QMAKE_LIBDIR += $$CUDA_SDK/common/lib


CUDA_DIR = /usr/local/cuda-8.0
INCLUDEPATH += $$CUDA_DIR/include
QMAKE_LIBDIR += $$CUDA_DIR/lib64
#LD_LIBRARY_PATH=$${LD_LIBRARY_PATH}:$$CUDA_DIR/lib64
#message($${LD_LIBRARY_PATH})

#$$(PATH) = $$(PATH):$$CUDA_DIR/bin
#message($$(PATH))

LIBS += -lcudart -lcuda

OTHER_FILES += \
    CUDA_notes.txt

# GPU ARCH
# this gets passed as the gpu-architecture flag to nvcc compiler
# specifying particular architectures enable certain features, limited to the compute capability
# of the GPU. compute capabilities listed here http://en.wikipedia.org/wiki/CUDA
# MSLAB GeForce 460 seems to have compute capability 2.1
CUDA_ARCH = sm_21

# custom NVCC flags
NVCCFLAGS     = --compiler-options -fno-strict-aliasing -use_fast_math --ptxas-options=-v

# Prepare the extra compiler configuration (taken from the nvidia forum - i'm not an expert in this part)
CUDA_INC = $$join(INCLUDEPATH,' -I','-I',' ')

# compile CUDA kernels using nvcc
cuda.commands = $$CUDA_DIR/bin/nvcc -m64 -g -G -arch=$$CUDA_ARCH -c $$NVCCFLAGS $$CUDA_INC $$LIBS  ${QMAKE_FILE_NAME} -o ${QMAKE_FILE_OUT} \
    2>&1 | sed -r \"s/\\(([0-9]+)\\)/:\\1/g\" 1>&2
# Prepare the extra compiler configuration (taken from the nvidia forum - i'm not an expert in this part)
cuda.input = CUDA_SOURCES
cuda.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}_cuda.o # suffix needed for this to work?
# Tell Qt that we want add more stuff to the Makefile
QMAKE_EXTRA_UNIX_COMPILERS += cuda

DISTFILES +=

HEADERS +=

 

转载于:https://www.cnblogs.com/wjx-zjut/p/7563290.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值