Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
High Level Overview of Change
This is a copy of #3886 with some changes suggested in review, but that @guidovranken has not yet addressed. When merging do not squash their commit so that their work can be acknowledged.
Original from #3886
This prevents
soci
getting patched more than once over the course of multiple builds within the same CMake build environment.Context of Change
Original from #3886
The various
unity_*_cxx.cxx.o
kept getting built anew after they've been built already.The reason for this is that each time the
make
command is issued,soci
is patched anew. Becausesoci
is a dependency of theunity_*_cxx.cxx.o
files, the build system then reasons that theunity_*_cxx.cxx.o
files must be built anew becausesoci
has a more recent timestamp.Patching
soci
only needs to be done once; from that point on it can be reused any number of times.This PR makes a change to the script responsible for patching, and only proceeds to patch if it finds that there is no back-up of original (unpatched)
soci
. If a back-up already exists, this indicates thatsoci
has already been patched, and the patch procedure is skipped.Update:
This PR makes a change to the script responsible for patching. It patches the file, then compares the patched file to the original. If they are identical, it deletes the patched file and exits. If not, it backs up the original, then replaces it with the patch.
Type of Change
Before / After
Before: Repeated builds in the same CMake environment with no changes will unnecessarily build many of the files. In unity builds, they will be
unity_*_.cxx
. In non-unity builds, they will be individual source files.After: Repeated builds in the same CMake environment does not build any source, allowing the build to take far less time. On my workstation, time for various build configs was reduced from a range of 11s - 42s to a range of 2s - 7s. Unfortunately, CMake still has some overhead dealing with external projects and such, which accounts for some of the remaining time.
Future Tasks
Find any other unnecessary file replacements and fix those.