summaryrefslogtreecommitdiff
path: root/kel_cmds
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2026-01-12 16:05:22 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2026-01-12 16:05:22 +0100
commit6eb839f219d80c018a58865a79f0623e839cef09 (patch)
treeb9668086665748487cb9be6e8de5eaeda838405c /kel_cmds
parentaf4bb05489eae478420a1792419fe43ee4b732d3 (diff)
downloadapps-dev_tools-6eb839f219d80c018a58865a79f0623e839cef09.tar.gz
Adding commands
Diffstat (limited to 'kel_cmds')
-rw-r--r--kel_cmds/.nix/derivation.nix23
-rw-r--r--kel_cmds/SConstruct70
-rw-r--r--kel_cmds/c++/SConscript32
-rw-r--r--kel_cmds/c++/kel_cmds.cpp1
4 files changed, 126 insertions, 0 deletions
diff --git a/kel_cmds/.nix/derivation.nix b/kel_cmds/.nix/derivation.nix
new file mode 100644
index 0000000..ac8f771
--- /dev/null
+++ b/kel_cmds/.nix/derivation.nix
@@ -0,0 +1,23 @@
+{ stdenv
+, scons
+, clang-tools
+, forstio
+}:
+
+stdenv.mkDerivation {
+ pname = "kel_cmds";
+ version = "0.0.0";
+
+ nativeBuildInputs = [
+ clang-tools
+ scons
+ ];
+
+ buildInputs = [
+ forstio.core
+ forstio.codec
+ forstio.codec-json
+ ];
+
+ src = ./..;
+}
diff --git a/kel_cmds/SConstruct b/kel_cmds/SConstruct
new file mode 100644
index 0000000..eeb0737
--- /dev/null
+++ b/kel_cmds/SConstruct
@@ -0,0 +1,70 @@
+#!/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'
+ ]
+)
+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/kel_cmds/c++/SConscript b/kel_cmds/c++/SConscript
new file mode 100644
index 0000000..6024167
--- /dev/null
+++ b/kel_cmds/c++/SConscript
@@ -0,0 +1,32 @@
+#!/bin/false
+
+import os
+import os.path
+import glob
+
+
+Import('env')
+
+dir_path = Dir('.').abspath
+
+# Environment for base library
+program_env = env.Clone();
+
+program_env.sources = sorted(glob.glob(dir_path + "/*.cpp"))
+program_env.headers = sorted(glob.glob(dir_path + "/*.hpp"))
+
+env.sources += program_env.sources;
+env.headers += program_env.headers;
+
+## Static lib
+objects_static = []
+program_env.add_source_files(objects_static, program_env.sources, shared=False);
+env.binary = program_env.Program('#build/kel_cmds', [objects_static]);
+
+# Set Alias
+env.Alias('binary', [env.binary]);
+
+env.targets += ['binary'];
+
+# Install
+env.Install('$prefix/bin/', [env.binary]);
diff --git a/kel_cmds/c++/kel_cmds.cpp b/kel_cmds/c++/kel_cmds.cpp
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/kel_cmds/c++/kel_cmds.cpp
@@ -0,0 +1 @@
+