diff options
| author | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-07 15:17:04 +0100 |
|---|---|---|
| committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2025-11-07 15:17:04 +0100 |
| commit | ca8d14bf09d9f863b0b3246cd6805a4ea9e571af (patch) | |
| tree | 9e0ac018a048eb8e27aff74975a2d23d5ec8aa68 | |
| parent | 136966aeac7ac000d5b0aadc689e40a61aa5efd5 (diff) | |
| download | apps-science_tools-ca8d14bf09d9f863b0b3246cd6805a4ea9e571af.tar.gz | |
Making repo clean for testing
| -rw-r--r-- | cell_renderer/.nix/derivation.nix | 23 | ||||
| -rw-r--r-- | cell_renderer/SConstruct | 71 | ||||
| -rw-r--r-- | cell_renderer/c++/SConscript | 32 | ||||
| -rw-r--r-- | cell_renderer/c++/main.cpp | 25 | ||||
| -rw-r--r-- | run_and_record/c++/git.hpp | 1 |
5 files changed, 152 insertions, 0 deletions
diff --git a/cell_renderer/.nix/derivation.nix b/cell_renderer/.nix/derivation.nix new file mode 100644 index 0000000..78b8efd --- /dev/null +++ b/cell_renderer/.nix/derivation.nix @@ -0,0 +1,23 @@ +{ stdenv +, scons +, forstio +}: + +stdenv.mkDerivation { + pname = "kel_cell_renderer"; + version = "0.0.0"; + + nativeBuildInputs = [ + scons + ]; + + buildInputs = [ + forstio.core + forstio.codec + forstio.codec-json + forstio.remote + forstio.remote-filesystem + ]; + + src = ./..; +} diff --git a/cell_renderer/SConstruct b/cell_renderer/SConstruct new file mode 100644 index 0000000..d85358b --- /dev/null +++ b/cell_renderer/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=[], + 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/cell_renderer/c++/SConscript b/cell_renderer/c++/SConscript new file mode 100644 index 0000000..bf3e778 --- /dev/null +++ b/cell_renderer/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_rar', [objects_static]); + +# Set Alias +env.Alias('binary', [env.binary]); + +env.targets += ['binary']; + +# Install +env.Install('$prefix/bin/', [env.binary]); diff --git a/cell_renderer/c++/main.cpp b/cell_renderer/c++/main.cpp new file mode 100644 index 0000000..40d6365 --- /dev/null +++ b/cell_renderer/c++/main.cpp @@ -0,0 +1,25 @@ + +namespace kel { +saw::error_or<void> kel_main(int argc, char** argv){ + + return saw::make_void(); +} +} + +int main(int argc, char** argv){ + auto eov = kel::kel_main(argc, argv); + if(eov.is_error()){ + auto& err = eov.get_error(); + auto err_msg = err.get_message(); + std::cerr<<"[Error]: "<<err.get_category(); + + if(not err_msg.empty()){ + std::cerr<<" - "<<err_msg; + } + std::cerr<<std::endl; + + return err.get_id(); + } + + return 0; +} diff --git a/run_and_record/c++/git.hpp b/run_and_record/c++/git.hpp index c145e01..7b1dd8f 100644 --- a/run_and_record/c++/git.hpp +++ b/run_and_record/c++/git.hpp @@ -10,6 +10,7 @@ namespace kel { saw::error_or<saw::data<sch::RarGit>> is_clean_git_repo(){ saw::data<sch::RarGit> git_data; + git_libgit2_init(); git_repository *repo = nullptr; { int error = git_repository_open_ext(&repo, ".", 0, nullptr); |
