aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2024-05-15 21:36:02 +0200
committer GitHub <noreply@github.com>2024-05-15 21:36:02 +0200
commit7b521d6023113372cf6b02e562828273c4040f0e (patch)
tree7bd53754f6294a11f81774593aa15cf43b3dc26e
parenta5a6ff376cf0ff8fa48fcd750c16395b099223a4 (diff)
parent9802f0b500fd753b49b1785edbe204d46aac4b3d (diff)
Merge pull request #45 from OpenVicProject/fix/includes
Expose dataloader includes
-rw-r--r--SConstruct4
-rw-r--r--deps/SCsub77
-rw-r--r--include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp14
-rw-r--r--include/openvic-dataloader/v2script/Parser.hpp1
-rw-r--r--src/openvic-dataloader/v2script/AbstractSyntaxTree.cpp1
-rw-r--r--src/openvic-dataloader/v2script/EventGrammar.hpp1
-rw-r--r--src/openvic-dataloader/v2script/LuaDefinesGrammar.hpp5
-rw-r--r--src/openvic-dataloader/v2script/ModifierGrammar.hpp1
-rw-r--r--src/openvic-dataloader/v2script/ParseState.hpp23
-rw-r--r--src/openvic-dataloader/v2script/Parser.cpp1
-rw-r--r--src/openvic-dataloader/v2script/SimpleGrammar.hpp1
11 files changed, 86 insertions, 43 deletions
diff --git a/SConstruct b/SConstruct
index 8040a48..23b2d9d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -19,6 +19,8 @@ opts.Add(BoolVariable("build_ovdl_headless", "Build the openvic dataloader headl
env.FinalizeOptions()
+env.exposed_includes = []
+
SConscript("deps/SCsub", "env")
env.openvic_dataloader = {}
@@ -63,7 +65,7 @@ if env["build_ovdl_library"]:
env.openvic_dataloader["LIBPATH"] = env["LIBPATH"]
env.openvic_dataloader["LIBS"] = env["LIBS"]
- env.openvic_dataloader["INCPATH"] = [env.Dir(include_path)]
+ env.openvic_dataloader["INCPATH"] = [env.Dir(include_path)] + env.exposed_includes
headless_program = None
env["PROGSUFFIX"] = suffix + env["PROGSUFFIX"]
diff --git a/deps/SCsub b/deps/SCsub
index 1f04205..5f714df 100644
--- a/deps/SCsub
+++ b/deps/SCsub
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+import os
Import("env")
@@ -24,33 +25,39 @@ def build_lexy(env):
"-Wno-parentheses", "-Wno-unused-local-typedefs", "-Wno-array-bounds" #, "-Wno-maybe-uninitialized", "-Wno-restrict"
])
- paths = ["lexy/include", "lexy/src"]
- lexy_env.Append(CPPPATH=[[lexy_env.Dir(p) for p in paths]])
- sources = env.GlobRecursive("*.cpp", paths)
+ include_path = "lexy/include"
+ source_path = "lexy/src"
+ lexy_env.Append(CPPPATH=[[lexy_env.Dir(p) for p in [source_path, include_path]]])
+ sources = env.GlobRecursive("*.cpp", [source_path])
env.lexy_sources = sources
+
library_name = "liblexy_file" + env["LIBSUFFIX"]
- library = lexy_env.StaticLibrary(target="lexy/src/" + library_name, source=sources)
+ library = lexy_env.StaticLibrary(target=os.path.join(source_path, library_name), source=sources)
Default(library)
- env.Append(CPPPATH=[lexy_env.Dir("lexy/include")])
+ include_dir = lexy_env.Dir(include_path)
+ source_dir = lexy_env.Dir(source_path)
+ env.Append(CPPPATH=[include_dir])
if env.get("is_msvc", False):
- env.Append(CXXFLAGS=["/external:I", lexy_env.Dir("lexy/include"), "/external:W0"])
+ env.Append(CXXFLAGS=["/external:I", include_dir, "/external:W0"])
else:
- env.Append(CXXFLAGS=["-isystem", lexy_env.Dir("lexy/include")])
+ env.Append(CXXFLAGS=["-isystem", include_dir])
env.Append(CXXFLAGS=[""])
- env.Append(LIBPATH=[lexy_env.Dir("lexy/src")])
+ env.Append(LIBPATH=[source_dir])
env.Prepend(LIBS=[library_name])
def build_dryad(env):
- paths = ["dryad/include"]
- sources = env.GlobRecursive("*.cpp", paths)
- env.dryad_sources = sources
-
- env.Append(CPPPATH=[env.Dir("dryad/include")])
+ include_path = "dryad/include"
+ include_dir = env.Dir(include_path)
+ env.dryad = {}
+ env.dryad["INCPATH"] = [include_dir]
+ env.Append(CPPPATH=env.dryad["INCPATH"])
if env.get("is_msvc", False):
- env.Append(CXXFLAGS=["/external:I", env.Dir("dryad/include"), "/external:W0"])
+ env.Append(CXXFLAGS=["/external:I", include_dir, "/external:W0"])
else:
- env.Append(CXXFLAGS=["-isystem", env.Dir("dryad/include")])
+ env.Append(CXXFLAGS=["-isystem", include_dir])
+
+ env.exposed_includes += env.dryad["INCPATH"]
def build_fmt(env):
fmt_env = env.Clone()
@@ -85,33 +92,51 @@ def build_fmt(env):
"-Wshift-overflow=2", "-Wnull-dereference", "-Wduplicated-cond"
])
- paths = ["fmt/include", "fmt/src"]
+ include_path = "fmt/include"
+ source_path = "fmt/src"
+ paths = [include_path, source_path]
fmt_env.Append(CPPPATH=[[fmt_env.Dir(p) for p in paths]])
sources = env.GlobRecursive("*.cc", paths, "fmt.cc")
env.lexy_sources = sources
+
library_name = "libfmt" + env["LIBSUFFIX"]
- library = fmt_env.StaticLibrary(target="fmt/src/" + library_name, source=sources)
+ library = fmt_env.StaticLibrary(target=os.path.join(source_path, library_name), source=sources)
Default(library)
- env.Append(CPPPATH=[fmt_env.Dir("fmt/include")])
+ include_dir = fmt_env.Dir(include_path)
+ source_dir = fmt_env.Dir(source_path)
+
+ env.fmt = {}
+ env.fmt["INCPATH"] = [include_dir]
+
+ env.Append(CPPPATH=env.fmt["INCPATH"])
if env.get("is_msvc", False):
- env.Append(CXXFLAGS=["/external:I", fmt_env.Dir("fmt/include"), "/external:W0"])
+ env.Append(CXXFLAGS=["/external:I", include_dir, "/external:W0"])
else:
- env.Append(CXXFLAGS=["-isystem", fmt_env.Dir("fmt/include")])
+ env.Append(CXXFLAGS=["-isystem", include_dir])
env.Append(CXXFLAGS=[""])
- env.Append(LIBPATH=[fmt_env.Dir("fmt/src")])
+ env.Append(LIBPATH=[fmt_env.Dir(source_path)])
env.Prepend(LIBS=[library_name])
+
+ env.exposed_includes += env.fmt["INCPATH"]
def build_range_v3(env):
- paths = ["range-v3/include"]
- sources = env.GlobRecursive("*.cpp", paths)
+ include_path = "range-v3/include"
+ sources = env.GlobRecursive("*.cpp", [include_path])
env.range_v3_sources = sources
- env.Append(CPPPATH=[env.Dir("range-v3/include")])
+ include_dir = env.Dir(include_path)
+
+ env.range_v3 = {}
+ env.range_v3["INCPATH"] = [include_dir]
+
+ env.Append(CPPPATH=env.range_v3["INCPATH"])
if env.get("is_msvc", False):
- env.Append(CXXFLAGS=["/external:I", env.Dir("range-v3/include"), "/external:W0"])
+ env.Append(CXXFLAGS=["/external:I", include_dir, "/external:W0"])
else:
- env.Append(CXXFLAGS=["-isystem", env.Dir("range-v3/include")])
+ env.Append(CXXFLAGS=["-isystem", include_dir])
+
+ env.exposed_includes += env.range_v3["INCPATH"]
build_dryad(env)
build_fmt(env)
diff --git a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp
index 1e7b2c3..27dbfcb 100644
--- a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp
+++ b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp
@@ -6,7 +6,6 @@
#include <openvic-dataloader/AbstractSyntaxTree.hpp>
#include <openvic-dataloader/File.hpp>
#include <openvic-dataloader/NodeLocation.hpp>
-#include <openvic-dataloader/ParseState.hpp>
#include <openvic-dataloader/detail/LexyFwdDeclaration.hpp>
#include <dryad/_detail/assert.hpp>
@@ -184,17 +183,4 @@ namespace ovdl::v2script::ast {
private:
Node* _last_node;
};
-
- using File = ovdl::BasicFile<lexy::default_encoding, Node>;
- struct AbstractSyntaxTree : ovdl::BasicAbstractSyntaxTree<File, FileTree> {
- using BasicAbstractSyntaxTree::BasicAbstractSyntaxTree;
-
- std::string make_list_visualizer() const;
- std::string make_native_visualizer() const;
- };
- using ParseState = ovdl::ParseState<AbstractSyntaxTree>;
-
- static_assert(IsFile<ast::File>, "File failed IsFile concept");
- static_assert(IsAst<ast::AbstractSyntaxTree>, "AbstractSyntaxTree failed IsAst concept");
- static_assert(IsParseState<ast::ParseState>, "ParseState failed IsParseState concept");
} \ No newline at end of file
diff --git a/include/openvic-dataloader/v2script/Parser.hpp b/include/openvic-dataloader/v2script/Parser.hpp
index ea42aa2..f9f0ce8 100644
--- a/include/openvic-dataloader/v2script/Parser.hpp
+++ b/include/openvic-dataloader/v2script/Parser.hpp
@@ -11,6 +11,7 @@
#include <openvic-dataloader/NodeLocation.hpp>
#include <openvic-dataloader/Parser.hpp>
#include <openvic-dataloader/detail/utility/Concepts.hpp>
+#include <openvic-dataloader/detail/utility/ErrorRange.hpp>
#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
#include <dryad/node.hpp>
diff --git a/src/openvic-dataloader/v2script/AbstractSyntaxTree.cpp b/src/openvic-dataloader/v2script/AbstractSyntaxTree.cpp
index 4754d8e..abade40 100644
--- a/src/openvic-dataloader/v2script/AbstractSyntaxTree.cpp
+++ b/src/openvic-dataloader/v2script/AbstractSyntaxTree.cpp
@@ -8,6 +8,7 @@
#include <dryad/node.hpp>
#include <dryad/tree.hpp>
+#include "ParseState.hpp"
#include <range/v3/view/drop.hpp>
using namespace ovdl::v2script::ast;
diff --git a/src/openvic-dataloader/v2script/EventGrammar.hpp b/src/openvic-dataloader/v2script/EventGrammar.hpp
index c81a173..27f6459 100644
--- a/src/openvic-dataloader/v2script/EventGrammar.hpp
+++ b/src/openvic-dataloader/v2script/EventGrammar.hpp
@@ -11,6 +11,7 @@
#include "openvic-dataloader/NodeLocation.hpp"
+#include "ParseState.hpp"
#include "SimpleGrammar.hpp"
#include "detail/dsl.hpp"
#include "v2script/AiBehaviorGrammar.hpp"
diff --git a/src/openvic-dataloader/v2script/LuaDefinesGrammar.hpp b/src/openvic-dataloader/v2script/LuaDefinesGrammar.hpp
index 4d27d3e..96cce99 100644
--- a/src/openvic-dataloader/v2script/LuaDefinesGrammar.hpp
+++ b/src/openvic-dataloader/v2script/LuaDefinesGrammar.hpp
@@ -1,10 +1,11 @@
#pragma once
+#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
+
#include <lexy/_detail/config.hpp>
#include <lexy/dsl.hpp>
-#include "openvic-dataloader/v2script/AbstractSyntaxTree.hpp"
-
+#include "ParseState.hpp"
#include "SimpleGrammar.hpp"
#include "detail/dsl.hpp"
diff --git a/src/openvic-dataloader/v2script/ModifierGrammar.hpp b/src/openvic-dataloader/v2script/ModifierGrammar.hpp
index d6dbb32..22592d4 100644
--- a/src/openvic-dataloader/v2script/ModifierGrammar.hpp
+++ b/src/openvic-dataloader/v2script/ModifierGrammar.hpp
@@ -10,6 +10,7 @@
#include "openvic-dataloader/NodeLocation.hpp"
+#include "ParseState.hpp"
#include "SimpleGrammar.hpp"
#include "TriggerGrammar.hpp"
#include "detail/dsl.hpp"
diff --git a/src/openvic-dataloader/v2script/ParseState.hpp b/src/openvic-dataloader/v2script/ParseState.hpp
new file mode 100644
index 0000000..8e29bf5
--- /dev/null
+++ b/src/openvic-dataloader/v2script/ParseState.hpp
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <openvic-dataloader/File.hpp>
+#include <openvic-dataloader/ParseState.hpp>
+#include <openvic-dataloader/v2script/AbstractSyntaxTree.hpp>
+
+#include <lexy/encoding.hpp>
+
+namespace ovdl::v2script::ast {
+ using File = ovdl::BasicFile<lexy::default_encoding, Node>;
+ struct AbstractSyntaxTree : ovdl::BasicAbstractSyntaxTree<File, FileTree> {
+ using BasicAbstractSyntaxTree::BasicAbstractSyntaxTree;
+
+ std::string make_list_visualizer() const;
+ std::string make_native_visualizer() const;
+ };
+
+ using ParseState = ovdl::ParseState<AbstractSyntaxTree>;
+
+ static_assert(IsFile<ast::File>, "File failed IsFile concept");
+ static_assert(IsAst<ast::AbstractSyntaxTree>, "AbstractSyntaxTree failed IsAst concept");
+ static_assert(IsParseState<ast::ParseState>, "ParseState failed IsParseState concept");
+} \ No newline at end of file
diff --git a/src/openvic-dataloader/v2script/Parser.cpp b/src/openvic-dataloader/v2script/Parser.cpp
index a4cad9d..eb491d5 100644
--- a/src/openvic-dataloader/v2script/Parser.cpp
+++ b/src/openvic-dataloader/v2script/Parser.cpp
@@ -31,6 +31,7 @@
#include "openvic-dataloader/Error.hpp"
+#include "ParseState.hpp"
#include "detail/DetectUtf8.hpp"
#include "detail/NullBuff.hpp"
#include "detail/ParseHandler.hpp"
diff --git a/src/openvic-dataloader/v2script/SimpleGrammar.hpp b/src/openvic-dataloader/v2script/SimpleGrammar.hpp
index 731a7f1..37e295f 100644
--- a/src/openvic-dataloader/v2script/SimpleGrammar.hpp
+++ b/src/openvic-dataloader/v2script/SimpleGrammar.hpp
@@ -8,6 +8,7 @@
#include <lexy/dsl/identifier.hpp>
#include <lexy/dsl/symbol.hpp>
+#include "ParseState.hpp"
#include "detail/dsl.hpp"
// Grammar Definitions //