Skip to content

Commit c9f6541

Browse files
committed
Improve idl rule
1 parent f80d66c commit c9f6541

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

xmake/modules/detect/tools/find_midl.lua

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import("lib.detect.find_programver")
3030
-- @return program, version
3131
--
3232
-- @code
33-
--
3433
-- local midl = find_midl()
35-
--
3634
-- @endcode
3735
--
3836
function main(opt)

xmake/rules/platform/windows/idl/xmake.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ rule("platform.windows.idl")
2525
on_config(function (target)
2626
local autogendir = path.join(target:autogendir(), "platform/windows/idl")
2727
os.mkdir(autogendir)
28-
-- compile rc file maybe require .tlb dir
2928
target:add("includedirs", autogendir, {public = true})
3029
end)
3130

3231
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
3332
import("lib.detect.find_tool")
34-
import("core.tool.toolchain")
3533

36-
local msvc = toolchain.load("msvc", {plat = os.host(), arch = os.arch()})
34+
local msvc = target:toolchain("msvc") or target:toolchain("clang-cl") or target:toolchain("clang")
3735
local midl = assert(find_tool("midl", {envs = msvc:runenvs(), toolchain = msvc}), "midl not found!")
3836

3937
local name = path.basename(sourcefile)
@@ -42,12 +40,12 @@ rule("platform.windows.idl")
4240
local flags = {"/nologo"}
4341
table.join2(flags, table.wrap(target:values("idl.flags")))
4442
table.join2(flags, {
45-
"/out", autogendir,
43+
"/out", path(autogendir),
4644
"/header", name .. ".h",
4745
"/iid", name .. "_i.c",
4846
"/proxy", name .. "_p.c",
4947
"/tlb", name .. ".tlb",
50-
sourcefile
48+
path(sourcefile)
5149
})
5250

5351
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.idl %s", sourcefile)

0 commit comments

Comments
 (0)