Blame c++/contourgl/SConstruct

546280
546280
env = Environment()
546280
546280
# config
546280
546280
# just comment following line to disable CUDA
546280
cuda          = 'cuda-9.2'
546280
try: cuda
546280
except NameError: cuda = ''
546280
cuda_path      = '/opt/' + cuda
546280
cuda_bin       = cuda_path + '/bin'
546280
cuda_pkgconfig = cuda_path + '/pkgconfig'
546280
cuda_flags     = '-O3 -use_fast_math'
546280
546280
libs = ['gl', 'x11', 'OpenCL']
546280
546280
546280
# compute build options
546280
546280
flags = ' -O3 -Wall -fmessage-length=0 -DGL_GLEXT_PROTOTYPES'
546280
cuda_flags = ' '
546280
546280
if cuda:
546280
	flags += ' -DCUDA'
546280
	
546280
	# remember pkg-config path
546280
	old = env['ENV']['PKG_CONFIG_PATH'] if 'PKG_CONFIG_PATH' in env['ENV'] else None
546280
546280
	env['ENV']['PKG_CONFIG_PATH'] = cuda_pkgconfig
546280
	env.ParseConfig('pkg-config --cflags --libs ' + cuda)
546280
	
546280
	# restore pkg-config path
546280
	if old: env['ENV']['PKG_CONFIG_PATH'] = old
546280
	
546280
	env['BUILDERS']['Cuda'] = Builder(
546280
		action = cuda_bin + '/nvcc ' + cuda_flags + '-ptx $SOURCE -o $TARGET',
546280
		suffix = '.ptx',
546280
		src_suffix = '.cu' )
546280
	
546280
546280
# files lists
546280
546280
target = 'contourgl'
546280
546280
sources = [
546280
	'contourgl.cpp',
546280
	'clcontext.cpp',
546280
	'clrender.cpp',
546280
	'contour.cpp',
546280
	'contourbuilder.cpp',
546280
	'environment.cpp',
546280
	'geometry.cpp',
546280
	'glcontext.cpp',
546280
	'measure.cpp',
546280
	'polyspan.cpp',
546280
	'shaders.cpp',
546280
	'swrender.cpp',
546280
	'test.cpp',
546280
	'triangulator.cpp',
546280
	'utils.cpp' ]
546280
546280
if cuda:
546280
	sources += [
546280
		'cudacontext.cpp',
546280
		'cudarender.cpp' ]
546280
	cuda_sources = [
546280
		'cuda/contour.cu',
546280
		'cuda/hello.cu' ]
546280
546280
546280
# build
546280
546280
env.ParseConfig('pkg-config --cflags --libs ' + ' '.join(libs))
546280
546280
if cuda:
546280
	for cuda_source in cuda_sources:
546280
		env.Cuda(cuda_source)
546280
	
546280
env.Program(
546280
	target = target,
546280
	source = sources,
546280
	parse_flags = flags )
546280