Browse Source

Added passage of VS Version selected at config time to the build (#886)

Fixes #815
Fixes #814
pull/887/head
Mohit Mohta 8 years ago committed by Dimitar Dobrev
parent
commit
416c67215c
  1. 8
      build/premake5.lua
  2. 19
      src/Parser/ParserOptions.cs
  3. 2
      src/Parser/premake5.lua

8
build/premake5.lua

@ -9,6 +9,14 @@ dofile "LLVM.lua" @@ -9,6 +9,14 @@ dofile "LLVM.lua"
solution "CppSharp"
buildconfig = io.open("../BuildConfig.cs", "w+")
io.output(buildconfig)
io.write("namespace CppSharp.Parser", "\n{\n ")
io.write("public static class BuildConfig", "\n {\n ")
io.write("public const string Choice = \"" .. action .. "\";\n")
io.write(" }\n}")
io.close(buildconfig)
configurations { "Debug", "Release" }
platforms { target_architecture() }

19
src/Parser/ParserOptions.cs

@ -14,8 +14,25 @@ namespace CppSharp.Parser @@ -14,8 +14,25 @@ namespace CppSharp.Parser
public bool IsMicrosoftAbi { get { return Abi == CppAbi.Microsoft; } }
/// Sets up the parser options to work with the given Visual Studio toolchain.
public void SetupMSVC(VisualStudioVersion vsVersion = VisualStudioVersion.Latest)
public void SetupMSVC()
{
VisualStudioVersion vsVersion = VisualStudioVersion.Latest;
switch (BuildConfig.Choice)
{
case "vs2012":
vsVersion = VisualStudioVersion.VS2012;
break;
case "vs2013":
vsVersion = VisualStudioVersion.VS2013;
break;
case "vs2015":
vsVersion = VisualStudioVersion.VS2015;
break;
case "vs2017":
vsVersion = VisualStudioVersion.VS2017;
break;
}
MicrosoftMode = true;
NoBuiltinIncludes = true;
NoStandardIncludes = true;

2
src/Parser/premake5.lua

@ -6,7 +6,7 @@ project "CppSharp.Parser" @@ -6,7 +6,7 @@ project "CppSharp.Parser"
language "C#"
clr "Unsafe"
files { "**.cs" }
files { "**.cs", "../../BuildConfig.cs" }
vpaths { ["*"] = "*" }
links

Loading…
Cancel
Save