diff options
author | Claudius Holeksa <mail@keldu.de> | 2023-05-23 23:09:06 +0200 |
---|---|---|
committer | Claudius Holeksa <mail@keldu.de> | 2023-05-23 23:09:06 +0200 |
commit | 1cb8a4c73ce7e326ad015b57595bb24afbb153d6 (patch) | |
tree | a5fe67d1a911501968a905c8aff43556a01e5865 | |
parent | c49d97a9c13fc9e3d012acb16e5ca511e4b04ca7 (diff) |
General setup of files
-rw-r--r-- | .nix/derivation.nix | 2 | ||||
-rw-r--r-- | SConstruct | 66 | ||||
-rw-r--r-- | src/block.h | 10 | ||||
-rw-r--r-- | src/descriptor.h | 6 | ||||
-rw-r--r-- | src/lbm_unit.h | 31 |
5 files changed, 114 insertions, 1 deletions
diff --git a/.nix/derivation.nix b/.nix/derivation.nix index 6b1f4f7..f58709f 100644 --- a/.nix/derivation.nix +++ b/.nix/derivation.nix @@ -20,5 +20,5 @@ stdenvNoCC.mkDerivation { kel-unit ]; - outputs = [ "out" ]; + outputs = [ "out" "dev" ]; } diff --git a/SConstruct b/SConstruct new file mode 100644 index 0000000..ea16f95 --- /dev/null +++ b/SConstruct @@ -0,0 +1,66 @@ +#!/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('src/SConscript') + +env.Alias('cdb', env.cdb); +env.Alias('all', [env.targets]); +env.Default('all'); + +env.Alias('install', '$prefix') diff --git a/src/block.h b/src/block.h new file mode 100644 index 0000000..0d9de22 --- /dev/null +++ b/src/block.h @@ -0,0 +1,10 @@ +#pragma once + +#include "descriptor.h" + +namespace kel { +template<typename descriptor> +class block; + + +} diff --git a/src/descriptor.h b/src/descriptor.h new file mode 100644 index 0000000..4ef41e5 --- /dev/null +++ b/src/descriptor.h @@ -0,0 +1,6 @@ +#pragma once + +namespace kel { +template<uint16_t D, uint16_t Q, typename... T> +class descriptor {}; +} diff --git a/src/lbm_unit.h b/src/lbm_unit.h new file mode 100644 index 0000000..20c6e70 --- /dev/null +++ b/src/lbm_unit.h @@ -0,0 +1,31 @@ +#pragma once + +#include <kel/unit/unit.h> + +#include <string_view> + +namespace kel { +namespace lbm_type { +struct meter { + static constexpr std::string_view name = "meter_l"; + static constexpr std::string_view short_name = "m_l"; +}; + +struct second { + static constexpr std::string_view name = "second_l"; + static constexpr std::string_view short_name = "s_l"; +}; +} + +template<typename S> +using lbm_meter = unit<S, unit_component<lbm_type::meter, 1>>; + +template<typename S> +using lbm_second = unit<S, unit_component<lbm_type::second, 1>>; + +template<typename S> +using lbm_velocity = unit<S, unit_component<lbm_type::meter, 1>, unit_component<lbm_type::second, -1>>; + +template<typename S> +using lbm_acceleration = unit<S, unit_component<lbm_type::meter, 1>, unit_component<lbm_type::second, -2>>; +} |