-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathSConscript
executable file
·52 lines (42 loc) · 1.66 KB
/
SConscript
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
# Copyright (C) 2008-today The SG++ Project
# This file is part of the SG++ project. For conditions of distribution and
# use, please see the copyright notice provided with SG++ or at
# sgpp.sparsegrids.org
import os
import fnmatch
Import('env')
Import('BUILD_DIR')
Import('PYSGPP_BUILD_PATH')
Import('moduleName')
Import('libraryTargetList')
Import('installTargetList')
Import('exampleTargetList')
libs = ['sgppbase']
srcs = []
for currentFolder, subdirNames, fileNames in os.walk("."):
if currentFolder.startswith("./src"):
for fileName in fnmatch.filter(fileNames, '*.cpp'):
srcs.append(os.path.join(currentFolder, fileName))
objs = []
for sourceFile in srcs:
objs.append(env.SharedObject(sourceFile))
lib = env.SharedLibrary(target="sgpp%s" % moduleName,
source=objs,
LIBPATH=BUILD_DIR,
LIBS=libs)
env.Depends(lib, "#/" + BUILD_DIR.path + "/" + env["LIBPREFIX"] + "sgppbase" + env["SHLIBSUFFIX"])
libInstall = env.Install(BUILD_DIR, lib)
if not env['NO_UNIT_TESTS'] and env['SG_PYTHON']:
Import('testTargetList')
moduleTest = env.Test(os.path.join('tests', 'test_%s.py' % moduleName))
env.Requires(moduleTest, libInstall)
testTargetList.append(moduleTest)
for fileName in os.listdir("examples"):
if fnmatch.fnmatch(fileName, "*.cpp"):
example = env.Program(source=os.path.join("examples", fileName),
LIBPATH=BUILD_DIR,
LIBS=libs + ["sgpp%s" % moduleName])
env.Requires(example, libInstall)
exampleTargetList.append(example)
libraryTargetList.append(lib)
installTargetList.append(libInstall)