From 3b5d385e4dd8cc21a89d16275f6cce03712c87c3 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Sun, 18 Aug 2024 18:52:22 +0200 Subject: Broken json parser --- json/SConstruct | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 json/SConstruct (limited to 'json/SConstruct') diff --git a/json/SConstruct b/json/SConstruct new file mode 100644 index 0000000..3ce306b --- /dev/null +++ b/json/SConstruct @@ -0,0 +1,82 @@ +#!/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, value, env): + assert os.path.isabs(value), "%r must have absolute path syntax" % (key,) + +env_vars = Variables( + args=ARGUMENTS +) + +env_vars.Add('platform', + help='Specifies which platform to target', + default='unix' +) + +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=[], + CXXFLAGS=['-std=c++20','-g','-Wall','-Wextra'], + LIBS=[ + 'forstio-core', + 'forstio-codec' + ] +) +env.__class__.add_source_files = add_kel_source_files +env.Tool('compilation_db'); +env.cdb = env.CompilationDatabase('compile_commands.json'); + +if env['platform'] == 'unix': + env.Append(CPPDEFINES = ['SAW_UNIX']) +#endif + +env.objects = []; +env.sources = []; +env.headers = []; +env.targets = []; + +Export('env') +SConscript('SConscript') + +# Aliasing +env.Alias('cdb', env.cdb); +env.Alias('all', [env.targets]); +env.Default('all'); + +env.Alias('install', '$prefix') -- cgit v1.2.3