Hi !
My original idea was to create .sln / .vcxproj == to ==> .lua script generator.
I have already done it, and now even improved - added more keywords like optimize, and so on for producing more professional .lua script.
But now also I can construct a runnable C# script, which has it's own implementation for some of premake functions (project, location, uuid, language, dependson, filter, kind and so on).
I was really surprised to see that interpreted .lua script is way faster than compiling C# script - when .lua it takes 5-10 seconds to generate ~ 300 projects, while C# compilation (without execution)
takes more than 30 seconds. I've now solved this by keeping .dll compilation next to original .cs scripts, but from my perspective this is whole .net platform problem.
I think I will reconsider whether I'll use C# as programming language in future - at least for my own free time projects.
Meanwhile....
My generated .lua script looks somehow like this:
project "test_winvlc"
location "."
configurations { "Debug","Release" }
platforms { "Win32" }
uuid "29BF0A47-AAC8-4297-9F18-710FDCB04108"
kind "WindowedApp"
toolset "v120"
characterset "Unicode"
targetdir "$(SolutionDir)$(Configuration)\\"
objdir "$(Configuration)\\!"
targetname "$(ProjectName)"
targetextension ".exe"
pchheader "stdafx.h"
filter { "Debug", "platforms:Win32" }
symbols "on"
optimize "off"
includedirs { "../util" }
libdirs { "../debug" }
filter { "Release", "platforms:Win32" }
symbols "off"
optimize "speed"
flags { "LinkTimeOptimization" }
defines { "NDEBUG" }
filter { }
files {
"ReadMe.txt",
"c:/Program Files/Windows Kits/8.1/Include/shared/windef.h",
"Resource.h",
"stdafx.h",
"targetver.h",
"winvlc.h",
"../bin/winvlc.c",
"stdafx.cpp",
"winvlc.rc",
"small.ico",
"winvlc.ico"
}
filter { "Debug", "platforms:Win32", "files:../bin/winvlc.c" }
flags { "NoPch" }
includedirs { "../util" }
filter { "Release", "platforms:Win32", "files:../bin/winvlc.c" }
pchheader "stdafx.h"
filter { }
pchsource "stdafx.cpp"
Meanwhile .cs script looks somehow similary to premake5 lua:
//css_ref syncproj.exe
using System; //Exception
partial class Builder: SolutionProjectBuilder
{
static void Main(String[] args)
{
try {
project("test_winvlc");
configurations( "Debug","Release" );
platforms( "Win32" );
uuid("29BF0A47-AAC8-4297-9F18-710FDCB04108");
kind("WindowedApp");
toolset("v120");
characterset("Unicode");
targetdir("$(SolutionDir)$(Configuration)\\");
objdir("$(Configuration)\\");
targetname("$(ProjectName)");
targetextension(".exe");
pchheader("stdafx.h");
defines( "WIN32", "_WINDOWS" );
filter ( "Debug", "platforms:Win32" );
symbols("on");
optimize("off");
defines( "_DEBUG" );
includedirs( "..", "../include", "../util" );
links( "kernel32.lib", "user32.lib", "gdi32.lib", "winspool.lib", "comdlg32.lib", "advapi32.lib", "shell32.lib", "ole32.lib" );
links( "oleaut32.lib", "uuid.lib", "odbc32.lib", "odbccp32.lib", "libvlc.lib", "libvlccore.lib", "Wininet.lib", "Psapi.lib" );
links( "libcompat.lib", "libgcc.lib", "libxml2.lib", "libmingwex.lib", "libmingw32.lib" );
libdirs( "../win32/lib", "../win32/cygwin", "../win32/cygwin/mingw", "../debug" );
filter ( "Release", "platforms:Win32" );
symbols("off");
optimize("speed");
flags( "LinkTimeOptimization" );
defines( "NDEBUG" );
filter ( );
files(
"ReadMe.txt",
"c:/Program Files/Windows Kits/8.1/Include/shared/windef.h",
"Resource.h",
"stdafx.h",
"targetver.h",
"winvlc.h",
"../bin/winvlc.c",
"stdafx.cpp",
"winvlc.rc",
"small.ico",
"winvlc.ico"
);
filter ( "Debug", "platforms:Win32", "files:../bin/winvlc.c" );
flags( "NoPch" );
defines( "WIN32", "_DEBUG", "_WINDOWS", "HAVE_CONFIG_H" );
includedirs( "..", "../include", "../util" );
filter ( "Release", "platforms:Win32", "files:../bin/winvlc.c" );
pchheader("stdafx.h");
filter ( );
pchsource("stdafx.cpp");
} catch( Exception ex )
{
ConsolePrintException(ex, args);
}
} //Main
}; //class Builder
C# script can be now executed by C# script, but also by syncProj tool itself, I have added built-in support for .cs to .dll compilation.
For C# visual studio's intellisense drives in, so functions description should be available to C# script writer.
I have now tested that one project can loaded (vs2013 as generated project), next will try to load whole solution.
After that will actually start to compile and / or port to Android whole base.
I have some ideas about which improvements to drive in into next evolution premake / syncProj - but I'll port more when I'll implement some prototype to them.