summaryrefslogtreecommitdiff
path: root/xmake/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2022-11-05 00:57:10 +0800
committerruki <[email protected]>2022-11-05 00:57:10 +0800
commit4889bfdb1fc75dfaa90a702f26d07715cb592d15 (patch)
tree8eed62eb4c116e9068a1a151924e4db63f7ac0c1 /xmake/modules
parent5cf20abdd48b4dfe645a9564975f4367e4494240 (diff)
add set_exceptions
Diffstat (limited to 'xmake/modules')
-rw-r--r--xmake/modules/core/tools/cl.lua13
-rw-r--r--xmake/modules/core/tools/gcc.lua21
2 files changed, 34 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua
index 7cce576ae..a20e4d85b 100644
--- a/xmake/modules/core/tools/cl.lua
+++ b/xmake/modules/core/tools/cl.lua
@@ -298,6 +298,19 @@ function nf_sysincludedir(self, dir)
end
end
+-- make the exception flag
+--
+-- e.g.
+-- set_exceptions("cxx")
+-- set_exceptions("no-cxx")
+function nf_exception(self, exp)
+ local maps = {
+ cxx = "/EHsc",
+ ["no-cxx"] = "/EHsc-"
+ }
+ return maps[exp]
+end
+
-- make the c precompiled header flag
function nf_pcheader(self, pcheaderfile, target)
diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua
index a3888ac34..cd11743c7 100644
--- a/xmake/modules/core/tools/gcc.lua
+++ b/xmake/modules/core/tools/gcc.lua
@@ -302,6 +302,27 @@ function nf_frameworkdir(self, frameworkdir)
return {"-F" .. path.translate(frameworkdir)}
end
+-- make the exception flag
+--
+-- e.g.
+-- set_exceptions("cxx")
+-- set_exceptions("objc")
+-- set_exceptions("no-cxx")
+-- set_exceptions("no-objc")
+-- set_exceptions("cxx", "objc")
+function nf_exception(self, exp)
+ local maps = {
+ cxx = "-fcxx-exceptions",
+ ["no-cxx"] = "-fno-cxx-exceptions",
+ objc = "-fobjc-exceptions",
+ ["no-objc"] = "-fno-objc-exceptions"
+ }
+ local value = maps[exp]
+ if value then
+ return {exp:startswith("no-") and "-fno-exceptions" or "-fexceptions", value}
+ end
+end
+
-- make the c precompiled header flag
function nf_pcheader(self, pcheaderfile, target)
if self:kind() == "cc" then