Closed ObeliskGate closed 2 months ago
Bot detected the issue body's language is not English, translate it automatically.
Xmake version
2.9.3
Windows 11 22H2
According to MSVC documentation, /Ox
is weaker than / The option of O2
, that is, in xmake, /Ox
should correspond to faster
and /O2
should correspond to fastest
and aggressive
, etc.
cl
and [clang-cl
](https:/ /github.com/xmake-io/xmake/blob/c90b483177dd45fb6e7a546b73fcd17c32bbaf23/xmake/modules/core/tools/clang_cl.lua#L101) The code implementation is also the same as the above description.
But in Document and [CMake related implementation](https://github .com/xmake-io/xmake/blob/c90b483177dd45fb6e7a546b73fcd17c32bbaf23/xmake/plugins/project/cmake/cmakelists.lua#L793), implemented as /O2
corresponds to faster
and /Ox
corresponds to fastest
and is mixed in The options related to floating point numbers are inconsistent with each other.
There is also a similar one in cl
’s compilation command mapflags
Problem: Both -O3
and -Ofast
are mapped to -Ox
instead of -O2
and floating point options also appear.
I'm not sure whether it will cause conflicts, but when the floating point number is already controlled by target:set_fpmodels
, such a mapping Most likely unnecessary.
This chaos appears to be caused by an incomplete refactoring, and we look forward to a subsequent fix.
MSVC-related platform optimization options behave consistently.
N/A
N/A
根据 MSVC 文档, /Ox是弱于/O2的选项, 也就是在 xmake 中应该/Ox对应faster而/O2对应fastest及aggressive等.
现在不就是么,只是文档没更新而已。
但在文档以及 CMake 相关实现中, 实现为/O2对应faster而/Ox对应fastest并且混入了浮点数相关选项, 互相不相符.
后来更新没同步过去而已,刚改了。
Bot detected the issue body's language is not English, translate it automatically.
According to MSVC documentation, /Ox is weaker than /O2 Options, that is, in xmake, /Ox should correspond to faster and /O2 should correspond to fastest, aggressive, etc.
Isn't that the case now? It's just that the documentation has not been updated.
But in Document and [CMake related implementation](https:// github.com/xmake-io/xmake/blob/c90b483177dd45fb6e7a546b73fcd17c32bbaf23/xmake/plugins/project/cmake/cmakelists.lua#L793), the implementation is that /O2 corresponds to faster and /Ox corresponds to fastest, and floating point related options are mixed in. Does not match.
Later, the update just didn't synchronize, so I just changed it.
后来更新没同步过去而已,刚改了。
改了我就 close 了.
Bot detected the issue body's language is not English, translate it automatically.
Later, the updates were not synchronized, and they were just changed. Once the change is made, I will close it.
Xmake 版本
2.9.3
操作系统版本和架构
Windows 11 22H2
描述问题
根据 MSVC 文档,
/Ox
是弱于/O2
的选项, 也就是在 xmake 中应该/Ox
对应faster
而/O2
对应fastest
及aggressive
等.cl
和clang-cl
的代码实现也与上述描述相同.但在文档以及 CMake 相关实现中, 实现为
/O2
对应faster
而/Ox
对应fastest
并且混入了浮点数相关选项, 互相不相符.而在
cl
的编译命令mapflags
中也有类似的问题:-O3
和-Ofast
都被对应到-Ox
而非-O2
上并且同样出现了浮点数选项.我不太清楚会不会导致冲突, 但在浮点数已经有
target:set_fpmodels
控制的情况下, 这样的映射很可能是不必要的.这种混乱看上去是由一次不彻底的重构导致的, 期待后续修复.
期待的结果
MSVC 相关平台优化选项表现一致.
工程配置
N/A
附加信息和错误日志
N/A