[+] Resource compiler based vala run script
This commit is contained in:
parent
2b6bb149e8
commit
027f2f9ce5
@ -60,6 +60,8 @@ local addBuildCommand = function(when, scriptType, path, cwdRelToProject, args)
|
||||
sRelCompilerWd = Aurora.Settings.sRelCompilerWd,
|
||||
sRelWin32 = Aurora.Settings.sRelWin32,
|
||||
sRelUnixBins = Aurora.Settings.sRelUnixBins,
|
||||
sAbsValac = Aurora.Settings.sAbsValac,
|
||||
_punchthrough = Aurora.Settings._punchthrough -- for extended user code
|
||||
}
|
||||
command = command .. " --settings=" .. base64.encode(json.encode(settings))
|
||||
|
||||
|
@ -44,6 +44,14 @@ function resourceExit(exitCode)
|
||||
os.exit(exitCode)
|
||||
end
|
||||
|
||||
function resourceRun(cmd)
|
||||
if (os.host() == "windows") then
|
||||
return os.execute("call " .. cmd)
|
||||
else
|
||||
return os.execute(cmd)
|
||||
end
|
||||
end
|
||||
|
||||
function resourceRunAndExit(cmd)
|
||||
if (os.host() == "windows") then
|
||||
resourceExit(os.execute("call " .. cmd))
|
||||
|
@ -1,33 +1,6 @@
|
||||
local function isWin32()
|
||||
return os.is("Windows")
|
||||
end
|
||||
|
||||
local function findVala()
|
||||
if (isWin32()) then
|
||||
local auValac = Aurora.Settings.sAbsValac or path.join(Aurora.Settings.sAbsWin32, "valac.exe")
|
||||
if (os.isfile(auValac)) then return auValac end
|
||||
|
||||
local drive = path.getdrive(auGetRoot())
|
||||
|
||||
local localDriveClang = drive .. ":\\msys64\\clang64\\bin\\valac.exe"
|
||||
if (os.isfile(localDriveClang)) then return localDriveClang end
|
||||
|
||||
local localDriveMingw = drive .. ":\\msys64\\mingw64\\bin\\valac.exe"
|
||||
if (os.isfile(localDriveMingw)) then return localDriveMingw end
|
||||
|
||||
local localCClang = "C:\\msys64\\clang64\\bin\\valac.exe"
|
||||
if (os.isfile(localCClang)) then return localCClang end
|
||||
|
||||
local localCMingw = "C:\\msys64\\mingw64\\bin\\valac.exe"
|
||||
if (os.isfile(localCMingw)) then return localCMingw end
|
||||
end
|
||||
|
||||
return "vallac"
|
||||
end
|
||||
|
||||
local function addVala(extended)
|
||||
local exec = findVala()
|
||||
|
||||
auFilterForPlatforms(function(platform)
|
||||
local isWin32 = platform == "win32"
|
||||
local args = ""
|
||||
|
||||
local function expandPartialRelDir(partial)
|
||||
@ -56,14 +29,15 @@ local function addVala(extended)
|
||||
local myBrainHurts = false
|
||||
|
||||
local info = auGetCurrentProjectMeta()
|
||||
|
||||
if ((info.projectType:lower() == "sharedlib") or (extended.girFile)) then
|
||||
args = args .. " --library=" .. (extended.name or info.name)
|
||||
if (usingClang) then
|
||||
visibility "Default"
|
||||
else
|
||||
if (isWin32) then
|
||||
args = args .. " --symbols=symbols.CIA"
|
||||
myBrainHurts = true
|
||||
linkoptions {"/def:\"" .. expandPartialNonExistsFile("symbols.def") .. "\""}
|
||||
else
|
||||
visibility "Default"
|
||||
end
|
||||
end
|
||||
|
||||
@ -81,9 +55,13 @@ local function addVala(extended)
|
||||
args = args .. " --header=\"" .. expandPartialNonExistsFile(extended.header) .. "\""
|
||||
end
|
||||
|
||||
|
||||
local resourceFiles = {}
|
||||
local function onSourceFile(partial)
|
||||
local path = expandPartialNonExistsFile(partial)
|
||||
args = args .. " \"".. path .. "\""
|
||||
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)
|
||||
@ -95,13 +73,8 @@ local function addVala(extended)
|
||||
end
|
||||
|
||||
auForEach(extended.sources, onSourcePattern)
|
||||
|
||||
--print(exec, args)
|
||||
auAddBuildAction("pre", "bin", exec, true, args)
|
||||
|
||||
if (myBrainHurts) then
|
||||
auAddBuildAction("pre", "lua", path.translate(path.join(Aurora.Settings.sAbsScripts, "Core", "Vala", "valaSym2Def.lua"), path.getDefaultSeparator()), true)
|
||||
end
|
||||
auAddResource(resourceFiles, {args = args, symHack = myBrainHurts}, path.join(Aurora.Settings.sAbsScripts, "Core", "Vala", "run.lua"))
|
||||
end)
|
||||
end
|
||||
|
||||
return addVala
|
45
Core/Vala/run.lua
Normal file
45
Core/Vala/run.lua
Normal file
@ -0,0 +1,45 @@
|
||||
print("Compiling vala files...")
|
||||
print("Changed: ", json.encode_pretty(auResourceCompiler.changedFiles))
|
||||
print("Unchanged: ", json.encode_pretty(auResourceCompiler.unchangedFiles))
|
||||
|
||||
if (#auResourceCompiler.changedFiles == 0) then return end
|
||||
|
||||
local args = auResourceCompiler.arguments.args
|
||||
|
||||
local function addFile(file)
|
||||
args = args .. " \"" .. file .. "\""
|
||||
end
|
||||
|
||||
auForEach(auResourceCompiler.changedFiles, addFile)
|
||||
auForEach(auResourceCompiler.unchangedFiles, addFile)
|
||||
|
||||
local function findVala()
|
||||
if (os.host() == "windows") then
|
||||
local auValac = Aurora.Settings.sAbsValac or path.join(Aurora.Settings.sAbsWin32, "valac.exe")
|
||||
if (os.isfile(auValac)) then return "\"".. auValac .. "\"" end
|
||||
|
||||
local drive = path.getdrive(auGetRoot())
|
||||
|
||||
local localDriveClang = drive .. ":\\msys64\\clang64\\bin\\valac.exe"
|
||||
if (os.isfile(localDriveClang)) then return localDriveClang end
|
||||
|
||||
local localDriveMingw = drive .. ":\\msys64\\mingw64\\bin\\valac.exe"
|
||||
if (os.isfile(localDriveMingw)) then return localDriveMingw end
|
||||
|
||||
local localCClang = "C:\\msys64\\clang64\\bin\\valac.exe"
|
||||
if (os.isfile(localCClang)) then return localCClang end
|
||||
|
||||
local localCMingw = "C:\\msys64\\mingw64\\bin\\valac.exe"
|
||||
if (os.isfile(localCMingw)) then return localCMingw end
|
||||
end
|
||||
|
||||
return "vallac"
|
||||
end
|
||||
|
||||
local exitCode = resourceRun(findVala() .. " " .. args)
|
||||
|
||||
if (auResourceCompiler.arguments.symHack) then
|
||||
auRequire("Core/Vala/valaSym2Def")
|
||||
end
|
||||
|
||||
resourceExit(exitCode)
|
@ -9,7 +9,7 @@ for s in ciaData:gmatch("[^\r\n]+") do
|
||||
table.insert(exports, s)
|
||||
end
|
||||
|
||||
local dllName = auBuild.projectTargetName .. ".dll"
|
||||
local dllName = auBuild.projectTargetFileName
|
||||
|
||||
local buffer = ""
|
||||
buffer = buffer .. "LIBRARY " .. dllName .. "\r\n"
|
||||
|
Loading…
Reference in New Issue
Block a user