Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildtype=minsize won't minimize the binary with Visual Studio #12265

Closed
matyalatte opened this issue Sep 17, 2023 · 0 comments · Fixed by #12724
Closed

buildtype=minsize won't minimize the binary with Visual Studio #12265

matyalatte opened this issue Sep 17, 2023 · 0 comments · Fixed by #12724

Comments

@matyalatte
Copy link
Contributor

Describe the bug
When you use -Dbuildtype=minsize (or -Doptimization=s) with --backend=vs, msvc will use /O1 /Ot for optimization.
like this

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\CL.exe /c /I
         "demo@exe" /I. /I..\ /I"demo@exe" /I. /I..\ /Zi /nologo /W2 /WX- /diagnostics:column /FS /O1 /Ot /D _MBCS /Gm-
          /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"demo@exe\main.c.obj" /Fd"demo@exe\vc143
         .pdb" /external:W2 /Gd /TC /FC /errorReport:queue /Gw ..\main.c

It means /Os will be overwritten by /Ot, I think?
When I added /Os to the options to overwrite /Ot, my app became smaller.

To Reproduce

meson setup builddir --backend=vs -Dbuildtype=minsize
meson compile -C builddir -v

Expected behavior
Remove /Ot from the compiler options when optimizing for size.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)?
    native build

  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
    Windows 10

  • what Python version are you using e.g. 3.8.0
    Idk, I installed meson with the released msi.

  • what meson --version
    1.2.1

  • what ninja --version if it's a Ninja build
    not ninja build

@matyalatte matyalatte changed the title buildtype=minsize won't work with Visual Studio buildtype=minsize won't minimize the binary with Visual Studio Sep 17, 2023
bruchar1 added a commit to bruchar1/meson that referenced this issue Dec 1, 2023
bruchar1 added a commit to bruchar1/meson that referenced this issue Dec 2, 2023
bruchar1 added a commit to bruchar1/meson that referenced this issue Dec 5, 2023
jpakkane pushed a commit that referenced this issue Dec 23, 2023
This is a first step to make `buildtype` a true alias of `debug` and
`optimization` options.

See #10808.

Relates to:
- #11645
- #12096
- #5920
- #5814
- #8220
- #8493
- #9540
- #10487
- #12265
- #8308
- #8214
- #7194
- #11732
bruchar1 added a commit to bruchar1/meson that referenced this issue Jan 10, 2024
nirbheek pushed a commit that referenced this issue Feb 6, 2024
nirbheek pushed a commit that referenced this issue Feb 6, 2024
soumyaDghosh pushed a commit to soumyaDghosh/meson that referenced this issue Jun 4, 2024
gerioldman pushed a commit to gerioldman/meson that referenced this issue Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant