blob: e64142f7c8aba19abafdbc53f12b28e7ed6974ae (
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
|
import("detect.sdks.find_vstudio")
import("core.project.config")
import("core.platform.platform")
import("core.platform.environment")
function test_vsxmake(t)
if os.subhost() ~= "windows" then
return t:skip("wrong host platform")
end
local projname = "testproj"
local tempdir = os.tmpfile()
os.mkdir(tempdir)
os.cd(tempdir)
-- create project
os.runv("xmake", {"create", projname})
os.cd(projname)
-- set config
local arch = os.getenv("platform") or "x86"
config.set("arch", arch, {readonly = true, force = true})
config.check()
platform.load(config.plat())
local vs = config.get("vs")
environment.enter("toolchains")
-- create sln & vcxproj
local vstype = "vsxmake" .. vs
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,
catch
{
function ()
io.write("--- sln file ---\n")
io.cat(projname .. "_" .. vstype .. ".sln")
io.write("--- vcx file ---\n")
io.cat(projname .. "/" .. projname .. ".vcxproj")
io.write("--- filter file ---\n")
io.cat(projname .. "/" .. projname .. ".vcxproj.filters")
raise("msbuild failed")
end
}
}
environment.leave("toolchains")
-- clean up
os.cd(os.scriptdir())
os.tryrm(tempdir)
end
|