diff --git a/Directory.Build.props b/Directory.Build.props index 9ab8826e..7f866d2e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -47,6 +47,10 @@ exe + + + netstandard2.0 + diff --git a/Directory.Packages.props b/Directory.Packages.props index 99867b31..0cc7d699 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,5 +1,6 @@ + diff --git a/src/AST/CppSharp.AST.csproj b/src/AST/CppSharp.AST.csproj index 67da3864..dc9bc85f 100644 --- a/src/AST/CppSharp.AST.csproj +++ b/src/AST/CppSharp.AST.csproj @@ -1,6 +1,5 @@  - netstandard2.1 AnyCPU true true diff --git a/src/CLI/Generator.cs b/src/CLI/Generator.cs index 6fc864a0..7531b58c 100644 --- a/src/CLI/Generator.cs +++ b/src/CLI/Generator.cs @@ -108,7 +108,7 @@ namespace CppSharp return true; } - public void Setup(Driver driver) + public override void Setup(Driver driver) { var parserOptions = driver.ParserOptions; parserOptions.TargetTriple = triple; @@ -168,21 +168,17 @@ namespace CppSharp parserOptions.AddDefines("_GLIBCXX_USE_CXX11_ABI=" + (options.Cpp11ABI ? "1" : "0")); } - public void SetupPasses(Driver driver) + public override void SetupPasses(Driver driver) { driver.Context.TranslationUnitPasses.AddPass(new FunctionToInstanceMethodPass()); driver.Context.TranslationUnitPasses.AddPass(new MarshalPrimitivePointersAsRefTypePass()); } - public void GenerateCode(Driver driver, List outputs) + public override void Preprocess(Driver driver, ASTContext ctx) { } - public void Preprocess(Driver driver, ASTContext ctx) - { - } - - public void Postprocess(Driver driver, ASTContext ctx) + public override void Postprocess(Driver driver, ASTContext ctx) { } diff --git a/src/Core/CppSharp.csproj b/src/Core/CppSharp.csproj index 7b852d0d..deac1cf8 100644 --- a/src/Core/CppSharp.csproj +++ b/src/Core/CppSharp.csproj @@ -1,6 +1,5 @@  - netstandard2.1 AnyCPU true true diff --git a/src/CppParser/Bindings/premake5.lua b/src/CppParser/Bindings/premake5.lua index d791f6c2..981b9156 100644 --- a/src/CppParser/Bindings/premake5.lua +++ b/src/CppParser/Bindings/premake5.lua @@ -1,7 +1 @@ -include ("CSharp") - -if EnabledCLIProjects() and not os.getenv("CI") then - -include ("CLI") - -end \ No newline at end of file +include ("CSharp") \ No newline at end of file diff --git a/src/CppParser/Bootstrap/Bootstrap.cs b/src/CppParser/Bootstrap/Bootstrap.cs index 797bd05b..0cf5c347 100644 --- a/src/CppParser/Bootstrap/Bootstrap.cs +++ b/src/CppParser/Bootstrap/Bootstrap.cs @@ -46,7 +46,7 @@ namespace CppSharp return Directory.EnumerateDirectories(llvmDir, $"*{llvmRevision}*").FirstOrDefault(); } - public void Setup(Driver driver) + public override void Setup(Driver driver) { driver.Options.GeneratorKind = GeneratorKind.CSharp; driver.Options.DryRun = true; @@ -83,11 +83,11 @@ namespace CppSharp module.LibraryDirs.Add(Path.Combine(llvmPath, "lib")); } - public void SetupPasses(Driver driver) + public override void SetupPasses(Driver driver) { } - public void Preprocess(Driver driver, ASTContext ctx) + public override void Preprocess(Driver driver, ASTContext ctx) { new IgnoreMethodsWithParametersPass { Context = driver.Context } .VisitASTContext(ctx); @@ -116,7 +116,7 @@ namespace CppSharp GenerateExpr(driver.Context); } - public void Postprocess(Driver driver, ASTContext ctx) + public override void Postprocess(Driver driver, ASTContext ctx) { } diff --git a/src/CppParser/ParserGen/ParserGen.cs b/src/CppParser/ParserGen/ParserGen.cs index f068a71e..e5a117cf 100644 --- a/src/CppParser/ParserGen/ParserGen.cs +++ b/src/CppParser/ParserGen/ParserGen.cs @@ -44,7 +44,7 @@ namespace CppSharp throw new Exception("Could not find build directory: " + dir); } - public void Setup(Driver driver) + public override void Setup(Driver driver) { var parserOptions = driver.ParserOptions; parserOptions.TargetTriple = Triple; @@ -118,11 +118,11 @@ namespace CppSharp options.AddArguments("-stdlib=libc++"); } - public void SetupPasses(Driver driver) + public override void SetupPasses(Driver driver) { } - public void Preprocess(Driver driver, ASTContext ctx) + public override void Preprocess(Driver driver, ASTContext ctx) { ctx.RenameNamespace("CppSharp::CppParser", "Parser"); @@ -146,7 +146,7 @@ namespace CppSharp } } - public void Postprocess(Driver driver, ASTContext ctx) + public override void Postprocess(Driver driver, ASTContext ctx) { } @@ -192,5 +192,9 @@ namespace CppSharp Console.WriteLine(); } } + + public void GenerateCode(Driver driver, List outputs) + { + } } } diff --git a/src/Generator.Tests/GeneratorTest.cs b/src/Generator.Tests/GeneratorTest.cs index a400bc97..dc0475a9 100644 --- a/src/Generator.Tests/GeneratorTest.cs +++ b/src/Generator.Tests/GeneratorTest.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Reflection; using CppSharp.AST; @@ -20,7 +21,7 @@ namespace CppSharp.Utils this.kind = kind; } - public virtual void Setup(Driver driver) + public override void Setup(Driver driver) { var options = driver.Options; options.GeneratorKind = kind; @@ -47,15 +48,15 @@ namespace CppSharp.Utils testModule.Headers.Add(Path.GetFileName(file)); } - public virtual void Preprocess(Driver driver, ASTContext ctx) + public override void Preprocess(Driver driver, ASTContext ctx) { } - public virtual void Postprocess(Driver driver, ASTContext ctx) + public override void Postprocess(Driver driver, ASTContext ctx) { } - public virtual void SetupPasses(Driver driver) + public override void SetupPasses(Driver driver) { } @@ -101,6 +102,10 @@ namespace CppSharp.Utils throw new Exception("Could not find tests output directory"); } + + public void GenerateCode(Driver driver, List outputs) + { + } #endregion } } diff --git a/src/Generator/CppSharp.Generator.csproj b/src/Generator/CppSharp.Generator.csproj index a96a8f78..85624814 100644 --- a/src/Generator/CppSharp.Generator.csproj +++ b/src/Generator/CppSharp.Generator.csproj @@ -12,4 +12,8 @@ + + + + \ No newline at end of file diff --git a/src/Generator/Generators/NAPI/NAPISources.cs b/src/Generator/Generators/NAPI/NAPISources.cs index 5ba39d33..56b30350 100644 --- a/src/Generator/Generators/NAPI/NAPISources.cs +++ b/src/Generator/Generators/NAPI/NAPISources.cs @@ -28,7 +28,7 @@ namespace CppSharp.Generators.Cpp { var paths = unit.FileRelativePath.Split('/').ToList(); paths = paths.Select(p => Path.GetFileNameWithoutExtension(p.ToLowerInvariant())).ToList(); - var name = string.Join('_', paths); + var name = string.Join("_", paths); return name; } diff --git a/src/Generator/Library.cs b/src/Generator/Library.cs index 84395aec..b20eb10f 100644 --- a/src/Generator/Library.cs +++ b/src/Generator/Library.cs @@ -1,12 +1,10 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Text.RegularExpressions; using CodingSeb.ExpressionEvaluator; using CppSharp.AST; using CppSharp.Generators; -using CppSharp.Generators.CSharp; using CppSharp.Passes; namespace CppSharp @@ -14,33 +12,33 @@ namespace CppSharp /// /// Used to massage the library types into something more .NET friendly. /// - public interface ILibrary + public abstract class ILibrary { /// /// Do transformations that should happen before passes are processed. /// - void Preprocess(Driver driver, ASTContext ctx); + public abstract void Preprocess(Driver driver, ASTContext ctx); /// /// Do transformations that should happen after passes are processed. /// - void Postprocess(Driver driver, ASTContext ctx); + public abstract void Postprocess(Driver driver, ASTContext ctx); /// /// Setup the driver options here. /// - void Setup(Driver driver); + public abstract void Setup(Driver driver); /// /// Setup your passes here. /// /// - void SetupPasses(Driver driver); + public abstract void SetupPasses(Driver driver); /// /// Generate custom code here. /// - void GenerateCode(Driver driver, List outputs) { } + public virtual void GenerateCode(Driver driver, List outputs) { } } public static class LibraryHelpers diff --git a/src/Parser/CppSharp.Parser.csproj b/src/Parser/CppSharp.Parser.csproj index d747fe8d..04933d25 100644 --- a/src/Parser/CppSharp.Parser.csproj +++ b/src/Parser/CppSharp.Parser.csproj @@ -18,8 +18,7 @@ - - +