@@ -25,15 +25,13 @@ rule("platform.windows.idl")
25
25
on_config (function (target )
26
26
local autogendir = path.join (target :autogendir (), " platform/windows/idl" )
27
27
os .mkdir (autogendir )
28
- -- compile rc file maybe require .tlb dir
29
28
target :add (" includedirs" , autogendir , {public = true })
30
29
end )
31
30
32
31
before_buildcmd_file (function (target , batchcmds , sourcefile , opt )
33
32
import (" lib.detect.find_tool" )
34
- import (" core.tool.toolchain" )
35
33
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 " )
37
35
local midl = assert (find_tool (" midl" , {envs = msvc :runenvs (), toolchain = msvc }), " midl not found!" )
38
36
39
37
local name = path.basename (sourcefile )
@@ -42,12 +40,12 @@ rule("platform.windows.idl")
42
40
local flags = {" /nologo" }
43
41
table .join2 (flags , table .wrap (target :values (" idl.flags" )))
44
42
table .join2 (flags , {
45
- " /out" , autogendir ,
43
+ " /out" , path ( autogendir ) ,
46
44
" /header" , name .. " .h" ,
47
45
" /iid" , name .. " _i.c" ,
48
46
" /proxy" , name .. " _p.c" ,
49
47
" /tlb" , name .. " .tlb" ,
50
- sourcefile
48
+ path ( sourcefile )
51
49
})
52
50
53
51
batchcmds :show_progress (opt .progress , " ${color.build.object}compiling.idl %s" , sourcefile )
0 commit comments