diff options
Diffstat (limited to 'configure.lua')
-rw-r--r-- | configure.lua | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/configure.lua b/configure.lua index cffd61e..d9fc7ec 100644 --- a/configure.lua +++ b/configure.lua @@ -395,6 +395,11 @@ if system == "unix" then end if system == "windows" then + local configuration = arg[2] + if system ~= "release" or system ~= "debug" then + print("Invalid configuration, defaulting to release.") + end + local outfile = io.open("build.ninja", "w") if not outfile then print("Failed to open build.ninja.") @@ -471,13 +476,21 @@ if system == "windows" then end outfile:write("| packer.exe\n") end - outfile:write("cflags = /nologo /Z7 /DDEBUG /MD /std:c++20 /Isc\\glslang /Iqstd /Icfg /Dplat_win /Dplat_x86 /Dallocation_default_alignment=8\n") - outfile:write("\n") + local cflags = "cflags = /nologo /MD /std:c++20 /Isc\\glslang /Iqstd /Icfg /Dplat_win /Dplat_x86 /Dallocation_default_alignment=8" + local lflags = "" + if configuration == "debug" then + cflags = cflags .. " /Z7 /DDEBUG" + lflags = lflags .. "/DEBUG" + else + cflags = cflags .. " /O2 /DNDEBUG" + end + outfile:write(cflags) + outfile:write("\n\n") outfile:write("rule cpp\n") outfile:write(" command = cl $cflags $in /c /Fo: \"$out\"\n") outfile:write(" deps = msvc\n\n") outfile:write("rule link\n") - outfile:write(" command = cl /nologo $in /Fe: \"$out\" /link /DEBUG $libs\n\n") + outfile:write(" command = cl /nologo $in /Fe: \"$out\" /link " .. lflags .." $libs\n\n") outfile:write("rule lib\n") outfile:write(" command = lib /nologo $in /out:\"$out\"\n\n") for _, fname in ipairs(config.c2) do |