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

Why globjects uses /GL flag on MSVC? #366

Open
NukeBird opened this issue May 11, 2018 · 4 comments
Open

Why globjects uses /GL flag on MSVC? #366

NukeBird opened this issue May 11, 2018 · 4 comments

Comments

@NukeBird
Copy link

When I'm trying to compile a project in Visual Studio 2017 I getting an warning "founded .netmodule MSIL or module, compiled with parameter /GL, restarting a linkage with parameter /LTCG"

Compilation time and output file size are big...

@scheibel
Copy link
Member

scheibel commented May 14, 2018

I recall having multiple long sessions fine-tuning the compilation and linker flags on MSVC. Back then, we majorly tested MSVC 2013 and 2015, probably we have to reconsider the flags for 2017.
Thanks for reporting.

Update: What I wrote holds for glbinding (I misread the project name). For globjects there may be an actual mismatch of compiler options. We'll investigate.

@NukeBird
Copy link
Author

NukeBird commented May 17, 2018

Thank you for reply, hope this behavior of MSVC will be fixed soon ^^

@j-o
Copy link

j-o commented Jun 8, 2018

As for the /GL option, see here: https://docs.microsoft.com/en-us/cpp/build/reference/gl-whole-program-optimization. It enables compiler optimizations across compilation units and implies /LTCG, which is not currently supplied, hence the warning.

IMHO, this is a cmake-init issue, that probably stems from the fact that adding a linker flag is a bit cumbersome in cmake, as there is no target_link_options. To fix this, append the following to CompileOptions.cmake:

# MSVC linker options
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
    set(DEFAULT_LINKER_OPTIONS ${DEFAULT_LINKER_OPTIONS}
        "$<$<CONFIG:Release>:-LTCG>"
    )
endif()

This might reduce compile time (as per warning message), but won't affect output file size.

@scheibel
Copy link
Member

Thanks for investigating.

@cgcostume cgcostume added this to To do in globjects-2.0.0 via automation Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

4 participants