summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.ninja4
-rw-r--r--configure.lua19
2 files changed, 18 insertions, 5 deletions
diff --git a/build.ninja b/build.ninja
index 86492d1..541cca9 100644
--- a/build.ninja
+++ b/build.ninja
@@ -1,13 +1,13 @@
# generated by configure.lua
-cflags = /nologo /Z7 /DDEBUG /MD /std:c++20 /Isc\glslang /Iqstd /Icfg /Dplat_win /Dplat_x86 /Dallocation_default_alignment=8
+cflags = /nologo /MD /std:c++20 /Isc\glslang /Iqstd /Icfg /Dplat_win /Dplat_x86 /Dallocation_default_alignment=8 /O2 /DNDEBUG
rule cpp
command = cl $cflags $in /c /Fo: "$out"
deps = msvc
rule link
- command = cl /nologo $in /Fe: "$out" /link /DEBUG $libs
+ command = cl /nologo $in /Fe: "$out" /link $libs
rule lib
command = lib /nologo $in /out:"$out"
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