summaryrefslogtreecommitdiff
path: root/modules/remote-kokkos/SConstruct
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-01-28 16:03:29 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-01-28 16:03:29 +0100
commit6f2cabfa4311eb71d70ec03a0a46b9ab55fd0820 (patch)
tree39401fc71ad2d804f10cf1c7296acb35e75dde59 /modules/remote-kokkos/SConstruct
parentae75e63bfaf927e10e9f2642b3a1a9dae04b7dbc (diff)
device-hip, remote-kokkos: Moving to kokkos. Easier to manage
Diffstat (limited to 'modules/remote-kokkos/SConstruct')
-rw-r--r--modules/remote-kokkos/SConstruct71
1 files changed, 71 insertions, 0 deletions
diff --git a/modules/remote-kokkos/SConstruct b/modules/remote-kokkos/SConstruct
new file mode 100644
index 0000000..c5b2bb4
--- /dev/null
+++ b/modules/remote-kokkos/SConstruct
@@ -0,0 +1,71 @@
+#!/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'
+ 'forstio-codec'
+ ]
+);
+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('c++/SConscript')
+SConscript('tests/SConscript')
+
+env.Alias('cdb', env.cdb);
+env.Alias('all', [env.targets]);
+env.Default('all');
+
+env.Alias('install', '$prefix')