summaryrefslogtreecommitdiff
path: root/lib/heterogenous
diff options
context:
space:
mode:
Diffstat (limited to 'lib/heterogenous')
-rw-r--r--lib/heterogenous/.nix/derivation.nix41
-rw-r--r--lib/heterogenous/SConstruct75
-rw-r--r--lib/heterogenous/c++/SConscript27
-rw-r--r--lib/heterogenous/c++/common.hpp12
-rw-r--r--lib/heterogenous/tests/SConscript32
5 files changed, 187 insertions, 0 deletions
diff --git a/lib/heterogenous/.nix/derivation.nix b/lib/heterogenous/.nix/derivation.nix
new file mode 100644
index 0000000..3686e21
--- /dev/null
+++ b/lib/heterogenous/.nix/derivation.nix
@@ -0,0 +1,41 @@
+{ lib
+, stdenv
+, scons
+, clang-tools
+, pname
+, version
+, forstio
+, kel-lbm
+, adaptive-cpp
+}:
+
+stdenv.mkDerivation {
+ pname = "${pname}-heterogenous";
+ inherit version;
+ src = ./..;
+
+ nativeBuildInputs = [
+ scons
+ clang-tools
+ ];
+
+ buildInputs = [
+ forstio.core
+ forstio.async
+ forstio.codec
+ forstio.codec-unit
+ forstio.codec-json
+ forstio.remote
+ kel-lbm.core
+ ];
+
+ doCheck = true;
+ checkPhase = ''
+ scons test
+ ./bin/tests
+ '';
+
+ preferLocalBuild = true;
+
+ outputs = [ "out" "dev" ];
+}
diff --git a/lib/heterogenous/SConstruct b/lib/heterogenous/SConstruct
new file mode 100644
index 0000000..8b3ab01
--- /dev/null
+++ b/lib/heterogenous/SConstruct
@@ -0,0 +1,75 @@
+#!/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('c++/SConscript')
+SConscript('tests/SConscript')
+
+env.Alias('cdb', env.cdb);
+env.Alias('all', [env.targets]);
+env.Default('all');
+
+env.Alias('install', '$prefix')
diff --git a/lib/heterogenous/c++/SConscript b/lib/heterogenous/c++/SConscript
new file mode 100644
index 0000000..b66e979
--- /dev/null
+++ b/lib/heterogenous/c++/SConscript
@@ -0,0 +1,27 @@
+#!/bin/false
+
+import os
+import os.path
+import glob
+
+
+Import('env')
+
+dir_path = Dir('.').abspath
+
+# Environment for base library
+hetero_env = env.Clone();
+
+hetero_env.sources = sorted(glob.glob(dir_path + "/*.cpp"));
+hetero_env.headers = sorted(glob.glob(dir_path + "/*.hpp"));
+
+env.sources += hetero_env.sources;
+env.headers += hetero_env.headers;
+
+## Static lib
+objects = []
+hetero_env.add_source_files(objects, hetero_env.sources, shared=False);
+env.library_static = hetero_env.StaticLibrary('#build/kel-lbm-hetero', [objects]);
+
+env.Install('$prefix/lib/', env.library_static);
+env.Install('$prefix/include/kel/lbm/hetero/', hetero_env.headers);
diff --git a/lib/heterogenous/c++/common.hpp b/lib/heterogenous/c++/common.hpp
new file mode 100644
index 0000000..789c876
--- /dev/null
+++ b/lib/heterogenous/c++/common.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <forstio/codec/data.hpp>
+
+namespace kel {
+namespace lbm {
+template<typename T, uint64_t D>
+class super_block {
+};
+
+}
+}
diff --git a/lib/heterogenous/tests/SConscript b/lib/heterogenous/tests/SConscript
new file mode 100644
index 0000000..d1b381e
--- /dev/null
+++ b/lib/heterogenous/tests/SConscript
@@ -0,0 +1,32 @@
+#!/bin/false
+
+import os
+import os.path
+import glob
+
+
+Import('env')
+
+dir_path = Dir('.').abspath
+
+# Environment for base library
+test_cases_env = env.Clone();
+
+test_cases_env.Append(LIBS=['forstio-test']);
+
+test_cases_env.sources = sorted(glob.glob(dir_path + "/*.cpp"))
+test_cases_env.headers = sorted(glob.glob(dir_path + "/*.hpp"))
+
+env.sources += test_cases_env.sources;
+env.headers += test_cases_env.headers;
+
+objects_static = []
+test_cases_env.add_source_files(objects_static, test_cases_env.sources, shared=False);
+test_cases_env.program = test_cases_env.Program('#bin/tests', [objects_static]);
+# , env.library_static]);
+
+# Set Alias
+env.Alias('test', test_cases_env.program);
+env.Alias('check', test_cases_env.program);
+
+env.targets += ['test','check'];