summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/png/.nix/derivation.nix38
-rw-r--r--lib/png/SConstruct75
-rw-r--r--lib/png/c++/SConscript27
-rw-r--r--lib/png/c++/png.cpp1
-rw-r--r--lib/png/c++/png.hpp7
5 files changed, 148 insertions, 0 deletions
diff --git a/lib/png/.nix/derivation.nix b/lib/png/.nix/derivation.nix
new file mode 100644
index 0000000..6e52083
--- /dev/null
+++ b/lib/png/.nix/derivation.nix
@@ -0,0 +1,38 @@
+{ lib
+, stdenv
+, scons
+, clang-tools
+, pname
+, version
+, forstio
+, kel-lbm
+, adaptive-cpp
+}:
+
+stdenv.mkDerivation {
+ pname = "${pname}-png";
+ inherit version;
+ src = ./..;
+
+ nativeBuildInputs = [
+ scons
+ clang-tools
+ ];
+
+ buildInputs = [
+ forstio.core
+ forstio.async
+ forstio.codec
+ kel-lbm.core
+ ];
+
+ doCheck = true;
+ checkPhase = ''
+ scons test
+ ./bin/tests
+ '';
+
+ preferLocalBuild = true;
+
+ outputs = [ "out" "dev" ];
+}
diff --git a/lib/png/SConstruct b/lib/png/SConstruct
new file mode 100644
index 0000000..8b3ab01
--- /dev/null
+++ b/lib/png/SConstruct
@@ -0,0 +1,75 @@
+#!/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/lib/png/c++/SConscript b/lib/png/c++/SConscript
new file mode 100644
index 0000000..75b8645
--- /dev/null
+++ b/lib/png/c++/SConscript
@@ -0,0 +1,27 @@
+#!/bin/false
+
+import os
+import os.path
+import glob
+
+
+Import('env')
+
+dir_path = Dir('.').abspath
+
+# Environment for base library
+png_env = env.Clone();
+
+png_env.sources = sorted(glob.glob(dir_path + "/*.cpp"));
+png_env.headers = sorted(glob.glob(dir_path + "/*.hpp"));
+
+env.sources += png_env.sources;
+env.headers += png_env.headers;
+
+## Static lib
+objects = []
+png_env.add_source_files(objects, png_env.sources, shared=False);
+env.library_static = png_env.StaticLibrary('#build/kel-lbm-png', [objects]);
+
+env.Install('$prefix/lib/', env.library_static);
+env.Install('$prefix/include/kel/lbm/png/', png_env.headers);
diff --git a/lib/png/c++/png.cpp b/lib/png/c++/png.cpp
new file mode 100644
index 0000000..248a8a5
--- /dev/null
+++ b/lib/png/c++/png.cpp
@@ -0,0 +1 @@
+#include "png.hpp"
diff --git a/lib/png/c++/png.hpp b/lib/png/c++/png.hpp
new file mode 100644
index 0000000..f675a99
--- /dev/null
+++ b/lib/png/c++/png.hpp
@@ -0,0 +1,7 @@
+#pragma once
+
+namespace kel {
+namespace lbm {
+
+}
+}