Fix x86 build, tweak MSVC opt flags.

Use:

/Ot /Oy /Ob3 /GF /Gy

, instead of /O2 for x86, this makes it not crash on ROM load for the
OpenGL renderer.

Supposedly /O2 is equivalent to:

/Og /Oi /Ot /Oy /Ob2 /GF /Gy

, but the documentation states that /Og is automatically enabled when
any other optimizations are enabled automatically. So this should make
absolutely no difference, yet it does.

For x64 use:

/O2 /Ob3

, this overrides /Ob2 from /O2 to use more aggressive inlining, VS 2019
is required for this.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-01-18 03:01:13 +00:00
parent 73223445d6
commit c4733bcf03
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 8 additions and 1 deletions

View File

@ -749,7 +749,14 @@ elseif(MSVC)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_compile_options(/W4)
else()
add_compile_options(/w /O2)
add_compile_options(/w)
if(X86_32)
add_compile_options(/Ot /Oy /Ob3 /GF /Gy)
else()
add_compile_options(/O2 /Ob3)
endif()
if(ENABLE_LTO)
add_compile_options(/GL)