** Merged Visual Studio C# support and simplified configuration filters (r649:661)
This commit is contained in:
parent
51de420d55
commit
1831580590
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
</configuration>
|
63
samples/project/CsConsoleApp/Resource1.Designer.cs
generated
Normal file
63
samples/project/CsConsoleApp/Resource1.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.832
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ConsoleApplication2 {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resource1 {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resource1() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ConsoleApplication2.Resource1", typeof(Resource1).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
101
samples/project/CsConsoleApp/Resource1.resx
Normal file
101
samples/project/CsConsoleApp/Resource1.resx
Normal file
@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Greeting" xml:space="preserve">
|
||||
<value>Hi there!</value>
|
||||
</data>
|
||||
</root>
|
@ -3,10 +3,10 @@ project "CsConsoleApp"
|
||||
kind "ConsoleApp"
|
||||
language "C#"
|
||||
|
||||
files { "*.cs", "*.bmp", "App.config", "Resources.resx" }
|
||||
files { "**.cs", "**.bmp", "**.resx", "**.config" }
|
||||
|
||||
libdirs { "../lib" }
|
||||
links { "CsSharedLib", "CppSharedLib", "System" }
|
||||
|
||||
configuration "Crate.bmp"
|
||||
configuration "*.bmp"
|
||||
buildaction "Embed"
|
||||
|
@ -40,8 +40,12 @@
|
||||
"actions/make/make_cpp.tmpl",
|
||||
"actions/make/make_csharp.tmpl",
|
||||
"actions/vstudio/vs2002_solution.tmpl",
|
||||
"actions/vstudio/vs2002_csproj.tmpl",
|
||||
"actions/vstudio/vs2002_csproj_user.tmpl",
|
||||
"actions/vstudio/vs2003_solution.tmpl",
|
||||
"actions/vstudio/vs2005_solution.tmpl",
|
||||
"actions/vstudio/vs2005_csproj.tmpl",
|
||||
"actions/vstudio/vs2005_csproj_user.tmpl",
|
||||
"actions/vstudio/vs200x_vcproj.tmpl",
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,9 @@
|
||||
end
|
||||
return result
|
||||
else
|
||||
local result = value:gsub(" ", "\\ ")
|
||||
local result
|
||||
result = value:gsub(" ", "\\ ")
|
||||
result = result:gsub("\\", "\\\\")
|
||||
return result
|
||||
end
|
||||
end
|
||||
|
@ -43,12 +43,12 @@
|
||||
local copypairs = { }
|
||||
|
||||
for fcfg in premake.eachfile(this) do
|
||||
local action = fcfg.buildaction or csc.getbuildaction(fcfg.name)
|
||||
local action = csc.getbuildaction(fcfg)
|
||||
if action == "Compile" then
|
||||
table.insert(sources, fcfg.name)
|
||||
elseif action == "Embed" then
|
||||
elseif action == "EmbeddedResource" then
|
||||
table.insert(embedded, fcfg.name)
|
||||
elseif action == "Copy" then
|
||||
elseif action == "Content" then
|
||||
copypairs["$(TARGETDIR)/"..path.getname(fcfg.name)] = fcfg.name
|
||||
elseif path.getname(fcfg.name):lower() == "app.config" then
|
||||
copypairs["$(TARGET).config"] = fcfg.name
|
||||
@ -90,7 +90,7 @@ ifeq ($(CONFIG),<%= _MAKE.esc(cfg.name)%>)
|
||||
TARGETDIR := <%= _MAKE.esc(cfg.buildtarget.directory) %>
|
||||
OBJDIR := <%= _MAKE.esc(cfg.objectsdir) %>
|
||||
DEPENDS := <%= table.concat(_MAKE.esc(premake.getlinks(cfg, "dependencies", "fullpath")), " ") %>
|
||||
REFERENCES := <%= table.implode(_MAKE.esc(cfglibs[cfg]), "/r:", "", "") %>
|
||||
REFERENCES := <%= table.implode(_MAKE.esc(cfglibs[cfg]), "/r:", "", " ") %>
|
||||
FLAGS += <%= table.concat(csc.getflags(cfg), " ") %> <%= table.implode(cfg.defines, "/d:", "", " ") %>
|
||||
define PREBUILDCMDS
|
||||
<% if #cfg.prebuildcommands > 0 then %>
|
||||
@ -115,18 +115,18 @@ endif
|
||||
|
||||
# To maintain compatibility with VS.NET, these values must be set at the project level
|
||||
TARGET = $(TARGETDIR)/<%= _MAKE.esc(this.buildtarget.name) %>
|
||||
FLAGS += /t:<%= csc.getkind(this) %> <%= table.implode(_MAKE.esc(this.libdirs), "/lib:", "", " ") %>
|
||||
FLAGS += /t:<%= csc.getkind(this):lower() %> <%= table.implode(_MAKE.esc(this.libdirs), "/lib:", "", " ") %>
|
||||
REFERENCES += <%= table.implode(_MAKE.esc(premake.getlinks(this, "system", "basename")), "/r:", ".dll", " ") %>
|
||||
|
||||
|
||||
SOURCES := \
|
||||
<% for _, fname in ipairs(sources) do %>
|
||||
<%= _MAKE.esc(fname) %> \
|
||||
<%= _MAKE.esc(path.translate(fname)) %> \
|
||||
<% end %>
|
||||
|
||||
EMBEDFILES := \
|
||||
<% for _, fname in ipairs(embedded) do %>
|
||||
<%= _MAKE.esc(getresourcefilename(this, fname)) %> \
|
||||
<%= _MAKE.esc(path.translate(getresourcefilename(this, fname), sep)) %> \
|
||||
<% end %>
|
||||
|
||||
COPYFILES += \
|
||||
|
@ -98,9 +98,9 @@
|
||||
-- Returns the architecture identifier for a project.
|
||||
--
|
||||
|
||||
function _VS.arch(prj, version)
|
||||
function _VS.arch(prj)
|
||||
if (prj.language == "C#") then
|
||||
if (version < 2005) then
|
||||
if (_ACTION < "vs2005") then
|
||||
return ".NET"
|
||||
else
|
||||
return "Any CPU"
|
||||
@ -287,14 +287,16 @@
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
valid_languages = { "C", "C++" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2002_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj },
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2002_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2002_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
@ -308,14 +310,16 @@
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
valid_languages = { "C", "C++" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2003_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj },
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2002_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2002_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
@ -329,14 +333,16 @@
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
valid_languages = { "C", "C++" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2005_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj },
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2005_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2005_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
@ -350,14 +356,16 @@
|
||||
|
||||
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib" },
|
||||
|
||||
valid_languages = { "C", "C++" },
|
||||
valid_languages = { "C", "C++", "C#" },
|
||||
|
||||
solutiontemplates = {
|
||||
{ ".sln", _TEMPLATES.vs2005_solution },
|
||||
},
|
||||
|
||||
projecttemplates = {
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj },
|
||||
{ ".vcproj", _TEMPLATES.vs200x_vcproj, function(this) return this.language ~= "C#" end },
|
||||
{ ".csproj", _TEMPLATES.vs2005_csproj, function(this) return this.language == "C#" end },
|
||||
{ ".csproj.user", _TEMPLATES.vs2005_csproj_user, function(this) return this.language == "C#" end },
|
||||
},
|
||||
|
||||
onclean = _VS.onclean,
|
||||
|
127
src/actions/vstudio/vs2002_csproj.tmpl
Normal file
127
src/actions/vstudio/vs2002_csproj.tmpl
Normal file
@ -0,0 +1,127 @@
|
||||
<%
|
||||
eol = "\r\n"
|
||||
local csc = premake.csc
|
||||
|
||||
--
|
||||
-- Figure out what elements a particular file need in its item block,
|
||||
-- based on its build action and any related files in the project.
|
||||
--
|
||||
|
||||
function getelements(prj, action, fname)
|
||||
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
return "SubTypeCode"
|
||||
end
|
||||
|
||||
if action == "EmbeddedResource" and fname:endswith(".resx") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -6)
|
||||
local testname = path.getname(basename .. ".cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
return "Dependency", testname
|
||||
end
|
||||
end
|
||||
|
||||
return "None"
|
||||
end
|
||||
|
||||
-- end of preprocessing; template starts here --
|
||||
%>
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "<%= iif(_ACTION == "vs2002", "7.0.9254", "7.10.3077") %>"
|
||||
SchemaVersion = "<%= iif(_ACTION == "vs2002", "1.0", "2.0") %>"
|
||||
ProjectGuid = "{<%= this.uuid %>}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "<%= this.buildtarget.basename %>"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
<% if _ACTION == "vs2002" then %>
|
||||
NoStandardLibraries = "false"
|
||||
<% end %>
|
||||
OutputType = "<%= csc.getkind(this) %>"
|
||||
<% if _ACTION == "vs2003" then %>
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
<% end %>
|
||||
RootNamespace = "<%= this.buildtarget.basename %>"
|
||||
<% if _ACTION == "vs2003" then %>
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
<% end %>
|
||||
StartupObject = ""
|
||||
>
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<Config
|
||||
Name = "<%= premake.esc(cfg.name) %>"
|
||||
AllowUnsafeBlocks = "<%= iif(cfg.flags.Unsafe, "true", "false") %>"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "<%= premake.esc(table.concat(cfg.defines, ";")) %>"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "<%= iif(cfg.flags.Symbols, "true", "false") %>"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
<% if _ACTION == "vs2003" then %>
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
<% end %>
|
||||
Optimize = "<%= iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false") %>"
|
||||
OutputPath = "<%= premake.esc(cfg.buildtarget.directory) %>"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "<%= iif(cfg.flags.FatalWarnings, "true", "false") %>"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<% end %>
|
||||
</Settings>
|
||||
<References>
|
||||
<% for _, prj in ipairs(premake.getlinks(this, "siblings", "object")) do %>
|
||||
<Reference
|
||||
Name = "<%= prj.buildtarget.basename %>"
|
||||
Project = "{<%= prj.uuid %>}"
|
||||
Package = "{<%= _VS.tool(prj) %>}"
|
||||
/>
|
||||
<% end %>
|
||||
<% for _, linkname in ipairs(premake.getlinks(this, "system", "fullpath")) do %>
|
||||
<Reference
|
||||
Name = "<%= path.getbasename(linkname) %>"
|
||||
AssemblyName = "<%= path.getname(linkname) %>"
|
||||
<% if path.getdirectory(linkname) ~= "." then %>
|
||||
HintPath = "<%= path.translate(linkname, "\\") %>"
|
||||
<% end %>
|
||||
/>
|
||||
<% end %>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<%
|
||||
for fcfg in premake.eachfile(this) do
|
||||
local action = csc.getbuildaction(fcfg)
|
||||
local fname = path.translate(premake.esc(fcfg.name), "\\")
|
||||
local elements, dependency = getelements(this, action, fcfg.name)
|
||||
%>
|
||||
<File
|
||||
RelPath = "<%= premake.esc(fname) %>"
|
||||
BuildAction = "<%= action %>"
|
||||
<% if dependency then %>
|
||||
DependentUpon = "<%= premake.esc(path.translate(dependency, "\\")) %>"
|
||||
<% end %>
|
||||
<% if elements == "SubTypeCode" then %>
|
||||
SubType = "Code"
|
||||
<% end %>
|
||||
/>
|
||||
<% end %>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
37
src/actions/vstudio/vs2002_csproj_user.tmpl
Normal file
37
src/actions/vstudio/vs2002_csproj_user.tmpl
Normal file
@ -0,0 +1,37 @@
|
||||
<%
|
||||
eol = "\r\n"
|
||||
local csc = premake.csc
|
||||
%>
|
||||
<VisualStudioProject>
|
||||
<CSHARP>
|
||||
<Build>
|
||||
<Settings ReferencePath = "<%= table.concat(table.translate(this.libdirs, function(v) return path.translate(path.getabsolute(this.location.."/"..v),"\\") end), ";") %>">
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<Config
|
||||
Name = "<%= premake.esc(cfg.name) %>"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "false"
|
||||
/>
|
||||
<% end %>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
@ -22,8 +22,8 @@ Global
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% for i,cfgname in ipairs(this.configurations) do %>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.ActiveCfg = <%=cfgname%>|<%=_VS.arch(prj, 2002)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.Build.0 = <%=cfgname%>|<%=_VS.arch(prj, 2002)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.ActiveCfg = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.Build.0 = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
|
@ -22,8 +22,8 @@ Global
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
<% for prj in premake.eachproject(this) do %>
|
||||
<% for i,cfgname in ipairs(this.configurations) do %>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.ActiveCfg = <%=cfgname%>|<%=_VS.arch(prj, 2002)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.Build.0 = <%=cfgname%>|<%=_VS.arch(prj, 2002)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.ActiveCfg = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
{<%=prj.uuid%>}.<%=cfgname%>.Build.0 = <%=cfgname%>|<%=_VS.arch(prj)%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
EndGlobalSection
|
||||
|
159
src/actions/vstudio/vs2005_csproj.tmpl
Normal file
159
src/actions/vstudio/vs2005_csproj.tmpl
Normal file
@ -0,0 +1,159 @@
|
||||
<%
|
||||
eol = "\r\n"
|
||||
local csc = premake.csc
|
||||
|
||||
-- translate the action to a Visual Studio version number
|
||||
local vsversion
|
||||
if _ACTION == "vs2005" then
|
||||
vsversion = "8.0.50727"
|
||||
elseif _ACTION == "vs2008" then
|
||||
vsversion = "9.0.50727"
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Figure out what elements a particular file need in its item block,
|
||||
-- based on its build action and any related files in the project.
|
||||
--
|
||||
|
||||
function getelements(prj, action, fname)
|
||||
|
||||
if action == "Compile" and fname:endswith(".cs") then
|
||||
if fname:endswith(".Designer.cs") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -13)
|
||||
local testname = basename .. ".cs"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "Dependency", testname
|
||||
end
|
||||
-- is there a matching *.resx file?
|
||||
testname = basename .. ".resx"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "AutoGen", testname
|
||||
end
|
||||
else
|
||||
-- is there a *.Designer.cs file?
|
||||
local basename = fname:sub(1, -4)
|
||||
local testname = basename .. ".Designer.cs"
|
||||
if premake.findfile(prj, testname) then
|
||||
return "SubTypeForm"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "EmbeddedResource" and fname:endswith(".resx") then
|
||||
-- is there a matching *.cs file?
|
||||
local basename = fname:sub(1, -6)
|
||||
local testname = path.getname(basename .. ".cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
if premake.findfile(prj, basename .. ".Designer.cs") then
|
||||
return "DesignerType", testname
|
||||
else
|
||||
return "Dependency", testname
|
||||
end
|
||||
else
|
||||
-- is there a matching *.Designer.cs?
|
||||
testname = path.getname(basename .. ".Designer.cs")
|
||||
if premake.findfile(prj, testname) then
|
||||
return "AutoGenerated"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if action == "Content" then
|
||||
return "CopyNewest"
|
||||
end
|
||||
|
||||
return "None"
|
||||
end
|
||||
|
||||
-- end of preprocessing; template starts here --
|
||||
%>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' "><%= premake.esc(this.solution.configurations[1]) %></Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion><%= vsversion %></ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{<%= this.uuid %>}</ProjectGuid>
|
||||
<OutputType><%= csc.getkind(this) %></OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace><%= this.buildtarget.basename %></RootNamespace>
|
||||
<AssemblyName><%= this.buildtarget.basename %></AssemblyName>
|
||||
</PropertyGroup>
|
||||
<% for cfg in premake.eachconfig(this) do %>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == '<%= premake.esc(cfg.name) %>|AnyCPU' ">
|
||||
<% if cfg.flags.Symbols then %>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<% else %>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<% end %>
|
||||
<Optimize><%= iif(cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed, "true", "false") %></Optimize>
|
||||
<OutputPath><%= cfg.buildtarget.directory %></OutputPath>
|
||||
<DefineConstants><%= table.concat(premake.esc(cfg.defines), ";") %></DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<% if cfg.flags.Unsafe then %>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<% end %>
|
||||
<% if cfg.flags.FatalWarnings then %>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<% end %>
|
||||
</PropertyGroup>
|
||||
<% end %>
|
||||
<ItemGroup>
|
||||
<% for _, prj in ipairs(premake.getlinks(this, "siblings", "object")) do %>
|
||||
<ProjectReference Include="<%= path.translate(path.getrelative(this.location, _VS.projectfile(prj)), "\\") %>">
|
||||
<Project>{<%= prj.uuid %>}</Project>
|
||||
<Name><%= premake.esc(prj.name) %></Name>
|
||||
</ProjectReference>
|
||||
<% end %>
|
||||
<% for _, linkname in ipairs(premake.getlinks(this, "system", "basename")) do %>
|
||||
<Reference Include="<%= premake.esc(linkname) %>" />
|
||||
<% end %>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<%
|
||||
for fcfg in premake.eachfile(this) do
|
||||
local action = csc.getbuildaction(fcfg)
|
||||
local fname = path.translate(premake.esc(fcfg.name), "\\")
|
||||
local elements, dependency = getelements(this, action, fcfg.name)
|
||||
if elements == "None" then
|
||||
%>
|
||||
<<%= action %> Include="<%= fname %>" />
|
||||
<%
|
||||
else
|
||||
%>
|
||||
<<%= action %> Include="<%= fname %>">
|
||||
<% if elements == "AutoGen" then %>
|
||||
<AutoGen>True</AutoGen>
|
||||
<% elseif elements == "AutoGenerated" then %>
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput><%= premake.esc(path.getbasename(fcfg.name)) %>.Designer.cs</LastGenOutput>
|
||||
<% elseif elements == "SubTypeDesigner" then %>
|
||||
<SubType>Designer</SubType>
|
||||
<% elseif elements == "SubTypeForm" then %>
|
||||
<SubType>Form</SubType>
|
||||
<% elseif elements == "PreserveNewest" then %>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
<% end %>
|
||||
<% if dependency then %>
|
||||
<DependentUpon><%= path.translate(premake.esc(dependency), "\\") %></DependentUpon>
|
||||
<% end %>
|
||||
</<%= action %>>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
6
src/actions/vstudio/vs2005_csproj_user.tmpl
Normal file
6
src/actions/vstudio/vs2005_csproj_user.tmpl
Normal file
@ -0,0 +1,6 @@
|
||||
<% eol = "\r\n" %>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ReferencePath><%= table.concat(table.translate(this.libdirs, function(v) return path.translate(path.getabsolute(this.location.."/"..v),"\\") end), ";") %></ReferencePath>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -51,13 +51,13 @@
|
||||
excludes =
|
||||
{
|
||||
kind = "filelist",
|
||||
scope = "container",
|
||||
scope = "config",
|
||||
},
|
||||
|
||||
files =
|
||||
{
|
||||
kind = "filelist",
|
||||
scope = "container",
|
||||
scope = "config",
|
||||
},
|
||||
|
||||
flags =
|
||||
@ -86,6 +86,7 @@
|
||||
"StaticRuntime",
|
||||
"Symbols",
|
||||
"Unicode",
|
||||
"Unsafe",
|
||||
"WinMain"
|
||||
}
|
||||
},
|
||||
@ -489,11 +490,24 @@
|
||||
table.insert(container.blocks, cfg)
|
||||
premake.CurrentConfiguration = cfg
|
||||
|
||||
if (type(keywords) == "table") then
|
||||
cfg.keywords = keywords
|
||||
else
|
||||
cfg.keywords = { keywords }
|
||||
-- create a keyword list using just the indexed keyword items
|
||||
cfg.keywords = { }
|
||||
for _, word in ipairs(table.join({}, keywords)) do
|
||||
table.insert(cfg.keywords, premake.escapekeyword(word))
|
||||
end
|
||||
|
||||
-- if file patterns are specified, convert them to Lua patterns and add them too
|
||||
if keywords.files then
|
||||
for _, pattern in ipairs(table.join({}, keywords.files)) do
|
||||
pattern = pattern:gsub("%.", "%%.")
|
||||
if pattern:find("**", nil, true) then
|
||||
pattern = pattern:gsub("%*%*", ".*")
|
||||
else
|
||||
pattern = pattern:gsub("%*", "[^/]*")
|
||||
end
|
||||
table.insert(cfg.keywords, "^" .. pattern .. "$")
|
||||
end
|
||||
end
|
||||
|
||||
-- initialize list-type fields to empty tables
|
||||
for name, field in pairs(premake.fields) do
|
||||
|
@ -31,14 +31,14 @@
|
||||
--
|
||||
|
||||
function premake.getactiveterms()
|
||||
local terms = { _ACTION, os.get() }
|
||||
local terms = { _ACTION:lower(), os.get() }
|
||||
|
||||
-- add option keys or values
|
||||
for key, value in pairs(_OPTIONS) do
|
||||
if value then
|
||||
table.insert(terms, value)
|
||||
if value ~= "" then
|
||||
table.insert(terms, value:lower())
|
||||
else
|
||||
table.insert(terms, key)
|
||||
table.insert(terms, key:lower())
|
||||
end
|
||||
end
|
||||
|
||||
@ -46,39 +46,60 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Escape a keyword in preparation for testing against a list of terms.
|
||||
-- Converts from Premake's simple pattern syntax to Lua's syntax.
|
||||
--
|
||||
|
||||
function premake.escapekeyword(keyword)
|
||||
keyword = keyword:gsub("([%.%-%^%$%(%)%%])", "%%%1")
|
||||
if keyword:find("**", nil, true) then
|
||||
keyword = keyword:gsub("%*%*", ".*")
|
||||
else
|
||||
keyword = keyword:gsub("%*", "[^/]*")
|
||||
end
|
||||
return keyword:lower()
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if all of the keywords are included the set of terms. Keywords
|
||||
-- may use Lua's pattern matching syntax. Comparisons are case-insensitive.
|
||||
-- Test a single configuration block keyword against a list of terms.
|
||||
--
|
||||
|
||||
function premake.iskeywordmatch(keyword, terms)
|
||||
-- is it negated?
|
||||
if keyword:startswith("not ") then
|
||||
return not premake.iskeywordmatch(keyword:sub(5), terms)
|
||||
end
|
||||
|
||||
for _, word in ipairs(keyword:explode(" or ")) do
|
||||
local pattern = "^" .. word .. "$"
|
||||
for termkey, term in pairs(terms) do
|
||||
if term:match(pattern) then
|
||||
return termkey
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Checks a set of configuration block keywords against a list of terms.
|
||||
--
|
||||
|
||||
function premake.iskeywordsmatch(keywords, terms)
|
||||
local hasrequired = false
|
||||
|
||||
local function test(kw)
|
||||
for termkey, term in pairs(terms) do
|
||||
if (term:match(kw)) then
|
||||
if termkey == "required" then hasrequired = true end
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, kw in ipairs(keywords) do
|
||||
-- make keyword pattern case insensitive
|
||||
kw = kw:gsub("(%%*)(%a)",
|
||||
function (p,a)
|
||||
if (p:len() % 2 == 1) then
|
||||
return p..a
|
||||
else
|
||||
return p.."["..a:upper()..a:lower().."]"
|
||||
end
|
||||
end)
|
||||
|
||||
-- match it to a term
|
||||
if (not test(kw)) then
|
||||
for _, keyword in ipairs(keywords) do
|
||||
local matched = premake.iskeywordmatch(keyword, terms)
|
||||
if not matched then
|
||||
return false
|
||||
end
|
||||
if matched == "required" then
|
||||
hasrequired = true
|
||||
end
|
||||
end
|
||||
|
||||
if terms.required and not hasrequired then
|
||||
@ -152,7 +173,7 @@
|
||||
-- create the base configuration, flattening the list of objects and
|
||||
-- filtering out settings which do not match the current environment
|
||||
local terms = premake.getactiveterms()
|
||||
terms.config = cfgname
|
||||
terms.config = (cfgname or ""):lower()
|
||||
|
||||
local cfg = buildconfig(prj, terms)
|
||||
cfg.name = cfgname
|
||||
@ -194,7 +215,7 @@
|
||||
-- build configuration objects for all files
|
||||
cfg.__fileconfigs = { }
|
||||
for _, fname in ipairs(cfg.files) do
|
||||
terms.required = fname
|
||||
terms.required = fname:lower()
|
||||
local fcfg = buildconfig(prj, terms)
|
||||
fcfg.name = fname
|
||||
-- add indexed by name and integer
|
||||
|
@ -6,6 +6,69 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a project's configuration objects.
|
||||
--
|
||||
|
||||
function premake.eachconfig(prj)
|
||||
-- I probably have the project root config, rather than the actual project
|
||||
if prj.project then prj = prj.project end
|
||||
local i = 0
|
||||
local t = prj.solution.configurations
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #t) then
|
||||
return prj.__configs[t[i]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a project's files; returns a file configuration object.
|
||||
--
|
||||
|
||||
function premake.eachfile(prj)
|
||||
-- project root config contains the file config list
|
||||
if not prj.project then prj = premake.getconfig(prj) end
|
||||
local i = 0
|
||||
local t = prj.files
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #t) then
|
||||
return prj.__fileconfigs[t[i]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a solution's projects, or rather project root configurations.
|
||||
-- These configuration objects include all settings related to the project,
|
||||
-- regardless of where they were originally specified.
|
||||
--
|
||||
|
||||
function premake.eachproject(sln)
|
||||
local i = 0
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #sln.projects) then
|
||||
local prj = sln.projects[i]
|
||||
local cfg = premake.getconfig(prj)
|
||||
cfg.name = prj.name
|
||||
cfg.blocks = prj.blocks
|
||||
return cfg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Apply XML escaping to a value.
|
||||
--
|
||||
@ -28,6 +91,49 @@
|
||||
return value
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Locate a project by name; case insensitive.
|
||||
--
|
||||
|
||||
function premake.findproject(name)
|
||||
name = name:lower()
|
||||
for _, sln in ipairs(_SOLUTIONS) do
|
||||
for _, prj in ipairs(sln.projects) do
|
||||
if (prj.name:lower() == name) then
|
||||
return prj
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Locate a file in a project with a given extension; used to locate "special"
|
||||
-- items such as Windows .def files.
|
||||
--
|
||||
|
||||
function premake.findfile(prj, extension)
|
||||
for _, fname in ipairs(prj.files) do
|
||||
if fname:endswith(extension) then return fname end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Retrieve a configuration for a given project/configuration pairing. If
|
||||
-- `cfgname` is nil, the project's root configuration will be returned.
|
||||
--
|
||||
|
||||
function premake.getconfig(prj, cfgname)
|
||||
-- might have the root configuration, rather than the actual project
|
||||
if prj.project then prj = prj.project end
|
||||
return prj.__configs[cfgname or ""]
|
||||
end
|
||||
|
||||
|
||||
|
||||
@ -52,22 +158,26 @@
|
||||
|
||||
--
|
||||
-- Returns a list of link targets. Kind may be one of:
|
||||
-- siblings - linkable sibling projects
|
||||
-- system - system (non-subling) libraries
|
||||
-- siblings - linkable sibling projects
|
||||
-- system - system (non-subling) libraries
|
||||
-- dependencies - all sibling dependencies, including non-linkable
|
||||
-- all - return everything
|
||||
-- all - return everything
|
||||
--
|
||||
-- Part may be one of:
|
||||
-- name - the decorated library name with no directory
|
||||
-- basename - the undecorated library name
|
||||
-- name - the decorated library name with no directory
|
||||
-- basename - the undecorated library name
|
||||
-- directory - just the directory, no name
|
||||
-- fullpath - full path with decorated name
|
||||
-- fullpath - full path with decorated name
|
||||
-- object - return the project object of the dependency
|
||||
--
|
||||
|
||||
function premake.getlinks(cfg, kind, part)
|
||||
-- if I'm building a list of link directories, include libdirs
|
||||
local result = iif (part == "directory" and kind == "all", cfg.libdirs, {})
|
||||
|
||||
-- am I getting links for a configuration or a project?
|
||||
local cfgname = iif(cfg.name == cfg.project.name, "", cfg.name)
|
||||
|
||||
local function canlink(source, target)
|
||||
if (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then return false end
|
||||
if (source.language == "C" or source.language == "C++") then
|
||||
@ -86,14 +196,16 @@
|
||||
local prj = premake.findproject(link)
|
||||
if prj and kind ~= "system" then
|
||||
|
||||
local prjcfg = premake.getconfig(prj, cfg.name)
|
||||
local prjcfg = premake.getconfig(prj, cfgname)
|
||||
if kind == "dependencies" or canlink(cfg, prjcfg) then
|
||||
if (part == "directory") then
|
||||
item = path.rebase(prjcfg.linktarget.directory, prjcfg.location, cfg.location)
|
||||
elseif (part == "basename") then
|
||||
item = prjcfg.linktarget.basename
|
||||
else
|
||||
elseif (part == "fullpath") then
|
||||
item = path.rebase(prjcfg.linktarget.fullpath, prjcfg.location, cfg.location)
|
||||
elseif (part == "object") then
|
||||
item = prjcfg
|
||||
end
|
||||
end
|
||||
|
||||
@ -105,7 +217,10 @@
|
||||
item = dir
|
||||
end
|
||||
elseif (part == "fullpath") then
|
||||
item = iif(premake.actions[_ACTION].targetstyle == "windows", link .. ".lib", link)
|
||||
item = link
|
||||
if premake.actions[_ACTION].targetstyle == "windows" then
|
||||
item = item .. iif(cfg.language == "C" or cfg.language == "C++", ".lib", ".dll")
|
||||
end
|
||||
else
|
||||
item = link
|
||||
end
|
||||
@ -113,7 +228,7 @@
|
||||
end
|
||||
|
||||
if item then
|
||||
if premake.actions[_ACTION].targetstyle == "windows" then
|
||||
if premake.actions[_ACTION].targetstyle == "windows" and part ~= "object" then
|
||||
item = path.translate(item, "\\")
|
||||
end
|
||||
if not table.contains(result, item) then
|
||||
@ -191,114 +306,6 @@
|
||||
result.fullpath = path.join(result.directory, result.name)
|
||||
return result
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a project's configuration objects.
|
||||
--
|
||||
|
||||
function premake.eachconfig(prj)
|
||||
-- I probably have the project root config, rather than the actual project
|
||||
if prj.project then prj = prj.project end
|
||||
local i = 0
|
||||
local t = prj.solution.configurations
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #t) then
|
||||
return prj.__configs[t[i]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a project's files; returns a file configuration object.
|
||||
--
|
||||
|
||||
function premake.eachfile(prj)
|
||||
-- project root config contains the file config list
|
||||
if not prj.project then prj = premake.getconfig(prj) end
|
||||
local i = 0
|
||||
local t = prj.files
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #t) then
|
||||
return prj.__fileconfigs[t[i]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Iterator for a solution's projects, or rather project root configurations.
|
||||
-- These configuration objects include all settings related to the project,
|
||||
-- regardless of where they were originally specified.
|
||||
--
|
||||
|
||||
function premake.eachproject(sln)
|
||||
local i = 0
|
||||
return function ()
|
||||
i = i + 1
|
||||
if (i <= #sln.projects) then
|
||||
local prj = sln.projects[i]
|
||||
local cfg = premake.getconfig(prj)
|
||||
cfg.name = prj.name
|
||||
cfg.blocks = prj.blocks
|
||||
return cfg
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Locate a project by name; case insensitive.
|
||||
--
|
||||
|
||||
function premake.findproject(name)
|
||||
name = name:lower()
|
||||
for _, sln in ipairs(_SOLUTIONS) do
|
||||
for _, prj in ipairs(sln.projects) do
|
||||
if (prj.name:lower() == name) then
|
||||
return prj
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Locate a file in a project with a given extension; used to locate "special"
|
||||
-- items such as Windows .def files.
|
||||
--
|
||||
|
||||
function premake.findfile(prj, extension)
|
||||
for _, fname in ipairs(prj.files) do
|
||||
if (path.getextension(fname) == extension) then
|
||||
return fname
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Retrieve a configuration for a given project/configuration pairing. If
|
||||
-- `cfgname` is nil, the project's root configuration will be returned.
|
||||
--
|
||||
|
||||
function premake.getconfig(prj, cfgname)
|
||||
-- might have the root configuration, rather than the actual project
|
||||
if prj.project then prj = prj.project end
|
||||
return prj.__configs[cfgname or ""]
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Walk the list of source code files, breaking them into "groups" based
|
||||
-- on the directory hierarchy.
|
||||
|
@ -58,8 +58,12 @@
|
||||
function table.join(...)
|
||||
local result = { }
|
||||
for _,t in ipairs(arg) do
|
||||
for _,v in ipairs(t) do
|
||||
table.insert(result, v)
|
||||
if type(t) == "table" then
|
||||
for _,v in ipairs(t) do
|
||||
table.insert(result, v)
|
||||
end
|
||||
else
|
||||
table.insert(result, t)
|
||||
end
|
||||
end
|
||||
return result
|
||||
|
File diff suppressed because one or more lines are too long
@ -27,14 +27,16 @@
|
||||
-- Return the default build action for a given file, based on the file extension.
|
||||
--
|
||||
|
||||
function premake.csc.getbuildaction(fname)
|
||||
local ext = path.getextension(fname):lower()
|
||||
if ext == ".cs" then
|
||||
function premake.csc.getbuildaction(fcfg)
|
||||
local ext = path.getextension(fcfg.name):lower()
|
||||
if fcfg.buildaction == "Compile" or ext == ".cs" then
|
||||
return "Compile"
|
||||
elseif ext == ".resx" then
|
||||
return "Embed"
|
||||
elseif ext == ".asax" or ext == ".aspx" then
|
||||
return "Copy"
|
||||
elseif fcfg.buildaction == "Embed" or ext == ".resx" then
|
||||
return "EmbeddedResource"
|
||||
elseif fcfg.buildaction == "Copy" or ext == ".asax" or ext == ".aspx" then
|
||||
return "Content"
|
||||
else
|
||||
return "None"
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,10 +75,10 @@
|
||||
|
||||
function premake.csc.getkind(cfg)
|
||||
if (cfg.kind == "ConsoleApp") then
|
||||
return "exe"
|
||||
return "Exe"
|
||||
elseif (cfg.kind == "WindowedApp") then
|
||||
return "winexe"
|
||||
return "WinExe"
|
||||
elseif (cfg.kind == "SharedLib") then
|
||||
return "library"
|
||||
return "Library"
|
||||
end
|
||||
end
|
@ -16,6 +16,7 @@
|
||||
dofile("test_api.lua")
|
||||
dofile("test_targets.lua")
|
||||
dofile("test_functions.lua")
|
||||
dofile("test_keywords.lua")
|
||||
|
||||
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
--
|
||||
-- tests/test_functions.lua
|
||||
-- tests/test_api.lua
|
||||
-- Automated test suite for the project API.
|
||||
-- Copyright (c) 2008 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
|
||||
T.functions = { }
|
||||
T.api = { }
|
||||
|
||||
local sln
|
||||
function T.functions.setup()
|
||||
function T.api.setup()
|
||||
sln = solution "MySolution"
|
||||
end
|
||||
|
||||
@ -17,34 +17,34 @@
|
||||
-- solution() tests
|
||||
--
|
||||
|
||||
function T.functions.solution_SetsCurrentObject()
|
||||
function T.api.solution_SetsCurrentObject()
|
||||
test.istrue(sln == premake.CurrentContainer)
|
||||
end
|
||||
|
||||
function T.functions.solution_SetsName()
|
||||
function T.api.solution_SetsName()
|
||||
test.isequal("MySolution", sln.name)
|
||||
end
|
||||
|
||||
function T.functions.solution_SetsLocation()
|
||||
function T.api.solution_SetsLocation()
|
||||
test.isequal(os.getcwd(), sln.location)
|
||||
end
|
||||
|
||||
function T.functions.solution_ReturnsNil_OnNoActiveSolution()
|
||||
function T.api.solution_ReturnsNil_OnNoActiveSolution()
|
||||
premake.CurrentContainer = nil
|
||||
test.isfalse(solution())
|
||||
end
|
||||
|
||||
function T.functions.solutions_ReturnsSolution_OnActiveProject()
|
||||
function T.api.solutions_ReturnsSolution_OnActiveProject()
|
||||
project("MyProject")
|
||||
test.istrue(sln == solution())
|
||||
end
|
||||
|
||||
function T.functions.solution_OnNewName()
|
||||
function T.api.solution_OnNewName()
|
||||
local sln2 = solution "MySolution2"
|
||||
test.isfalse(sln == sln2)
|
||||
end
|
||||
|
||||
function T.functions.solution_OnExistingName()
|
||||
function T.api.solution_OnExistingName()
|
||||
local sln2 = solution "MySolution2"
|
||||
test.istrue(sln == solution("MySolution"))
|
||||
end
|
||||
@ -55,20 +55,20 @@
|
||||
-- configuration() tests
|
||||
--
|
||||
|
||||
function T.functions.configuration_RaisesError_OnNoContainer()
|
||||
function T.api.configuration_RaisesError_OnNoContainer()
|
||||
premake.CurrentContainer = nil
|
||||
local fn = function() configuration{"Debug"} end
|
||||
ok, err = pcall(fn)
|
||||
test.isfalse(ok)
|
||||
end
|
||||
|
||||
function T.functions.configuration_SetsCurrentConfiguration()
|
||||
function T.api.configuration_SetsCurrentConfiguration()
|
||||
sln = solution("MySolution")
|
||||
cfg = configuration{"Debug"}
|
||||
test.istrue(premake.CurrentConfiguration == cfg)
|
||||
end
|
||||
|
||||
function T.functions.configuration_AddsToContainer()
|
||||
function T.api.configuration_AddsToContainer()
|
||||
sln = solution("MySolution")
|
||||
cfg = configuration{"Debug"}
|
||||
test.istrue(cfg == sln.blocks[#sln.blocks])
|
||||
@ -79,60 +79,60 @@
|
||||
-- project() tests
|
||||
--
|
||||
|
||||
function T.functions.project_RaisesError_OnNoSolution()
|
||||
function T.api.project_RaisesError_OnNoSolution()
|
||||
premake.CurrentContainer = nil
|
||||
local fn = function() project("MyProject") end
|
||||
ok, err = pcall(fn)
|
||||
test.isfalse(ok)
|
||||
end
|
||||
|
||||
function T.functions.project_SetsCurrentContainer()
|
||||
function T.api.project_SetsCurrentContainer()
|
||||
prj = project("MyProject")
|
||||
test.istrue(prj == premake.CurrentContainer)
|
||||
end
|
||||
|
||||
function T.functions.project_AddsToSolution()
|
||||
function T.api.project_AddsToSolution()
|
||||
prj = project("MyProject")
|
||||
test.istrue(prj == sln.projects[1])
|
||||
end
|
||||
|
||||
function T.functions.project_SetsName()
|
||||
function T.api.project_SetsName()
|
||||
prj = project("MyProject")
|
||||
test.isequal("MyProject", prj.name)
|
||||
end
|
||||
|
||||
function T.functions.project_SetsLocation()
|
||||
function T.api.project_SetsLocation()
|
||||
prj = project("MyProject")
|
||||
test.isequal(os.getcwd(), prj.location)
|
||||
end
|
||||
|
||||
function T.functions.project_SetsSolution()
|
||||
function T.api.project_SetsSolution()
|
||||
prj = project("MyProject")
|
||||
test.istrue(sln == prj.solution)
|
||||
end
|
||||
|
||||
function T.functions.project_SetsConfiguration()
|
||||
function T.api.project_SetsConfiguration()
|
||||
prj = project("MyProject")
|
||||
test.istrue(premake.CurrentConfiguration == prj.blocks[1])
|
||||
end
|
||||
|
||||
function T.functions.project_ReturnsNil_OnNoActiveProject()
|
||||
function T.api.project_ReturnsNil_OnNoActiveProject()
|
||||
test.isfalse(project())
|
||||
end
|
||||
|
||||
function T.functions.project_OnNewName()
|
||||
function T.api.project_OnNewName()
|
||||
local prj = project "MyProject"
|
||||
local prj2 = project "MyProject2"
|
||||
test.isfalse(prj == prj2)
|
||||
end
|
||||
|
||||
function T.functions.project_OnExistingName()
|
||||
function T.api.project_OnExistingName()
|
||||
local prj = project "MyProject"
|
||||
local prj2 = project "MyProject2"
|
||||
test.istrue(prj == project("MyProject"))
|
||||
end
|
||||
|
||||
function T.functions.project_SetsUUID()
|
||||
function T.api.project_SetsUUID()
|
||||
local prj = project "MyProject"
|
||||
test.istrue(prj.uuid)
|
||||
end
|
||||
|
91
tests/test_keywords.lua
Normal file
91
tests/test_keywords.lua
Normal file
@ -0,0 +1,91 @@
|
||||
--
|
||||
-- tests/test_keywords.lua
|
||||
-- Automated test suite for configuration block keyword filtering.
|
||||
-- Copyright (c) 2008 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
T.keywords = { }
|
||||
|
||||
--
|
||||
-- Keyword escaping tests
|
||||
--
|
||||
|
||||
function T.keywords.escapes_lowercase()
|
||||
test.isequal("windows", premake.escapekeyword("Windows"))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.escapes_special_chars()
|
||||
test.isequal("%.%-", premake.escapekeyword(".-"))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.escapes_star()
|
||||
test.isequal("vs[^/]*", premake.escapekeyword("vs*"))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.escapes_star_star()
|
||||
test.isequal("images/.*%.bmp", premake.escapekeyword("Images/**.bmp"))
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Keyword matching tests
|
||||
--
|
||||
|
||||
function T.keywords.matches_simple_strings()
|
||||
test.istrue(premake.iskeywordmatch("debug", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_files_with_simple_strings()
|
||||
test.isfalse(premake.iskeywordmatch("release", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.matches_with_patterns()
|
||||
test.istrue(premake.iskeywordmatch("vs20.*", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_fails_with_not_term()
|
||||
test.isfalse(premake.iskeywordmatch("not windows", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_ok_with_not_term()
|
||||
test.istrue(premake.iskeywordmatch("not linux", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_ok_with_first_or()
|
||||
test.istrue(premake.iskeywordmatch("windows or linux", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_ok_with_first_or()
|
||||
test.istrue(premake.iskeywordmatch("windows or linux", { "debug", "linux", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_ok_with_not_and_or()
|
||||
test.istrue(premake.iskeywordmatch("not macosx or linux", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_fail_with_not_and_or()
|
||||
test.isfalse(premake.iskeywordmatch("not macosx or windows", { "debug", "windows", "vs2005" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_ok_required_term()
|
||||
test.istrue(premake.iskeywordsmatch({ "debug", "hello.c" }, { "debug", "windows", "vs2005", required="hello.c" }))
|
||||
end
|
||||
|
||||
|
||||
function T.keywords.match_fail_required_term()
|
||||
test.isfalse(premake.iskeywordsmatch({ "debug" }, { "debug", "windows", "vs2005", required="hello.c" }))
|
||||
end
|
Reference in New Issue
Block a user