diff options
author | starkos <none@none> | 2010-03-05 00:01:45 +0300 |
---|---|---|
committer | starkos <none@none> | 2010-03-05 00:01:45 +0300 |
commit | 705fcc8ba8c6d2cb9d7729d29b7c7113ce0b7be9 (patch) | |
tree | b024e7d66ff3b7d9f70b53a3016a0b4ab4f4061e | |
parent | b15757c66db4679d15a640c2f386226840a545f8 (diff) |
Began work on new frameworks() api
-rw-r--r-- | src/actions/vstudio/vs2005_csproj.lua | 45 | ||||
-rw-r--r-- | src/base/api.lua | 14 | ||||
-rw-r--r-- | tests/actions/vstudio/test_vs2005_csproj.lua | 55 | ||||
-rw-r--r-- | tests/premake4.lua | 1 |
4 files changed, 110 insertions, 5 deletions
diff --git a/src/actions/vstudio/vs2005_csproj.lua b/src/actions/vstudio/vs2005_csproj.lua index e35e781..d27196d 100644 --- a/src/actions/vstudio/vs2005_csproj.lua +++ b/src/actions/vstudio/vs2005_csproj.lua @@ -1,13 +1,22 @@ -- -- vs2005_csproj.lua -- Generate a Visual Studio 2005/2008 C# project. --- Copyright (c) 2009 Jason Perkins and the Premake project +-- Copyright (c) 2009-2010 Jason Perkins and the Premake project -- - -- - -- Figure out what elements a particular source code file need in its item - -- block, based on its build action and any related files in the project. - -- +-- +-- Set up namespaces +-- + + premake.vstudio.cs2005 = { } + local vstudio = premake.vstudio + local cs2005 = premake.vstudio.cs2005 + + +-- +-- Figure out what elements a particular source code file need in its item +-- block, based on its build action and any related files in the project. +-- local function getelements(prj, action, fname) @@ -61,6 +70,32 @@ end +-- +-- Write the opening <Project> element and project level <PropertyGroup> block. +-- + + function cs2005.projectheader(prj) + local vsversion, toolversion + if _ACTION == "vs2005" then + vsversion = "8.0.50727" + toolversion = nil + elseif _ACTION == "vs2008" then + vsversion = "9.0.21022" + toolversion = "3.5" + end + + if toolversion then + _p('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="%s">', toolversion) + else + _p('<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">') + end + end + + +-- +-- The main function: write the project file. +-- + function premake.vs2005_csproj(prj) io.eol = "\r\n" diff --git a/src/base/api.lua b/src/base/api.lua index 5601f23..83a4d88 100644 --- a/src/base/api.lua +++ b/src/base/api.lua @@ -102,6 +102,20 @@ } }, + framework = + { + kind = "string", + scope = "container", + allowed = { + "1.0", + "1.1", + "2.0", + "3.0", + "3.5", + "4.0" + } + }, + imageoptions = { kind = "list", diff --git a/tests/actions/vstudio/test_vs2005_csproj.lua b/tests/actions/vstudio/test_vs2005_csproj.lua new file mode 100644 index 0000000..b300cf5 --- /dev/null +++ b/tests/actions/vstudio/test_vs2005_csproj.lua @@ -0,0 +1,55 @@ +-- +-- tests/actions/test_vs2005_csproj.lua +-- Automated test suite for Visual Studio 2005-2008 C# project generation. +-- Copyright (c) 2010 Jason Perkins and the Premake project +-- + + T.vs2005_csproj = { } + local suite = T.vs2005_csproj + local cs2005 = premake.vstudio.cs2005 + +-- +-- Configure a solution for testing +-- + + local sln, prj + function suite.setup() + _ACTION = "vs2005" + + sln = solution "MySolution" + configurations { "Debug", "Release" } + platforms {} + + prj = project "MyProject" + language "C#" + kind "ConsoleApp" + uuid "AE61726D-187C-E440-BD07-2556188A6565" + end + + local function prepare() + io.capture() + premake.buildconfigs() + end + + +-- +-- Project header tests +-- + + function suite.projectheader_OnVs2005() + _ACTION = "vs2005" + prepare() + cs2005.projectheader(prj) + test.capture [[ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + ]] + end + + function suite.projectheader_OnVs2008() + _ACTION = "vs2008" + prepare() + cs2005.projectheader(prj) + test.capture [[ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + ]] + end diff --git a/tests/premake4.lua b/tests/premake4.lua index 2f03c6a..ff89d37 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -63,6 +63,7 @@ dofile("test_vs2003_sln.lua") dofile("test_vs2005_sln.lua") dofile("test_vs2008_sln.lua") + dofile("actions/vstudio/test_vs2005_csproj.lua") dofile("actions/vstudio/test_vs200x_vcproj.lua") -- Xcode tests |