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
58
59
60
61
62
63
64
65
66
|
#!/usr/bin/env python3
import sys
import os
import os.path
import glob
import re
if sys.version_info < (3,):
def isbasestring(s):
return isinstance(s,basestring)
else:
def isbasestring(s):
return isinstance(s, (str,bytes))
def add_kel_source_files(self, sources, filetype, lib_env=None, shared=False, target_post=""):
if isbasestring(filetype):
dir_path = self.Dir('.').abspath
filetype = sorted(glob.glob(dir_path+"/"+filetype))
for path in filetype:
target_name = re.sub( r'(.*?)(\.cpp|\.c\+\+)', r'\1' + target_post, path )
if shared:
target_name+='.os'
sources.append( self.SharedObject( target=target_name, source=path ) )
else:
target_name+='.o'
sources.append( self.StaticObject( target=target_name, source=path ) )
pass
def isAbsolutePath(key, dirname, env):
assert os.path.isabs(dirname), "%r must have absolute path syntax" % (key,)
env_vars = Variables(
args=ARGUMENTS
)
env_vars.Add('prefix',
help='Installation target location of build results and headers',
default='/usr/local/',
validator=isAbsolutePath
)
env=Environment(ENV=os.environ, variables=env_vars, CPPPATH=[],
CPPDEFINES=['SAW_UNIX'],
CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'],
LIBS=['forstio-core'])
env.__class__.add_source_files = add_kel_source_files
env.Tool('compilation_db');
env.cdb = env.CompilationDatabase('compile_commands.json');
env.objects = [];
env.sources = [];
env.headers = [];
env.targets = [];
Export('env')
SConscript('src/SConscript')
env.Alias('cdb', env.cdb);
env.Alias('all', [env.targets]);
env.Default('all');
env.Alias('install', '$prefix')
|