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

Changes to MP4V2_PROJECT_build should not trigger rebuild of all objects #19

Open
inkychris opened this issue Oct 5, 2022 · 1 comment

Comments

@inkychris
Copy link

MP4V2_PROJECT_build is currently defined in project.h. This is included in mp4v2.h which is then included in many more places. Whenever the project is reconfigured (in my case any time I modify a CMake config), all objects become invalidated and have to be rebuilt again.

MP4V2_PROJECT_build is only used in libutil/Utility.cpp. This variable, since it changes more regularly than all of the other variables in project.h should be moved into a separate header and included only where needed. Currently this would mean that only libutil/Utility.cpp is recompiled when the project is reconfigured.

One option is to add project_build.h.in and include that only in libutil/Utility.cpp. This solves the issue for me locally using CMake.

An extension to this might be to also separate out the version variables, leaving only "static" variables in project.h, and then again only including project_version.h, for example, where those variables are needed.

@ferdnyc
Copy link

ferdnyc commented Feb 28, 2024

As another workaround, you can set the SOURCE_DATE_EPOCH environment variable to a static timestamp (in Unix "seconds-since-1970-01-01 00:00:00 UTC" format). CMake will generate the same MP4V2_PROJECT_build variable each run, using that timestamp value.

(This works because the value is generated using CMake's string(TIMESTAMP ...) command, which since CMake 3.8 automatically supports SOURCE_DATE_EPOCH.)

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

No branches or pull requests

2 participants