2013-05-02 15:21:23 +00:00
|
|
|
--
|
|
|
|
-- actions/vstudio/vs2005.lua
|
|
|
|
-- Add support for the Visual Studio 2005 project formats.
|
2015-03-11 18:46:13 +00:00
|
|
|
-- Copyright (c) 2008-2015 Jason Perkins and the Premake project
|
2013-05-02 15:21:23 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
premake.vstudio.vs2005 = {}
|
2014-02-08 15:44:57 +00:00
|
|
|
|
|
|
|
local p = premake
|
|
|
|
local vs2005 = p.vstudio.vs2005
|
|
|
|
local vstudio = p.vstudio
|
2013-05-02 15:21:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
-- Register a command-line action for Visual Studio 2006.
|
|
|
|
---
|
|
|
|
|
|
|
|
function vs2005.generateSolution(sln)
|
2014-02-08 15:44:57 +00:00
|
|
|
p.indent("\t")
|
|
|
|
p.eol("\r\n")
|
|
|
|
p.escaper(vs2005.esc)
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2013-09-13 15:52:00 +00:00
|
|
|
premake.generate(sln, ".sln", vstudio.sln2005.generate)
|
2013-05-02 15:21:23 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function vs2005.generateProject(prj)
|
2014-02-08 15:44:57 +00:00
|
|
|
p.indent(" ")
|
|
|
|
p.eol("\r\n")
|
|
|
|
p.escaper(vs2005.esc)
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2013-09-13 15:15:36 +00:00
|
|
|
if premake.project.isdotnet(prj) then
|
2013-09-13 15:52:00 +00:00
|
|
|
premake.generate(prj, ".csproj", vstudio.cs2005.generate)
|
2015-03-11 18:46:13 +00:00
|
|
|
premake.generate(prj, ".csproj.user", vstudio.cs2005.generateUser)
|
2013-10-29 05:43:35 +00:00
|
|
|
elseif premake.project.iscpp(prj) then
|
2013-05-02 15:21:23 +00:00
|
|
|
premake.generate(prj, ".vcproj", vstudio.vc200x.generate)
|
2015-03-11 18:46:13 +00:00
|
|
|
premake.generate(prj, ".vcproj.user", vstudio.vc200x.generateUser)
|
2013-05-02 15:21:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-05-22 15:15:48 +00:00
|
|
|
|
|
|
|
---
|
|
|
|
-- Apply XML escaping on a value to be included in an
|
|
|
|
-- exported project file.
|
|
|
|
---
|
|
|
|
|
|
|
|
function vs2005.esc(value)
|
|
|
|
value = string.gsub(value, '&', "&")
|
|
|
|
value = value:gsub('"', """)
|
|
|
|
value = value:gsub("'", "'")
|
|
|
|
value = value:gsub('<', "<")
|
|
|
|
value = value:gsub('>', ">")
|
|
|
|
value = value:gsub('\r', "
")
|
|
|
|
value = value:gsub('\n', "
")
|
|
|
|
return value
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
-- Define the Visual Studio 2005 export action.
|
|
|
|
---
|
|
|
|
|
2013-05-02 15:21:23 +00:00
|
|
|
newaction {
|
|
|
|
-- Metadata for the command line and help system
|
|
|
|
|
|
|
|
trigger = "vs2005",
|
|
|
|
shortname = "Visual Studio 2005",
|
|
|
|
description = "Generate Visual Studio 2005 project files",
|
|
|
|
|
|
|
|
-- Visual Studio always uses Windows path and naming conventions
|
|
|
|
|
|
|
|
os = "windows",
|
|
|
|
|
|
|
|
-- The capabilities of this action
|
|
|
|
|
2013-06-26 11:28:57 +00:00
|
|
|
valid_kinds = { "ConsoleApp", "WindowedApp", "StaticLib", "SharedLib", "Makefile", "None" },
|
2013-05-02 15:21:23 +00:00
|
|
|
valid_languages = { "C", "C++", "C#" },
|
|
|
|
valid_tools = {
|
|
|
|
cc = { "msc" },
|
|
|
|
dotnet = { "msnet" },
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Solution and project generation logic
|
|
|
|
|
2015-01-22 18:14:02 +00:00
|
|
|
onSolution = vstudio.vs2005.generateSolution,
|
|
|
|
onProject = vstudio.vs2005.generateProject,
|
2013-05-02 15:21:23 +00:00
|
|
|
|
2015-01-22 18:14:02 +00:00
|
|
|
onCleanSolution = vstudio.cleanSolution,
|
|
|
|
onCleanProject = vstudio.cleanProject,
|
|
|
|
onCleanTarget = vstudio.cleanTarget,
|
2013-05-02 15:21:23 +00:00
|
|
|
|
|
|
|
-- This stuff is specific to the Visual Studio exporters
|
|
|
|
|
|
|
|
vstudio = {
|
|
|
|
csprojSchemaVersion = "2.0",
|
|
|
|
productVersion = "8.0.50727",
|
|
|
|
solutionVersion = "9",
|
2013-10-29 05:47:39 +00:00
|
|
|
versionName = "2005",
|
2013-05-02 15:21:23 +00:00
|
|
|
}
|
|
|
|
}
|