Fixed naming of system libraries in Visual Studio link step

This commit is contained in:
starkos 2009-06-08 15:36:28 +00:00
parent 1da7795d67
commit 2e920a1ef1
5 changed files with 71 additions and 15 deletions

View File

@ -24,7 +24,8 @@
RC1 -> RC2
- Removed additional MonoDevelop files in clean action.
- Removed additional MonoDevelop files in clean action
- Fixed naming of system libraries in Visual Studio link step
-----

View File

@ -24,8 +24,8 @@ solution "PremakeTestbox"
include "CppStaticLib"
if _ACTION ~= "codeblocks" and _ACTION ~= "codelite" then
include "CsSharedLib"
include "CsConsoleApp"
-- include "CsSharedLib"
-- include "CsConsoleApp"
end

View File

@ -392,8 +392,8 @@
for _, prj in ipairs(sln.projects) do
for _, cfg in pairs(prj.__configs) do
-- determine which conventions the target should follow for this config
local pathstyle = premake.actions[_ACTION].pathstyle or "posix"
local namestyle = premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or "posix"
local pathstyle = premake.getpathstyle(cfg)
local namestyle = premake.getnamestyle(cfg)
-- build the targets
cfg.buildtarget = premake.gettarget(cfg, "build", pathstyle, namestyle, cfg.system)

View File

@ -252,14 +252,17 @@
-- am I getting links for a configuration or a project?
local cfgname = iif(cfg.name == cfg.project.name, "", cfg.name)
-- how should files be named?
local namestyle = premake.getnamestyle(cfg)
local function canlink(source, target)
if (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then return false end
if (source.language == "C" or source.language == "C++") then
if (target.language ~= "C" and target.language ~= "C++") then return false end
return true
elseif (source.language == "C#") then
if (target.language ~= "C#") then return false end
return true
if (target.kind ~= "SharedLib" and target.kind ~= "StaticLib") then
return false
end
if premake.iscppproject(source) then
return premake.iscppproject(target)
elseif premake.isdotnetproject(source) then
return premake.isdotnetproject(target)
end
end
@ -292,8 +295,12 @@
end
elseif (part == "fullpath") then
item = link
if premake.actions[_ACTION].targetstyle == "windows" then
item = item .. iif(cfg.language == "C" or cfg.language == "C++", ".lib", ".dll")
if namestyle == "windows" then
if premake.iscppproject(cfg) then
item = item .. ".lib"
elseif premake.isdotnetproject(cfg) then
item = item .. ".dll"
end
end
if item:find("/", nil, true) then
item = path.getrelative(cfg.basedir, item)
@ -305,7 +312,7 @@
end
if item then
if premake.actions[_ACTION].targetstyle == "windows" and part ~= "object" then
if namestyle == "windows" and part ~= "object" then
item = path.translate(item, "\\")
end
if not table.contains(result, item) then
@ -319,6 +326,22 @@
--
-- Gets the name style for a configuration, indicating what kind of prefix,
-- extensions, etc. should be used in target file names.
--
-- @param cfg
-- The configuration to check.
-- @returns
-- The target naming style, one of "windows", "posix", or "PS3".
--
function premake.getnamestyle(cfg)
return premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or "posix"
end
--
-- Converts a project object and a template filespec (the first value in an
-- action's template reference) into a filename for that template's output.
@ -337,6 +360,21 @@
--
-- Gets the path style for a configuration, indicating what kind of path separator
-- should be used in target file names.
--
-- @param cfg
-- The configuration to check.
-- @returns
-- The target path style, one of "windows" or "posix".
--
function premake.getpathstyle(cfg)
return premake.actions[_ACTION].pathstyle or "posix"
end
--
-- Assembles a target for a particular tool/system/configuration.
--

View File

@ -11,12 +11,29 @@
function T.project.setup()
_ACTION = "gmake"
cfg = {}
cfg.project = {}
cfg.language = "C++"
cfg.files = {}
cfg.trimpaths = {}
cfg.platform = "Native"
result = "\n"
end
--
-- premake.getlinks() tests
--
function T.project.getlinks_OnMscSystemLibs()
_OPTIONS.cc = "msc"
cfg.links = { "user32", "gdi32" }
result = premake.getlinks(cfg, "all", "fullpath")
test.isequal("user32.lib gdi32.lib", table.concat(result, " "))
end
--
-- premake.walksources() tests