/[escript]/branches/diaplayground/cusplibrary/testing/SConstruct
ViewVC logotype

Annotation of /branches/diaplayground/cusplibrary/testing/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4955 - (hide annotations)
Tue May 20 04:33:15 2014 UTC (5 years, 5 months ago) by caltinay
File size: 1492 byte(s)
added pristine copy of cusplibrary (apache license) to be used by ripley.

1 caltinay 4955 import os
2     import inspect
3    
4     # try to import an environment first
5     try:
6     Import('env')
7     except:
8     exec open("../build/build-env.py")
9     env = Environment()
10    
11     # on mac we have to tell the linker to link against the C++ library
12     if env['PLATFORM'] == "darwin":
13     env.Append(LINKFLAGS = "-lstdc++")
14    
15     # on windows we have to do /bigobj
16     if env['PLATFORM'] == "win32" or env['PLATFORM'] == "win64":
17     env.Append(CPPFLAGS = "/bigobj")
18    
19     # find all .cus & .cpps in the current and backend/ directories
20     sources = []
21     directories = ['.', 'backend']
22     extensions = ['*.cu', '*.cpp']
23    
24     # finall all backend-specific files
25     if env['backend'] == 'cuda' or env['backend'] == 'ocelot':
26     directories.append(os.path.join('backend','cuda'))
27     elif env['backend'] == 'omp':
28     directories.append(os.path.join('backend','omp'))
29    
30     for dir in directories:
31     for ext in extensions:
32     regexp = os.path.join(dir, ext)
33     sources.extend(env.Glob(regexp))
34    
35     # filter test files using a regular expression
36     if 'tests' in env:
37     import re
38    
39     pattern = re.compile(env['tests'])
40    
41     necessary_sources = set(['testframework.cu'])
42     filtered_sources = []
43    
44     for f in sources:
45     if str(f) in necessary_sources or pattern.search(f.get_contents()):
46     filtered_sources.append(f)
47    
48     sources = filtered_sources
49    
50     # add the directory containing this file to the include path
51     this_file = inspect.currentframe().f_code.co_filename
52     this_dir = os.path.dirname(this_file)
53     env.Append(CPPPATH = [this_dir])
54    
55     tester = env.Program('tester', sources)
56    
57    

  ViewVC Help
Powered by ViewVC 1.1.26