Bug fixes to PS3 makefiles, adding missing msc.lua file

This commit is contained in:
starkos 2009-05-12 21:44:45 +00:00
parent 6c73ced855
commit 8fe0c84931
8 changed files with 64 additions and 14 deletions

View File

@ -160,7 +160,7 @@
end
if cfg.kind == "SharedLib" then
local implibname = path.translate(premake.gettarget(cfg, "link", "windows").fullpath, "\\")
local implibname = cfg.linktarget.fullpath
_p('\t\t\t\tImportLibrary="%s"', iif(cfg.flags.NoImportLib, cfg.objectsdir .. "\\" .. path.getname(implibname), implibname))
end

View File

@ -387,7 +387,7 @@
-- Pre-computes the build and link targets for a configuration.
--
function premake.configs_buildtargets()
local function buildtargets()
for _, sln in ipairs(_SOLUTIONS) do
for _, prj in ipairs(sln.projects) do
for _, cfg in pairs(prj.__configs) do
@ -443,6 +443,6 @@
builduniquedirs()
-- walk it again and build the targets and unique directories
premake.configs_buildtargets(cfg)
buildtargets(cfg)
end

View File

@ -437,8 +437,14 @@
function premake.gettool(cfg)
if premake.iscppproject(cfg) then
if not _OPTIONS.cc then _OPTIONS.cc = premake.actions[_ACTION].valid_tools.cc[1] end
return premake[_OPTIONS.cc]
if _OPTIONS.cc then
return premake[_OPTIONS.cc]
end
local action = premake.actions[_ACTION]
if action.valid_tools then
return premake[action.valid_tools.cc[1]]
end
return premake.gcc
else
return premake.dotnet
end

File diff suppressed because one or more lines are too long

View File

@ -94,7 +94,7 @@
function premake.gcc.getcflags(cfg)
local result = table.translate(cfg.flags, cflags)
table.insert(result, platforms[cfg.platform].flags)
if cfg.system == "Windows" and cfg.kind == "SharedLib" then
if cfg.system ~= "windows" and cfg.kind == "SharedLib" then
table.insert(result, "-fPIC")
end
return result
@ -117,7 +117,7 @@
-- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
if not cfg.flags.Symbols then
if cfg.system == "MacOSX" then
if cfg.system == "macosx" then
table.insert(result, "-Wl,-x")
else
table.insert(result, "-s")
@ -125,19 +125,19 @@
end
if cfg.kind == "SharedLib" then
if cfg.system == "MacOSX" then
if cfg.system == "macosx" then
result = table.join(result, { "-dynamiclib", "-flat_namespace" })
else
table.insert(result, "-shared")
end
if cfg.system == "Windows" and not cfg.flags.NoImportLib then
if cfg.system == "windows" and not cfg.flags.NoImportLib then
table.insert(result, '-Wl,--out-implib="'..premake.gettarget(cfg, "link", "linux").fullpath..'"')
end
end
if cfg.kind == "WindowedApp" then
if cfg.system == "Windows" then
if cfg.system == "windows" then
table.insert(result, "-mwindows")
end
end

9
src/tools/msc.lua Normal file
View File

@ -0,0 +1,9 @@
--
-- msc.lua
-- Interface for the MS C/C++ compiler.
-- Copyright (c) 2009 Jason Perkins and the Premake project
--
premake.msc = { }
premake.msc.targetstyle = "windows"

View File

@ -17,6 +17,7 @@
dofile("test_api.lua")
dofile("test_targets.lua")
dofile("test_keywords.lua")
dofile("test_gcc.lua")
dofile("test_vs2002_sln.lua")
dofile("test_vs2003_sln.lua")
dofile("test_vs2005_sln.lua")

34
tests/test_gcc.lua Normal file
View File

@ -0,0 +1,34 @@
--
-- tests/test_gcc.lua
-- Automated test suite for the GCC toolset interface.
-- Copyright (c) 2009 Jason Perkins and the Premake project
--
T.gcc = { }
local cfg
function T.gcc.setup()
cfg = { }
cfg.basedir = "."
cfg.location = "."
cfg.language = "C++"
cfg.project = { name = "MyProject" }
cfg.flags = { }
cfg.objectsdir = "obj"
cfg.platform = "Native"
end
function T.gcc.cflags_SharedLib_Windows()
cfg.kind = "SharedLib"
cfg.system = "windows"
local r = premake.gcc.getcflags(cfg)
test.isequal('', table.concat(r,"|"))
end
function T.gcc.ldflags_SharedLib_Windows()
cfg.kind = "SharedLib"
cfg.system = "windows"
local r = premake.gcc.getldflags(cfg)
test.isequal('-s|-shared|-Wl,--out-implib="libMyProject.a"', table.concat(r,"|"))
end