Rewrite build config file generation in Premake.

The previous version used io.output which is not needed and also badly interacts with Premake internals.
This commit is contained in:
Joao Matos 2017-08-01 22:02:41 +01:00
Родитель e6077448a0
Коммит 661609176a
2 изменённых файлов: 16 добавлений и 9 удалений

Просмотреть файл

@ -9,14 +9,6 @@ dofile "LLVM.lua"
solution "CppSharp" 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" } configurations { "Debug", "Release" }
platforms { target_architecture() } platforms { target_architecture() }

Просмотреть файл

@ -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" project "CppSharp.Parser"
SetupManagedProject() SetupManagedProject()
@ -6,7 +21,7 @@ project "CppSharp.Parser"
language "C#" language "C#"
clr "Unsafe" clr "Unsafe"
files { "**.cs", "../../BuildConfig.cs" } files { "**.cs", buildconfig }
vpaths { ["*"] = "*" } vpaths { ["*"] = "*" }
links links