cuda.py
Go to the documentation of this file.
1 import generic
2 
3 from waflib import Task
4 from waflib.TaskGen import extension
5 from waflib.Tools import ccroot, c_preproc
6 from waflib.Configure import conf
7 
8 import os
9 
10 # from waf's playground
11 class cuda(Task.Task):
12  run_str = '${NVCC} ${NVCCFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ${CPPPATH_ST:INCPATHS} ${DEFINES_ST:DEFINES} ${CXX_SRC_F}${SRC} ${CXX_TGT_F} ${TGT}'
13  color = 'GREEN'
14  ext_in = ['.h']
15  vars = ['CCDEPS']
16  scan = c_preproc.scan
17  shell = False
18 
19 @extension('.cu', '.cuda')
20 def c_hook(self, node):
21  return self.create_compiled_task('cuda', node)
22 
23 @extension('.cxx')
24 def cxx_hook(self, node):
25  # override processing for one particular type of file
26  if getattr(self, 'cuda', False):
27  return self.create_compiled_task('cuda', node)
28  else:
29  return self.create_compiled_task('cxx', node)
30 
31 def options(opt):
32  generic._options(opt, "CUDA")
33 
34 def configure(cfg):
35 
36  generic._configure(cfg, "CUDA", mandatory=False,
37  incs=["cuda.h"], libs=["cuda","cudart"], bins=["nvcc"])
38 
39  if not 'HAVE_CUDA' in cfg.env:
40  return
41  nvccflags = "-shared -Xcompiler -fPIC "
42  nvccflags += os.environ.get("NVCCFLAGS","")
43  cfg.env.NVCCFLAGS += nvccflags.strip().split()
44  print ("NVCCFLAGS = %s" % (' '.join(cfg.env.NVCCFLAGS)))
def _configure(ctx, name, incs=(), libs=(), bins=(), pcname=None, mandatory=True)
Definition: generic.py:50
def configure(cfg)
Definition: cuda.py:34
def _options(opt, name)
Definition: generic.py:39
Proc * join(Pipeline &pipeline, Proc *src, Proc *dst)
Definition: GenPipeline.h:218
def c_hook(self, node)
Definition: cuda.py:20
def cxx_hook(self, node)
Definition: cuda.py:24
void split(std::string const &s, char c, OutIter dest)
Definition: split.h:35
def options(opt)
Definition: cuda.py:31