diff --git a/build/premake5.lua b/build/premake5.lua index 0780d4ff..d7db43b9 100644 --- a/build/premake5.lua +++ b/build/premake5.lua @@ -9,14 +9,6 @@ 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() } diff --git a/src/Parser/premake5.lua b/src/Parser/premake5.lua index 2a32f244..d8962048 100644 --- a/src/Parser/premake5.lua +++ b/src/Parser/premake5.lua @@ -1,3 +1,18 @@ +local buildconfig = path.join(builddir, "BuildConfig.cs") + +local function GenerateBuildConfig() + print("Generating CppSharp build configuration file 'BuildConfig.cs'") + + local file = io.open(buildconfig, "w+") + file:write("namespace CppSharp.Parser", "\n{\n ") + file:write("public static class BuildConfig", "\n {\n ") + file:write("public const string Choice = \"" .. _ACTION .. "\";\n") + file:write(" }\n}") + file:close() +end + +GenerateBuildConfig() + project "CppSharp.Parser" SetupManagedProject() @@ -6,7 +21,7 @@ project "CppSharp.Parser" language "C#" clr "Unsafe" - files { "**.cs", "../../BuildConfig.cs" } + files { "**.cs", buildconfig } vpaths { ["*"] = "*" } links