title: Linking Qt + CUDA + external library
body: <p>I've written a PRO file to generate a GUI for my CUDA application under linux (already compiled under windows now porting same components to ubuntu 1404). </p>
  
  <p>I've first compiled a helper library "mylib.a" and linked that with my application "myapp.cu" and tested that it compiles and runs nicely without Qt in the picture (done via nsight eclipse).</p>
  
  <p>For building with Qt I've generated the following PRO file:</p>
  
  <pre><code>#############################
  # basic PRO file for qmake
  ##############################
  
  
  # QT libs to use
  QT       += core gui
  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
  ##########################################
  # QT basic files
  ##########################################
  SOURCES+=main.cpp
  SOURCES+=myGUI.cpp
  
  HEADERS += myGUI.h
  FORMS   += myGUI.ui
  
  # Project dir and outputs
  PROJECT_DIR = $$system(pwd)
  OBJECTS_DIR = $$PROJECT_DIR/Obj
  DESTDIR = ../bin
  
  ##########################################
  # CUDA source files
  ##########################################
  CUDA_SOURCES += myApp.cu
  CUDA_SOURCES += kernel1.cu
  CUDA_SOURCES += kernel2.cu
  
  ##########################################
  # CUDA related components
  ##########################################
  
  CUDA_DIR = /usr/local/cuda
  CUDA_ARCH = sm_35
  NVCCFLAGS = --compiler-options -fno-strict-aliasing -use_fast_math --ptxas-options=-v
  
  
  ##########################################
  # include paths
  ##########################################
  # CUDA
  INCLUDEPATH += $$CUDA_DIR/include
  
  
  # Additional dependencies
  
  INCLUDEPATH += /usr/include/
  
  ##########################################
  # library directories
  ##########################################
  QMAKE_LIBDIR += $$CUDA_DIR/lib64
  QMAKE_LIBDIR += $$CUDA_DIR/samples/common/lib
  
  
  ##########################################
  #  LIBS
  ##########################################
  
  LIBS += -lnvToolsExt
  LIBS += -lopengl
  #libcudart_static
  #LIBS += -lcudart_static
  LIBS += -lcuda
  LIBS += -lcudart
  LIBS += -lGL
  # My library is added here
  LIBS += -lmyLib 
  
  # join the includes in a line
  CUDA_INC = $$join(INCLUDEPATH,' -I','-I',' ')
  
  
  ##########################################
  # Extra compiler configuration for CUDA
  ##########################################
  
  cuda.input = CUDA_SOURCES
  cuda.output = ${OBJECTS_DIR}${QMAKE_FILE_BASE}.o
  
  cuda.commands = $$CUDA_DIR/bin/nvcc $$CUDA_DEFINES -m64 -g -arch=$$CUDA_ARCH -c $$NVCCFLAGS $$CUDA_INC $$LIBS  ${QMAKE_FILE_NAME} -c -o ${QMAKE_FILE_OUT}
  
  cuda.dependency_type = TYPE_C 
  cuda.depend_command = $$CUDA_DIR/bin/nvcc $$CUDA_DEFINES -g -M $$CUDA_INC $$NVCCFLAGS ${QMAKE_FILE_NAME}
  # Tell Qt that we want add more stuff to the Makefile
  QMAKE_EXTRA_UNIX_COMPILERS += cuda
  </code></pre>