Reduce the amount of objects that are compiled several times
ClosedPublic

Authored by apol on Mar 30 2020, 8:59 PM.

Details

Summary

We build some objects several times which makes it uncomfortable to develop KWin
since every time we modify something a lot of things get rebuilt. This should
help a bit although it doesn't solve all the problems.

Test Plan

Builds, tests pass

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
apol created this revision.Mar 30 2020, 8:59 PM
Restricted Application added a project: KWin. · View Herald TranscriptMar 30 2020, 8:59 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
apol requested review of this revision.Mar 30 2020, 8:59 PM
apol updated this revision to Diff 78938.Mar 30 2020, 10:56 PM

Forgot file

apol updated this revision to Diff 78947.Mar 31 2020, 1:55 AM

No need to compile the xml's object file for every effect

anthonyfieroni added inline comments.
CMakeLists.txt
376

It should be installed or static.

zzag added a subscriber: zzag.Mar 31 2020, 10:14 AM
zzag added inline comments.
utils.cpp
80–85

Why were these two moved?

zzag added a comment.Mar 31 2020, 10:15 AM

Do you have stats that show how much time it takes to compile kwin w/ and w/o this change?

apol added a comment.Mar 31 2020, 10:58 AM
In D28445#638781, @zzag wrote:

Do you have stats that show how much time it takes to compile kwin w/ and w/o this change?

The problem isn't build time per se, which also is, but that every time you save a file you'll get changes in few hundred objects.
You can try it easily by modifying cursors.cpp or screens.cpp on a ready build directory and triggering a build. There will be few hundred build steps to be done (on my laptop which isn't that bad it's easily 4 or 5 minutes to wait).

CMakeLists.txt
376

Why, no?

utils.cpp
80–85

Because they need to be out of the #ifndef KCMRULES.

zzag accepted this revision.Mar 31 2020, 11:06 AM
This revision is now accepted and ready to land.Mar 31 2020, 11:06 AM
davidedmundson added inline comments.
CMakeLists.txt
376

I used an object library in a phab review recently and it caused an issue when Marco (on OpenSuSe) tried to compile it even though it worked well for me.

So be wary. Though it's equally possible I just did it wrong.

We can ship it, CI will complain if it doesn't work :)

This revision was automatically updated to reflect the committed changes.