Rev 5098 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5098 | Rev 7137 | ||
---|---|---|---|
1 | CFLAGS = "/O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /arch:IA32 /DAUTOBUILD" |
1 | CFLAGS = "/O2 /Os /Oy /GF /GS- /GR- /EHs-c- /fp:fast /GL /QIfist /Gr /arch:IA32 /DAUTOBUILD" |
2 | LDFLAGS = "/section:.bss,E /fixed:no /subsystem:native /merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text /entry:crtStartUp /ltcg /nodefaultlib" |
2 | LDFLAGS = "/section:.bss,E /fixed:no /subsystem:native /merge:.data=.text /merge:.rdata=.text /merge:.1seg=.text /entry:crtStartUp /ltcg /nodefaultlib" |
3 | 3 | ||
4 | THISDIR = tup.getcwd() -- here it points to use_msvc.lua, inside rules it would be just "." |
4 | THISDIR = tup.getcwd() -- here it points to use_msvc.lua, inside rules it would be just "." |
5 | OBJS = {} |
5 | OBJS = {} |
6 | 6 | ||
7 | function compile_msvc(input, output) |
7 | function compile_msvc(input, output) |
8 | if not output then output = '%B.obj' end |
8 | if not output then output = '%B.obj' end |
9 | tup.append_table(OBJS, |
9 | tup.append_table(OBJS, |
10 | tup.foreach_rule(input, "cl /c " .. CFLAGS .. " /Fo%o %f >&2", output) |
10 | tup.foreach_rule(input, "cl /c " .. CFLAGS .. " /Fo%o %f >&2", output) |
11 | ) |
11 | ) |
12 | end |
12 | end |
13 | 13 | ||
14 | if tup.getconfig("TUP_PLATFORM") == "win32" |
14 | if tup.getconfig("TUP_PLATFORM") == "win32" |
15 | then env_prefix = "set EXENAME=%f&&" -- note that there should be no space between value and "&&" |
15 | then env_prefix = "set EXENAME=%f&&" -- note that there should be no space between value and "&&" |
16 | else env_prefix = "EXENAME=%f " |
16 | else env_prefix = "EXENAME=%f " |
17 | end |
17 | end |
18 | 18 | ||
19 | function link_msvc(input, output) |
19 | function link_msvc(input, output) |
20 | if not output then input,output = OBJS,input end |
20 | if not output then input,output = OBJS,input end |
21 | 21 | ||
22 | if type(output) ~= "string" then error("output for link_msvc should be simple string") end |
22 | if type(output) ~= "string" then error("output for link_msvc should be simple string") end |
23 | local exename = output .. ".exe" |
23 | local exename = output .. ".exe" |
24 | local mapname = output .. ".map" |
24 | local mapname = output .. ".map" |
25 | 25 | ||
26 | tup.rule(input, "link.exe " .. LDFLAGS .. " /out:%o /Map:" .. mapname .. " %f", {exename, extra_outputs = {mapname}}) |
26 | tup.rule(input, "link.exe " .. LDFLAGS .. " /out:%o /Map:" .. mapname .. " %f", {exename, extra_outputs = {mapname}}) |
27 | tup.rule(exename, env_prefix .. "fasm " .. THISDIR .. "/../data/eng/doexe2.asm %o " .. tup.getconfig("KPACK_CMD"), output) |
27 | tup.rule(exename, env_prefix .. "fasm " .. THISDIR .. "/../data/common/doexe2.asm %o " .. tup.getconfig("KPACK_CMD"), output) |
28 | end |
28 | end |