Initial support for VC 2008 Makefile projects
This commit is contained in:
parent
5e4993b1d3
commit
fe1b37c9ae
@ -86,27 +86,42 @@
|
|||||||
_p(1,'ProjectGUID="{%s}"', prj.uuid)
|
_p(1,'ProjectGUID="{%s}"', prj.uuid)
|
||||||
|
|
||||||
-- try to determine what kind of targets we're building here
|
-- try to determine what kind of targets we're building here
|
||||||
local isWin, isPS3, isManaged
|
local isWin, isPS3, isManaged, isMakefile
|
||||||
for cfg in project.eachconfig(prj) do
|
for cfg in project.eachconfig(prj) do
|
||||||
if cfg.system == premake.WINDOWS then
|
if cfg.system == premake.WINDOWS then
|
||||||
isWin = true
|
isWin = true
|
||||||
elseif cfg.system == premake.PS3 then
|
end
|
||||||
|
if cfg.system == premake.PS3 then
|
||||||
isPS3 = true
|
isPS3 = true
|
||||||
end
|
end
|
||||||
if cfg.flags.Managed then
|
if cfg.flags.Managed then
|
||||||
isManaged = true
|
isManaged = true
|
||||||
end
|
end
|
||||||
|
if cfg.kind == premake.MAKEFILE then
|
||||||
|
isMakefile = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if isWin then
|
if isWin then
|
||||||
if _ACTION > "vs2003" then
|
if _ACTION > "vs2003" and not isMakefile then
|
||||||
_x(1,'RootNamespace="%s"', prj.name)
|
_x(1,'RootNamespace="%s"', prj.name)
|
||||||
end
|
end
|
||||||
_p(1,'Keyword="%s"', iif(isManaged, "ManagedCProj", "Win32Proj"))
|
|
||||||
_p(1,'TargetFrameworkVersion="0"')
|
local keyword = "Win32Proj"
|
||||||
elseif isPS3 then
|
if isManaged then
|
||||||
_p(1,'TargetFrameworkVersion="196613"')
|
keyword = "ManagedCProj"
|
||||||
end
|
end
|
||||||
|
if isMakefile then
|
||||||
|
keyword = "MakeFileProj"
|
||||||
|
end
|
||||||
|
_p(1,'Keyword="%s"', keyword)
|
||||||
|
end
|
||||||
|
|
||||||
|
local version = 0
|
||||||
|
if isMakefile or not isWin then
|
||||||
|
version = 196613
|
||||||
|
end
|
||||||
|
_p(1,'TargetFrameworkVersion="%d"', version)
|
||||||
|
|
||||||
_p(1,'>')
|
_p(1,'>')
|
||||||
end
|
end
|
||||||
@ -154,15 +169,7 @@
|
|||||||
local objdir = project.getrelative(cfg.project, cfg.objdir)
|
local objdir = project.getrelative(cfg.project, cfg.objdir)
|
||||||
_x(3,'IntermediateDirectory="%s"', path.translate(objdir))
|
_x(3,'IntermediateDirectory="%s"', path.translate(objdir))
|
||||||
|
|
||||||
local cfgtype
|
vc200x.configurationType(cfg)
|
||||||
if (cfg.kind == "SharedLib") then
|
|
||||||
cfgtype = 2
|
|
||||||
elseif (cfg.kind == "StaticLib") then
|
|
||||||
cfgtype = 4
|
|
||||||
else
|
|
||||||
cfgtype = 1
|
|
||||||
end
|
|
||||||
_p(3,'ConfigurationType="%s"', cfgtype)
|
|
||||||
|
|
||||||
if (cfg.flags.MFC) then
|
if (cfg.flags.MFC) then
|
||||||
_p(3, 'UseOfMFC="%d"', iif(cfg.flags.StaticRuntime, 1, 2))
|
_p(3, 'UseOfMFC="%d"', iif(cfg.flags.StaticRuntime, 1, 2))
|
||||||
@ -206,6 +213,11 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
function vc200x.toolsForConfig(cfg)
|
function vc200x.toolsForConfig(cfg)
|
||||||
|
if cfg.kind == premake.MAKEFILE then
|
||||||
|
return {
|
||||||
|
"VCNMakeTool"
|
||||||
|
}
|
||||||
|
end
|
||||||
if _ACTION == "vs2002" then
|
if _ACTION == "vs2002" then
|
||||||
return {
|
return {
|
||||||
"VCCLCompilerTool",
|
"VCCLCompilerTool",
|
||||||
@ -595,6 +607,23 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function vc200x.VCNMakeTool(cfg)
|
||||||
|
_p(3,'<Tool')
|
||||||
|
_p(4,'Name="VCNMakeTool"')
|
||||||
|
_p(4,'BuildCommandLine=""')
|
||||||
|
_p(4,'ReBuildCommandLine=""')
|
||||||
|
_p(4,'CleanCommandLine=""')
|
||||||
|
vc200x.nmakeOutput(cfg)
|
||||||
|
_p(4,'PreprocessorDefinitions=""')
|
||||||
|
_p(4,'IncludeSearchPath=""')
|
||||||
|
_p(4,'ForcedIncludes=""')
|
||||||
|
_p(4,'AssemblySearchPath=""')
|
||||||
|
_p(4,'ForcedUsingAssemblies=""')
|
||||||
|
_p(4,'CompileAsManaged=""')
|
||||||
|
_p(3,'/>')
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function vc200x.VCResourceCompilerTool(cfg)
|
function vc200x.VCResourceCompilerTool(cfg)
|
||||||
_p(3,'<Tool')
|
_p(3,'<Tool')
|
||||||
_p(4,'Name="VCResourceCompilerTool"')
|
_p(4,'Name="VCResourceCompilerTool"')
|
||||||
@ -670,6 +699,7 @@
|
|||||||
VCLinkerTool = vc200x.VCLinkerTool,
|
VCLinkerTool = vc200x.VCLinkerTool,
|
||||||
VCManifestTool = vc200x.VCManifestTool,
|
VCManifestTool = vc200x.VCManifestTool,
|
||||||
VCMIDLTool = vc200x.VCMIDLTool,
|
VCMIDLTool = vc200x.VCMIDLTool,
|
||||||
|
VCNMakeTool = vc200x.VCNMakeTool,
|
||||||
VCPostBuildEventTool = vc200x.VCPostBuildEventTool,
|
VCPostBuildEventTool = vc200x.VCPostBuildEventTool,
|
||||||
VCPreBuildEventTool = vc200x.VCPreBuildEventTool,
|
VCPreBuildEventTool = vc200x.VCPreBuildEventTool,
|
||||||
VCPreLinkEventTool = vc200x.VCPreLinkEventTool,
|
VCPreLinkEventTool = vc200x.VCPreLinkEventTool,
|
||||||
@ -879,8 +909,10 @@
|
|||||||
|
|
||||||
|
|
||||||
function vc200x.characterSet(cfg)
|
function vc200x.characterSet(cfg)
|
||||||
|
if cfg.kind ~= premake.MAKEFILE then
|
||||||
_p(3,'CharacterSet="%s"', iif(cfg.flags.Unicode, 1, 2))
|
_p(3,'CharacterSet="%s"', iif(cfg.flags.Unicode, 1, 2))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function vc200x.compileAs(filecfg, depth)
|
function vc200x.compileAs(filecfg, depth)
|
||||||
@ -904,6 +936,16 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function vc200x.configurationType(cfg)
|
||||||
|
local cfgtypes = {
|
||||||
|
Makefile = 0,
|
||||||
|
SharedLib = 2,
|
||||||
|
StaticLib = 4,
|
||||||
|
}
|
||||||
|
_p(3,'ConfigurationType="%s"', cfgtypes[cfg.kind] or 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function vc200x.customBuildTool(filecfg, depth)
|
function vc200x.customBuildTool(filecfg, depth)
|
||||||
if filecfg.buildrule then
|
if filecfg.buildrule then
|
||||||
_x(depth, 'CommandLine="%s"', table.concat(filecfg.buildrule.commands,'\r\n'))
|
_x(depth, 'CommandLine="%s"', table.concat(filecfg.buildrule.commands,'\r\n'))
|
||||||
@ -943,6 +985,11 @@
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function vc200x.nmakeOutput(cfg)
|
||||||
|
_p(4,'Output="$(OutDir)%s"', cfg.buildtarget.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function vc200x.objectFile(filecfg, depth)
|
function vc200x.objectFile(filecfg, depth)
|
||||||
if path.iscppfile(filecfg.name) then
|
if path.iscppfile(filecfg.name) then
|
||||||
local objectName = project.getfileobject(filecfg.project, filecfg.abspath)
|
local objectName = project.getfileobject(filecfg.project, filecfg.abspath)
|
||||||
|
@ -89,3 +89,22 @@
|
|||||||
OutputDirectory="..\bin"
|
OutputDirectory="..\bin"
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Makefiles set the configuration type and drop the
|
||||||
|
-- character encoding.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.defaultSettings()
|
||||||
|
kind "Makefile"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="."
|
||||||
|
IntermediateDirectory="obj\Debug"
|
||||||
|
ConfigurationType="0"
|
||||||
|
>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
69
tests/actions/vstudio/vc200x/test_nmake_settings.lua
Normal file
69
tests/actions/vstudio/vc200x/test_nmake_settings.lua
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
--
|
||||||
|
-- tests/actions/vstudio/vc200x/test_nmake_settings.lua
|
||||||
|
-- Validate generation the VCNMakeTool element in Visual Studio 200x C/C++ projects.
|
||||||
|
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||||
|
--
|
||||||
|
|
||||||
|
local suite = test.declare("vs200x_nmake_settings")
|
||||||
|
local vc200x = premake.vstudio.vc200x
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Setup/teardown
|
||||||
|
--
|
||||||
|
|
||||||
|
local sln, prj, cfg
|
||||||
|
|
||||||
|
function suite.setup()
|
||||||
|
_ACTION = "vs2008"
|
||||||
|
sln = test.createsolution()
|
||||||
|
kind "Makefile"
|
||||||
|
end
|
||||||
|
|
||||||
|
local function prepare()
|
||||||
|
prj = premake.solution.getproject_ng(sln, 1)
|
||||||
|
cfg = premake5.project.getconfig(prj, "Debug")
|
||||||
|
vc200x.VCNMakeTool(cfg)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Verify the basic structure of the compiler block with no flags or settings.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.onDefaultSettings()
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<Tool
|
||||||
|
Name="VCNMakeTool"
|
||||||
|
BuildCommandLine=""
|
||||||
|
ReBuildCommandLine=""
|
||||||
|
CleanCommandLine=""
|
||||||
|
Output="$(OutDir)MyProject"
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
IncludeSearchPath=""
|
||||||
|
ForcedIncludes=""
|
||||||
|
AssemblySearchPath=""
|
||||||
|
ForcedUsingAssemblies=""
|
||||||
|
CompileAsManaged=""
|
||||||
|
/>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Make sure the target file extension is included.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.usesTargetExtension()
|
||||||
|
targetextension ".exe"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<Tool
|
||||||
|
Name="VCNMakeTool"
|
||||||
|
BuildCommandLine=""
|
||||||
|
ReBuildCommandLine=""
|
||||||
|
CleanCommandLine=""
|
||||||
|
Output="$(OutDir)MyProject.exe"
|
||||||
|
]]
|
||||||
|
end
|
@ -131,3 +131,23 @@
|
|||||||
>
|
>
|
||||||
]]
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Makefile projects set new keyword and drop the root namespace.
|
||||||
|
--
|
||||||
|
|
||||||
|
function suite.keywordIsCorrect_onMakefile()
|
||||||
|
kind "Makefile"
|
||||||
|
prepare()
|
||||||
|
test.capture [[
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="MyProject"
|
||||||
|
ProjectGUID="{AE61726D-187C-E440-BD07-2556188A6565}"
|
||||||
|
Keyword="MakeFileProj"
|
||||||
|
TargetFrameworkVersion="196613"
|
||||||
|
>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
local sln, prj, cfg
|
local sln, prj, cfg
|
||||||
|
|
||||||
function suite.setup()
|
function suite.setup()
|
||||||
|
_ACTION = "vs2010"
|
||||||
sln = test.createsolution()
|
sln = test.createsolution()
|
||||||
kind "Makefile"
|
kind "Makefile"
|
||||||
end
|
end
|
||||||
|
@ -123,6 +123,7 @@
|
|||||||
dofile("actions/vstudio/vc200x/test_files.lua")
|
dofile("actions/vstudio/vc200x/test_files.lua")
|
||||||
dofile("actions/vstudio/vc200x/test_linker_block.lua")
|
dofile("actions/vstudio/vc200x/test_linker_block.lua")
|
||||||
dofile("actions/vstudio/vc200x/test_manifest_block.lua")
|
dofile("actions/vstudio/vc200x/test_manifest_block.lua")
|
||||||
|
dofile("actions/vstudio/vc200x/test_nmake_settings.lua")
|
||||||
dofile("actions/vstudio/vc200x/test_platforms.lua")
|
dofile("actions/vstudio/vc200x/test_platforms.lua")
|
||||||
dofile("actions/vstudio/vc200x/test_project.lua")
|
dofile("actions/vstudio/vc200x/test_project.lua")
|
||||||
dofile("actions/vstudio/vc200x/test_project_refs.lua")
|
dofile("actions/vstudio/vc200x/test_project_refs.lua")
|
||||||
|
Loading…
Reference in New Issue
Block a user