blob: 32fffd33c7e0229584cc695030eb2373a4663f4c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
import("detect.sdks.find_vstudio")
import("core.project.config")
import("core.platform.platform")
import("core.platform.environment")
function test_vsxmake(t)
if os.host() ~= "windows" then
return t:skip("wrong host platform")
end
-- build project
local vs = find_vstudio()
local arch = os.getenv("platform") or "x86"
os.cd("c")
for name, _ in pairs(vs) do
if tonumber(name) >= 2010 then
-- set config
config.set("arch", arch)
config.set("vs", name)
config.check()
platform.load(config.plat())
environment.enter("toolchains")
local vstype = "vsxmake" .. name
-- create sln & vcxproj
os.execv("xmake", {"project", "-k", vstype, "-a", arch})
os.cd(vstype)
-- run msbuild
try
{
function ()
os.exec("msbuild /P:XmakeDiagnosis=true /P:XmakeVerbose=true")
end,
finally
{
function (ok)
if ok then
return
end
io.write("--- sln file ---\n")
io.write(io.readfile("c_" .. vstype .. ".sln"), "\n")
io.write("--- vcx file ---\n")
io.write(io.readfile("project/project.vcxproj"), "\n")
io.write("--- filter file ---\n")
io.write(io.readfile("project/project.vcxproj.filters"), "\n")
raise("msbuild failed")
end
}
}
environment.leave("toolchains")
-- clean up
os.cd("..")
os.tryrm(vstype)
end
end
os.cd("..")
end
|