summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-24 22:53:35 +0800
committerruki <[email protected]>2020-12-24 22:53:35 +0800
commit5beced53d4ba81070c79a777ac5f5f0233e22e4e (patch)
treeb2c6aa0654e0e68a2a40dc2870928551539b9805 /xmake/modules
parent381e3c74967cfab1c5d42e9ee7fcb68a5a1533f7 (diff)
add vs_runtime config and set_runtimes api
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/core/tools/cl.lua19
-rw-r--r--xmake/modules/core/tools/link.lua7
-rw-r--r--xmake/modules/package/tools/xmake.lua3
3 files changed, 15 insertions, 14 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index ba9e82d84..64d4d2773 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -142,8 +142,6 @@ end
-- make the warning flag
function nf_warning(self, level)
-
- -- the maps
local maps =
{
none = "-W0"
@@ -154,15 +152,11 @@ function nf_warning(self, level)
, everything = "-Wall"
, error = "-WX"
}
-
- -- make it
return maps[level]
end
-- make the optimize flag
function nf_optimize(self, level)
-
- -- the maps
local maps =
{
none = "-Od"
@@ -171,15 +165,18 @@ function nf_optimize(self, level)
, smallest = "-O1 -GL" -- /GL and (/OPT:REF is on by default in linker), we need enable /ltcg
, aggressive = "-Ox -fp:fast"
}
-
- -- make it
return maps[level]
end
+-- make vs runtime flag
+function nf_runtime(self, vs_runtime)
+ if vs_runtime then
+ return "-" .. vs_runtime
+ end
+end
+
-- make the vector extension flag
function nf_vectorext(self, extension)
-
- -- the maps
local maps =
{
sse = "-arch:SSE"
@@ -187,8 +184,6 @@ function nf_vectorext(self, extension)
, avx = "-arch:AVX"
, avx2 = "-arch:AVX2"
}
-
- -- check it
local flag = maps[extension]
if flag and self:has_flags(flag, "cxflags") then
return flag
diff --git a/xmake/modules/core/tools/link.lua b/xmake/modules/core/tools/link.lua
index 844b5d67a..26abc8983 100644
--- a/xmake/modules/core/tools/link.lua
+++ b/xmake/modules/core/tools/link.lua
@@ -96,6 +96,13 @@ function nf_syslink(self, lib)
return nf_link(self, lib)
end
+-- make vs runtime flag
+function nf_runtime(self, vs_runtime)
+ if vs_runtime and vs_runtime:startswith("MT") then
+ return "-nodefaultlib:msvcrt.lib"
+ end
+end
+
-- make the linkdir flag
function nf_linkdir(self, dir)
return "-libpath:" .. os.args(path.translate(dir))
diff --git a/xmake/modules/package/tools/xmake.lua b/xmake/modules/package/tools/xmake.lua
index 84ef7ef5b..391afc4ca 100644
--- a/xmake/modules/package/tools/xmake.lua
+++ b/xmake/modules/package/tools/xmake.lua
@@ -33,8 +33,7 @@ function _get_configs(package, configs)
if package:is_plat("windows") then
local vs_runtime = package:config("vs_runtime")
if vs_runtime then
- local vs_runtime_cxflags = "/" .. vs_runtime .. (package:debug() and "d" or "")
- table.insert(cxflags, vs_runtime_cxflags)
+ table.insert(cxflags, "--vs_runtime=" .. vs_runtime)
end
end
table.insert(configs, "--mode=" .. (package:debug() and "debug" or "release"))