summaryrefslogtreecommitdiff
path: root/modules/remote
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2024-07-10 14:14:56 +0200
committerClaudius "keldu" Holeksa <mail@keldu.de>2024-07-10 14:14:56 +0200
commit72cb86441bb405d7d5882abd3331d5191c7aab8c (patch)
tree21e7e04adc982258d7eb605314829b3a29d13bd0 /modules/remote
parent4eac6ba237bcf430bdab954020e3caf5094ba707 (diff)
Preparation to separate remote code from codec
Diffstat (limited to 'modules/remote')
-rw-r--r--modules/remote/.nix/derivation.nix36
-rw-r--r--modules/remote/SConstruct73
2 files changed, 109 insertions, 0 deletions
diff --git a/modules/remote/.nix/derivation.nix b/modules/remote/.nix/derivation.nix
new file mode 100644
index 0000000..8f6dd74
--- /dev/null
+++ b/modules/remote/.nix/derivation.nix
@@ -0,0 +1,36 @@
+{ lib
+, stdenv
+, scons
+, clang-tools
+, version
+, forstio
+}:
+
+let
+
+in stdenv.mkDerivation {
+ pname = "forstio-remote";
+ inherit version;
+ src = ./..;
+
+ enableParallelBuilding = true;
+
+ buildInputs = [
+ forstio.core
+ forstio.async
+ forstio.codec
+ ];
+
+ nativeBuildInputs = [
+ scons
+ clang-tools
+ ];
+
+ doCheck = true;
+ checkPhase = ''
+ scons test
+ ./bin/tests
+ '';
+
+ outputs = ["out" "dev"];
+}
diff --git a/modules/remote/SConstruct b/modules/remote/SConstruct
new file mode 100644
index 0000000..89b68d0
--- /dev/null
+++ b/modules/remote/SConstruct
@@ -0,0 +1,73 @@
+#!/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=[],
+ CXX=['c++'],
+ CPPDEFINES=['SAW_UNIX'],
+ CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'],
+ LIBS=[
+ 'forstio-core',
+ 'forstio-async',
+ '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')