summaryrefslogtreecommitdiff
path: root/xmake/rules/vala/xmake.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-07-29 22:48:49 +0800
committerruki <[email protected]>2021-07-29 22:48:49 +0800
commit8a7d3983299862ccb2c1565f91a378ef4586eabf (patch)
treecbd39029ecfddbb87b36d28df1a7ac25899a244a /xmake/rules/vala/xmake.lua
parente2067d1b58aeec0024ac2f52e7599a4893b15f14 (diff)
improve vala rule
Diffstat (limited to 'xmake/rules/vala/xmake.lua')
-rw-r--r--xmake/rules/vala/xmake.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/xmake/rules/vala/xmake.lua b/xmake/rules/vala/xmake.lua
index 6de49665c..a2ce76937 100644
--- a/xmake/rules/vala/xmake.lua
+++ b/xmake/rules/vala/xmake.lua
@@ -20,6 +20,13 @@
rule("vala")
set_extensions(".vala")
+ on_load(function (target)
+ -- only vala source files? we need patch c source kind for linker
+ local sourcekinds = target:sourcekinds()
+ if #sourcekinds == 0 then
+ table.insert(sourcekinds, "cc")
+ end
+ end)
before_buildcmd_file(function (target, batchcmds, sourcefile_vala, opt)
-- get valac
@@ -27,7 +34,7 @@ rule("vala")
local valac = assert(find_tool("valac"), "valac not found!")
-- get c source file for vala
- local sourcefile_c = path.join(target:autogendir(), "rules", "vala", path.basename(sourcefile_vala) .. ".c")
+ local sourcefile_c = target:autogenfile((sourcefile_vala:gsub(".vala$", ".c")))
local basedir = path.directory(sourcefile_c)
-- add objectfile