File: SConstruct

package info (click to toggle)
python-escript 5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 87,772 kB
  • ctags: 49,550
  • sloc: python: 585,488; cpp: 133,173; ansic: 18,675; xml: 3,283; sh: 690; makefile: 215
file content (57 lines) | stat: -rw-r--r-- 1,492 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import os
import inspect

# try to import an environment first
try:
  Import('env')
except:
  exec open("../build/build-env.py")
  env = Environment()

# on mac we have to tell the linker to link against the C++ library
if env['PLATFORM'] == "darwin":
  env.Append(LINKFLAGS = "-lstdc++")

# on windows we have to do /bigobj
if env['PLATFORM'] == "win32" or env['PLATFORM'] == "win64":
  env.Append(CPPFLAGS = "/bigobj")

# find all .cus & .cpps in the current and backend/ directories
sources = []
directories = ['.', 'backend']
extensions = ['*.cu', '*.cpp']

# finall all backend-specific files
if env['backend'] == 'cuda' or env['backend'] == 'ocelot':
  directories.append(os.path.join('backend','cuda'))
elif env['backend'] == 'omp':
  directories.append(os.path.join('backend','omp'))

for dir in directories:
  for ext in extensions:
    regexp = os.path.join(dir, ext)
    sources.extend(env.Glob(regexp))

# filter test files using a regular expression
if 'tests' in env:
  import re

  pattern = re.compile(env['tests'])

  necessary_sources = set(['testframework.cu'])
  filtered_sources  = []

  for f in sources:
    if str(f) in necessary_sources or pattern.search(f.get_contents()):
      filtered_sources.append(f)

  sources = filtered_sources

# add the directory containing this file to the include path
this_file = inspect.currentframe().f_code.co_filename
this_dir = os.path.dirname(this_file)
env.Append(CPPPATH = [this_dir])

tester = env.Program('tester', sources)