diff options
-rw-r--r-- | default.nix | 30 | ||||
-rw-r--r-- | modules/crypto/.nix/derivation.nix | 34 | ||||
-rw-r--r-- | modules/crypto/SConstruct | 67 | ||||
-rw-r--r-- | modules/crypto/c++/SConscript | 38 | ||||
-rw-r--r-- | modules/crypto/tests/SConscript | 31 | ||||
-rw-r--r-- | modules/remote/c++/transfer_multi.hpp | 6 | ||||
-rw-r--r-- | modules/tools/c++/c_gen_iface.hpp | 13 |
7 files changed, 206 insertions, 13 deletions
diff --git a/default.nix b/default.nix index 20b00fc..7fb599d 100644 --- a/default.nix +++ b/default.nix @@ -24,6 +24,13 @@ in rec { inherit stdenv; inherit clang-tools; }; + + crypto = pkgs.callPackage modules/crypto/.nix/derivation.nix { + inherit version; + inherit forstio; + inherit stdenv; + inherit clang-tools; + }; codec = pkgs.callPackage modules/codec/.nix/derivation.nix { inherit version; @@ -114,26 +121,27 @@ in rec { }; }; - stable = pkgs.symlinkJoin { - name = "forstio-${version}"; - paths = [ - forstio.core - forstio.async - forstio.codec - forstio.codec-json - forstio.codec-netcdf - forstio.io - forstio.io-tls + stable = pkgs.symlinkJoin { + name = "forstio-${version}"; + paths = [ + forstio.core + forstio.async + forstio.codec + forstio.codec-json + forstio.codec-netcdf + forstio.io + forstio.io-tls + forstio.remote ]; }; unstable = pkgs.symlinkJoin { name = "forstio-unstable-${version}"; paths = [ - forstio.remote forstio.remote-sycl forstio.io_codec forstio.thread + forstio.crypto # forstio.codec-minecraft ]; }; diff --git a/modules/crypto/.nix/derivation.nix b/modules/crypto/.nix/derivation.nix new file mode 100644 index 0000000..dd7d36b --- /dev/null +++ b/modules/crypto/.nix/derivation.nix @@ -0,0 +1,34 @@ +{ lib +, stdenv +, scons +, clang-tools +, version +, forstio +}: + +let + +in stdenv.mkDerivation { + pname = "forstio-crypto"; + inherit version; + src = ./..; + + enableParallelBuilding = true; + + nativeBuildInputs = [ + scons + clang-tools + ]; + + buildInputs = [ + forstio.core + ]; + + doCheck = true; + checkPhase = '' + scons test + ./bin/tests + ''; + + outputs = ["out" "dev"]; +} diff --git a/modules/crypto/SConstruct b/modules/crypto/SConstruct new file mode 100644 index 0000000..f71db5a --- /dev/null +++ b/modules/crypto/SConstruct @@ -0,0 +1,67 @@ +#!/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/modules/crypto/c++/SConscript b/modules/crypto/c++/SConscript new file mode 100644 index 0000000..6c5dc44 --- /dev/null +++ b/modules/crypto/c++/SConscript @@ -0,0 +1,38 @@ +#!/bin/false + +import os +import os.path +import glob + + +Import('env') + +dir_path = Dir('.').abspath + +# Environment for base library +crypto_env = env.Clone(); + +crypto_env.sources = sorted(glob.glob(dir_path + "/*.cpp")) +crypto_env.headers = sorted(glob.glob(dir_path + "/*.hpp")) + +env.sources += crypto_env.sources; +env.headers += crypto_env.headers; + +## Shared lib +objects_shared = [] +crypto_env.add_source_files(objects_shared, crypto_env.sources, shared=True); +env.library_shared = crypto_env.SharedLibrary('#build/forstio-crypto', [objects_shared]); + +## Static lib +objects_static = [] +crypto_env.add_source_files(objects_static, crypto_env.sources, shared=False); +env.library_static = crypto_env.StaticLibrary('#build/forstio-crypto', [objects_static]); + +# Set Alias +env.Alias('library_crypto', [env.library_shared, env.library_static]); + +env.targets += ['library_crypto']; + +# Install +env.Install('$prefix/lib/', [env.library_shared, env.library_static]); +env.Install('$prefix/include/forstio/crypto/', [crypto_env.headers]); diff --git a/modules/crypto/tests/SConscript b/modules/crypto/tests/SConscript new file mode 100644 index 0000000..f8ffc92 --- /dev/null +++ b/modules/crypto/tests/SConscript @@ -0,0 +1,31 @@ +#!/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']; diff --git a/modules/remote/c++/transfer_multi.hpp b/modules/remote/c++/transfer_multi.hpp index f7d7a62..e3b5117 100644 --- a/modules/remote/c++/transfer_multi.hpp +++ b/modules/remote/c++/transfer_multi.hpp @@ -7,8 +7,10 @@ namespace saw { template<typename Schema, typename Encoding, typename... Backends> class multi_data_client { private: - data_client<Schema, Encoding, rmt::Loopback> loopback; + data_client<Schema, Encoding, rmt::Loopback> loopback_; - std::tuple<> foo; + std::tuple<std::vector<data_client<Schema,Encoding,Backends>>...> backends_; +public: + multi_data_client(remote_address<rmt::Loopback>& loop, std::tuple<std::vector<remote_address<Backends>>...> addrs); }; } diff --git a/modules/tools/c++/c_gen_iface.hpp b/modules/tools/c++/c_gen_iface.hpp index 8016c6a..63cd3a7 100644 --- a/modules/tools/c++/c_gen_iface.hpp +++ b/modules/tools/c++/c_gen_iface.hpp @@ -489,6 +489,17 @@ struct lang_bind<schema::Struct<schema::Member<V,K>...>, binding::SyncC> { template<uint64_t i> static error_or<void> generate_translation_func(std::string& buff, const std::string_view& prefix, bool c_to_cpp){ + auto& tpe = state.tp_elements; + uint64_t id; + { + std::string hash_type_str = cfg.prefix + "_" + std::to_string(hash) + "_t"; + } + { + auto eov = lang_bind_helper::append_string(tpe.at(id).source, "\treturn void_t{};\n}\n"); + if(eov.is_error()){ + return eov; + } + } return void_t{}; } @@ -538,6 +549,8 @@ struct lang_bind<schema::Struct<schema::Member<V,K>...>, binding::SyncC> { /** * Generate translation element */ + { + } /** * Ensure generation of dependent types */ |