Applied patch which sets the target machine in visual studio

This commit is contained in:
liamDevine 2011-05-01 03:09:27 +01:00
parent 5ec9f16415
commit adb2529b61
3 changed files with 44 additions and 4 deletions

View File

@ -10,7 +10,7 @@
* Ignore NoRTTI flag for Managed C++ projects (Nick Darnell)
* Added host.is64bit
* Added os.getversion
* Patch 3140456: Explicitly specify architecture for vs StaticLib (Brian Mazza)
-------
4.3.1 (in progress)

View File

@ -29,7 +29,6 @@
--
-- Return the optimization code.
-- (this should probably go in vs200x_vcproj.lua)
--
function vc200x.optimization(cfg)
@ -395,8 +394,15 @@
_p(4,'AdditionalLibraryDirectories="%s"', premake.esc(path.translate(table.concat(cfg.libdirs , ";"))))
end
if #cfg.linkoptions > 0 then
_p(4,'AdditionalOptions="%s"', table.concat(premake.esc(cfg.linkoptions), " "))
local addlOptions = {}
if cfg.platform == "x32" then
table.insert(addlOptions, "/MACHINE:X86")
elseif cfg.platform == "x64" then
table.insert(addlOptions, "/MACHINE:X64")
end
addlOptions = table.join(addlOptions, cfg.linkoptions)
if #addlOptions > 0 then
_p(4,'AdditionalOptions="%s"', table.concat(premake.esc(addlOptions), " "))
end
end

View File

@ -668,3 +668,37 @@
local result = io.endcapture()
test.string_contains(result,'LinkIncremental="1"')
end
function suite.staticLib_platformX64_MachineX64SetInAdditionalOptions()
local sln1 = solution "sol"
configurations { "foo" }
platforms {'x64'}
local prj1 = project "prj"
language 'C++'
kind 'StaticLib'
premake.buildconfigs()
sln1.vstudio_configs = premake.vstudio.buildconfigs(sln1)
prj1= premake.getconfig(sln1.projects[1])
vc200x.generate(prj1)
local result = io.endcapture()
test.string_contains(result,'AdditionalOptions="/MACHINE:X64"')
end
function suite.staticLib_platformX32_MachineX86SetInAdditionalOptions()
local sln1 = solution "sol"
configurations { "foo" }
platforms {'x32'}
local prj1 = project "prj"
language 'C++'
kind 'StaticLib'
premake.buildconfigs()
sln1.vstudio_configs = premake.vstudio.buildconfigs(sln1)
prj1= premake.getconfig(sln1.projects[1])
vc200x.generate(prj1)
local result = io.endcapture()
test.string_contains(result,'AdditionalOptions="/MACHINE:X86"')
end