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

fix code in order to support cmake unity builds #2851

Merged
merged 1 commit into from Oct 29, 2022

Conversation

tnixeu
Copy link
Contributor

@tnixeu tnixeu commented Oct 26, 2022

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Other: Replace this with a description of the type of this PR

Description

I tired building polybar with CMAKE_UNITY_BUILD":"ON" and the build failed.

The #pragma once in base.inl is needed because it is included multiple times when passed to the compiler.

I am not exactly sure why the changes in encoder.cpp are needed. However, both gcc and clang fail. The variable header could be renamed Instead of adding polybar:: to ipc::header. However, this would change more lines.

Both changes should have no impact on the runtime ore a normal build.

Related Issues & Documents

Documentation (check all applicable)

  • This PR requires changes to the Wiki documentation (describe the changes)
  • This PR requires changes to the documentation inside the git repo (please add them to the PR).
  • Does not require documentation changes

src/ipc/encoder.cpp Outdated Show resolved Hide resolved
@patrick96
Copy link
Member

Dang, I didn't know about unity builds, this makes compiling around twice as fast on my machine 😃.

(It will probably affect the performance of ccache though)

@codecov
Copy link

codecov bot commented Oct 29, 2022

Codecov Report

Merging #2851 (8a7f7b0) into master (10cdec3) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2851   +/-   ##
=======================================
  Coverage   13.17%   13.17%           
=======================================
  Files         162      162           
  Lines       11509    11509           
=======================================
  Hits         1516     1516           
  Misses       9993     9993           
Flag Coverage Δ
unittests 13.17% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
include/modules/meta/base.inl 0.00% <ø> (ø)
src/ipc/encoder.cpp 85.71% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tnixeu
Copy link
Contributor Author

tnixeu commented Oct 29, 2022

Dang, I didn't know about unity builds, this makes compiling around twice as fast on my machine smiley.

(It will probably affect the performance of ccache though)

This surprised me as well, when I first learnt about it. One drawback is, that compiling small changes can take longer because more code is compiled again as well.

Copy link
Member

@patrick96 patrick96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@patrick96 patrick96 merged commit ed6a0e9 into polybar:master Oct 29, 2022
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.

None yet

2 participants