diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-07-28 06:52:00 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-09-02 14:28:21 +0200 |
commit | 7440a5d1433eec4bf87e3723022db187e7f61b1a (patch) | |
tree | 2bb062c320fa2227b18956617b94d0e8800420d8 /SConstruct | |
parent | e941573f47fb867ff75c8a2cf78302b754ffbeee (diff) |
Rework Grammar and Parser
Add proper headless binary construction:
Includes basic validation
Add Error and Warning structs to Parser
Add FileNode pointer getter to Parser
Change all `char8_t*` and `const char8_t` to `const char*` in Parser
Add Parser move operators and Parser deconstructor
Add BufferHandler PIMPL object to Parser
Add UTF-8 file Warning to v2script
Add proper Grammar value retrieval
Add AbstractSyntaxTree for v2script data parser:
Has compile-time embedded type information accessible at compile-time and runtime
Has Tab-based print functionality
Fix wrong environment reference for headless construction in SConstruct
Add error retrieval
Add BasicCallbackOStreamBuffer for callback streaming
Add CallbackStreamBuffer for char
Add CallbackWStreamBuffer for wchar_t
Add BasicCallbackStream
Add CallbackStream for char
Add CallbackWStream for wchar_t
Add grammar for events and decisions
Add event_parse to Parser
Add decision_parse to Parser
Add .clang-format
Ignore dirty lexy module
Add CSV parser and grammar:
Creates std::vector<csv::LineObject> for a list of lines
Add BasicParser and BasicBufferHandler to reduce code reduplication
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -4,9 +4,6 @@ import os import platform import sys -import subprocess -from glob import glob -from pathlib import Path import SCons @@ -30,6 +27,9 @@ else: is_standalone = SCons.Script.sconscript_reading == 1 +TOOLPATH = ["tools"] +BINDIR = "bin" + try: Import("env") old_env = env @@ -96,7 +96,7 @@ opts.Add( # Add platform options tools = {} for pl in set(platforms) - set(unsupported_known_platforms): - tool = Tool(pl, toolpath=["tools"]) + tool = Tool(pl, toolpath=TOOLPATH) if hasattr(tool, "options"): tool.options(opts) tools[pl] = tool @@ -135,7 +135,7 @@ opts.Add(BoolVariable("intermediate_delete", "Enables automatically deleting una opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True)) # Targets flags tool (optimizations, debug symbols) -target_tool = Tool("targets", toolpath=["tools"]) +target_tool = Tool("targets", toolpath=TOOLPATH) target_tool.options(opts) # Custom options and profile flags. @@ -171,7 +171,7 @@ if env["arch"] == "": print("Unsupported CPU architecture: " + host_machine) Exit() -tool = Tool(env["platform"], toolpath=["tools"]) +tool = Tool(env["platform"], toolpath=TOOLPATH) if tool is None or not tool.exists(env): raise ValueError("Required toolchain not found for platform " + env["platform"]) @@ -224,9 +224,10 @@ env.openvic_dataloader = {} # - LINKFLAGS are for linking flags # tweak this if you want to use different folders, or more folders, to store your source code in. -paths = ["include", "src/openvic-dataloader"] -env.Append(CPPPATH=[[env.Dir(p) for p in paths]]) -sources = GlobRecursive("*.cpp", paths) +source_path = "src/openvic-dataloader" +include_path = "include" +env.Append(CPPPATH=[[env.Dir(p) for p in [source_path, include_path]]]) +sources = GlobRecursive("*.cpp", [source_path]) env.dataloader_sources = sources suffix = ".{}.{}".format(env["platform"], env["target"]) @@ -244,15 +245,15 @@ env["OBJSUFFIX"] = suffix + env["OBJSUFFIX"] library_name = "libopenvic-dataloader{}{}".format(suffix, env["LIBSUFFIX"]) if env["build_ovdl_library"]: - library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources) + library = env.StaticLibrary(target=env.File(os.path.join(BINDIR, library_name)), source=sources) Default(library) - env.openvic_dataloader["LIBPATH"] = [env.Dir("bin")] - env.openvic_dataloader["LIBS"] = [library_name] - env.openvic_dataloader["INCPATH"] = [env.Dir("include")] + env.Append(LIBPATH=[env.Dir(BINDIR)]) + env.Append(LIBS=[library_name]) - env.Append(LIBPATH=env.openvic_dataloader["LIBPATH"]) - env.Append(LIBS=env.openvic_dataloader["LIBS"]) + env.openvic_dataloader["LIBPATH"] = env["LIBPATH"] + env.openvic_dataloader["LIBS"] = env["LIBS"] + env.openvic_dataloader["INCPATH"] = [env.Dir(include_path)] headless_program = None env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"] @@ -266,8 +267,8 @@ if env["build_ovdl_headless"]: headless_env.headless_sources = GlobRecursive("*.cpp", headless_path) if not env["build_ovdl_library"]: headless_env.headless_sources += sources - headless_program = env.Program( - target="bin/%s" % headless_name, + headless_program = headless_env.Program( + target=os.path.join(BINDIR, headless_name), source=headless_env.headless_sources, PROGSUFFIX=".headless" + env["PROGSUFFIX"] ) |