Build/Core/Vala/Vala.lua

80 lines
2.6 KiB
Lua

local function addVala(extended)
auFilterForPlatforms(function(platform)
local isWin32 = platform == "win32"
local args = ""
local function expandPartialRelDir(partial)
return os.realpath(partial) --path.translate(path.join(os.getcwd(), partial), path.getDefaultSeparator())
end
local function expandPartialNonExistsFile(partial)
return path.translate(path.join(os.getcwd(), partial), path.getDefaultSeparator())
end
local function onGir(partial)
args = args .. " --girdir=\"" .. expandPartialRelDir(partial) .. "\""
end
local function onVApi(partial)
args = args .. " --vapidir=\"" .. expandPartialRelDir(partial) .. "\""
end
auForEach(extended.gir, onGir)
auForEach(extended.vapi, onVApi)
if (extended.girFile) then
args = args .. " --gir=" .. extended.girFile
end
local myBrainHurts = false
local info = auGetCurrentProjectMeta()
if ((info.projectType:lower() == "sharedlib") or (extended.girFile)) then
args = args .. " --library=" .. (extended.name or info.name)
if (isWin32) then
args = args .. " --symbols=symbols.CIA"
myBrainHurts = true
linkoptions {"/def:\"" .. expandPartialNonExistsFile("symbols.def") .. "\""}
else
visibility "Default"
end
end
local function onPackage(pkg)
args = args .. " --pkg=" .. pkg
end
auForEach(extended.package, onPackage)
args = args .. " --directory=\"" .. os.getcwd() .. "\""
args = args .. " --ccode"
if (extended.header) then
args = args .. " --header=\"" .. expandPartialNonExistsFile(extended.header) .. "\""
end
local resourceFiles = {}
local function onSourceFile(partial)
local path = expandPartialNonExistsFile(partial) -- eh? didnt't we just use matchfiles?
--args = args .. " \"".. path .. "\""
table.insert(resourceFiles, path)
local cfile = path:gsub("%.vala", "") .. ".c"
files(cfile)
files(path)
end
local function onSourcePattern(pattern)
auForEach(os.matchfiles(pattern), onSourceFile)
end
auForEach(extended.sources, onSourcePattern)
auAddResource(resourceFiles, {args = args, symHack = myBrainHurts}, path.join(Aurora.Settings.sAbsScripts, "Core", "Vala", "run.lua"))
end)
end
return addVala