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

integrate with CMake's LTO support #143

Merged
merged 2 commits into from
Apr 11, 2020
Merged

integrate with CMake's LTO support #143

merged 2 commits into from
Apr 11, 2020

Conversation

xanderlent
Copy link
Contributor

@xanderlent xanderlent commented Apr 11, 2020

See #140 for the context of this PR.

This definitely fixes the build failure on Ubuntu xenial.

Please do not merge until I can confirm that this approach actually enables LTO with newer versions of CMake. I haven't been able to confirm that LTO is being used.

This commit prepares the project for using CMake's LTO support.

(Using `-flto` made sense in 2015, since CMake support for LTO with GCC
and Clang was added in version 3.9.0 in 2017. [1])

Specifying `-flto` seems to cause build failures on Ubuntu xenial. [2]

[1]: https://cmake.org/cmake/help/v3.9/release/3.9.html
[2]: PJK#140

Fixes: 8e75783
@xanderlent
Copy link
Contributor Author

xanderlent commented Apr 11, 2020

-- LTO is not enabled: (CMake was too old or there was no LTO support detected by CMake.)

  • CIFuzz
  • Travis: clang, amd64, Linux (Ubuntu bionic)

-- LTO is enabled: (We're indicating we want LTO, but I can't tell if LTO was used.)

  • AppVeyor
  • Travis: gcc, amd64, Linux (Ubuntu bionic)
  • Travis: gcc, arm64, Linux (Ubuntu bionic)
  • Travis: gcc, ppc64le, Linux (Ubuntu bionic)
  • Travis: clang, amd64, macOS (High Sierra)

Hindsight being 20/20, it might make sense to log when LTO was disabled b/c CMake was too old.

Additionally, do you think it's worth trying to enable LTO on versions earlier than 3.9.0, even though the CMake-supported way only works with the Intel compiler on Linux?

@PJK PJK merged commit 1151d00 into PJK:master Apr 11, 2020
@PJK
Copy link
Owner

PJK commented Apr 11, 2020

Thanks @xanderlent!

@PJK
Copy link
Owner

PJK commented Apr 11, 2020

Re pre 3.9: I wouldn't worry about supporting >2 years of old build deps, if anyone cares, they can always add extra flags during build configuration or come and complain

PJK added a commit that referenced this pull request Apr 11, 2020
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 this pull request may close these issues.

2 participants