Browse Source

Link with LLVMProfileData only if it exists in libdirs.

This library exists only in recent llvm, so adding it to link, breaks windows builds...
Premake do not allow this, so implement StaticLinksOpt in Helpers.lua
pull/235/head
Vladimir Timofeev 11 years ago
parent
commit
cac09f703d
  1. 25
      build/Helpers.lua
  2. 2
      build/LLVM.lua

25
build/Helpers.lua

@ -94,3 +94,28 @@ function IncludeDir(dir) @@ -94,3 +94,28 @@ function IncludeDir(dir)
end
end
end
function StaticLinksOpt(libnames)
local cc = configuration()
local path = table.concat(cc.configset.libdirs, ";")
local formats
if os.is("windows") then
formats = { "%s.lib" }
else
formats = { "lib%s.a" }
end
table.insert(formats, "%s");
local existing_libnames = {}
for _, libname in ipairs(libnames) do
for _, fmt in ipairs(formats) do
local name = string.format(fmt, libname)
if os.pathsearch(name, path) then
table.insert(existing_libnames, libname)
end
end
end
links(existing_libnames)
end

2
build/LLVM.lua

@ -52,7 +52,6 @@ function SetupLLVMLibs() @@ -52,7 +52,6 @@ function SetupLLVMLibs()
"LLVMObjCARCOpts",
"LLVMObject",
"LLVMOption",
"LLVMProfileData",
"LLVMScalarOpts",
"LLVMSupport",
"LLVMTarget",
@ -75,6 +74,7 @@ function SetupLLVMLibs() @@ -75,6 +74,7 @@ function SetupLLVMLibs()
"clangSema",
"clangSerialization",
}
StaticLinksOpt { "LLVMProfileData" }
configuration(c)
end

Loading…
Cancel
Save