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

Define Git and date constants in executables only #4681

Merged
merged 8 commits into from
Jun 17, 2023

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Jun 11, 2023

Description

This moves the definitions CHATTERINO_{GIT_{HASH, RELEASE, COMMIT, MODIFIED}, CMAKE_GEN_DATE} into the executable only. This removes them from the chatterino-lib target, which in turn makes it possible to cache, since the definitions will be the same across many runs (mentioned in #4680 (comment)).

Local compile times will also be improved (e.g. when recompiling on a new day).

To test this, you should rerun the Windows CI after this day (to get a new generator date) and check the Post Setup sccache (Windows) step for the amount of cache-hits.

@pajlada pajlada self-requested a review June 11, 2023 20:44
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

src/common/Version.hpp Show resolved Hide resolved
Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

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

As we discussed in chat, having the version header & source file as part of a CMake add_library(... OBJECT) would make this a bit cleaner, overall approach looks good

@pajlada
Copy link
Member

pajlada commented Jun 17, 2023

Each executable has to also link to the VERSION_PROJECT. objects don't have a link step so it can't be included in sub-dependencies

@pajlada pajlada merged commit 4b40b9a into Chatterino:master Jun 17, 2023
@Nerixyz Nerixyz deleted the fix/git-in-exe branch June 17, 2023 17:43
@Nerixyz Nerixyz mentioned this pull request Jul 18, 2023
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