diff options
| author | ruki <[email protected]> | 2020-10-06 23:59:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-06 23:59:02 +0800 |
| commit | 0e6d98d453674e52d676e80a3378e6e74b4250fa (patch) | |
| tree | 8b229f400de2f4856d66a21fd31b1f4c7d21193f /xmake/modules/core | |
| parent | 17b71915bd116b542447a9243dd9210beff1ccab (diff) | |
add set_fpmodels
Diffstat (limited to 'xmake/modules/core')
| -rw-r--r-- | xmake/modules/core/tools/cl.lua | 13 | ||||
| -rw-r--r-- | xmake/modules/core/tools/clang.lua | 25 | ||||
| -rw-r--r-- | xmake/modules/core/tools/gcc.lua | 13 |
3 files changed, 51 insertions, 0 deletions
diff --git a/xmake/modules/core/tools/cl.lua b/xmake/modules/core/tools/cl.lua index eddd61720..4be07f30b 100644 --- a/xmake/modules/core/tools/cl.lua +++ b/xmake/modules/core/tools/cl.lua @@ -113,6 +113,19 @@ function nf_symbol(self, level, target) return flags end +-- make the fp-model flag +function nf_fpmodel(self, level) + local maps = + { + precise = "-fp:precise" -- default + , fast = "-fp:fast" + , strict = "-fp:strict" + , except = "-fp:except" + , noexcept = "-fp:except-" + } + return maps[level] +end + -- make the warning flag function nf_warning(self, level) diff --git a/xmake/modules/core/tools/clang.lua b/xmake/modules/core/tools/clang.lua index 2be9803be..549bdaae1 100644 --- a/xmake/modules/core/tools/clang.lua +++ b/xmake/modules/core/tools/clang.lua @@ -71,6 +71,31 @@ function init(self) end +-- make the fp-model flag +function nf_fpmodel(self, level) + local maps + if self:has_flags("-ffp-model=fast") then + maps = + { + precise = "-ffp-model=precise" + , fast = "-ffp-model=fast" + , strict = "-ffp-model=strict" + , except = "-ftrapping-math" + , noexcept = "-fno-trapping-math" + } + else + maps = + { + precise = "" -- default + , fast = "-ffast-math" + , strict = {"-frounding-math", "-ftrapping-math"} + , except = "-ftrapping-math" + , noexcept = "-fno-trapping-math" + } + end + return maps[level] +end + -- make the optimize flag function nf_optimize(self, level) local maps = diff --git a/xmake/modules/core/tools/gcc.lua b/xmake/modules/core/tools/gcc.lua index 22efda1fd..352153e57 100644 --- a/xmake/modules/core/tools/gcc.lua +++ b/xmake/modules/core/tools/gcc.lua @@ -117,6 +117,19 @@ function nf_warning(self, level) return maps[level] end +-- make the fp-model flag +function nf_fpmodel(self, level) + local maps = + { + precise = "" --default + , fast = "-ffast-math" + , strict = {"-frounding-math", "-ftrapping-math"} + , except = "-ftrapping-math" + , noexcept = "-fno-trapping-math" + } + return maps[level] +end + -- make the optimize flag function nf_optimize(self, level) local maps = |
