summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-05-13 22:21:48 +0800
committerruki <[email protected]>2018-05-13 22:21:48 +0800
commit785a6f3054395d17db85812896308ec5cd27691c (patch)
tree5ca635f75912181c6976197298e8fbd0e37bd49d
parent4fd5668b925ee315389808673539dd8e430f35b2 (diff)
check mofcomp and wmimofck
-rw-r--r--xmake/rules/wdk/mof/xmake.lua26
1 files changed, 20 insertions, 6 deletions
diff --git a/xmake/rules/wdk/mof/xmake.lua b/xmake/rules/wdk/mof/xmake.lua
index 0e1678a54..75a555834 100644
--- a/xmake/rules/wdk/mof/xmake.lua
+++ b/xmake/rules/wdk/mof/xmake.lua
@@ -36,16 +36,27 @@ rule("wdk.mof")
-- imports
import("core.project.config")
+ import("lib.detect.find_program")
-- get arch
local arch = assert(config.arch(), "arch not found!")
-
+
-- get mofcomp
- local mofcomp = path.join(target:data("wdk").bindir, arch, is_host("windows") and "mofcomp.exe" or "mofcomp")
- assert(mofcomp and os.isexec(mofcomp), "mofcomp not found!")
+ local mofcomp = find_program("mofcomp", {check = function (program)
+ local tmpmof = os.tmpfile()
+ io.writefile(tmpmof, "")
+ os.run("%s %s", program, tmpmof)
+ os.tryrm(tmpmof)
+ end})
+ assert(mofcomp, "mofcomp not found!")
- -- save mofcomp
+ -- get wmimofck
+ local wmimofck = path.join(target:data("wdk").bindir, "x86", arch, is_host("windows") and "wmimofck.exe" or "wmimofck")
+ assert(wmimofck and os.isexec(wmimofck), "wmimofck not found!")
+
+ -- save mofcomp and wmimofck
target:data_set("wdk.mofcomp", mofcomp)
+ target:data_set("wdk.wmimofck", wmimofck)
-- save output directory
target:data_set("wdk.mof.outputdir", path.join(config.buildir(), ".wdk", "mof", config.get("mode") or "generic", config.get("arch") or os.arch(), target:name()))
@@ -61,6 +72,9 @@ rule("wdk.mof")
-- get mofcomp
local mofcomp = target:data("wdk.mofcomp")
+ -- get wmimofck
+ local wmimofck = target:data("wdk.wmimofck")
+
-- get output directory
local outputdir = target:data("wdk.mof.outputdir")
@@ -90,12 +104,12 @@ rule("wdk.mof")
cprint("${green}[%02d%%]:${clear} compiling.wdk.mof %s", opt.progress, sourcefile)
end
- -- do mofcomp
+ -- do wmimofck
--[[
if not os.isdir(outputdir) then
os.mkdir(outputdir)
end
- os.vrunv(mofcomp, args)
+ os.vrunv(wmimofck, args)
]]
-- update files and values to the dependent file