Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake] Speed up export-files target
The export-files target mirrors files from the source tree to the build tree (such as system/ userdata/ addons/) by doing a byte wise diff which is slow. Instead generate a CMake script that uses file(COPY) which only copies if the source is newer. Measurements on Linux machine (real time, cmake + make export-files): - first run (with cleaned page caches): 19+27s vs. 19+6s - consecutive run (with cleaned page caches): 12+35s vs. 12+3s - consecutive run: 6+18s vs. 6+0.3s Measurements on Windows machine (real time, cmake + make export-files): - first run: 43+65s vs. 52+8s - consecutive run: 19+62s vs. 29+1.5s
- Loading branch information
cc735b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry but the first time i build kodi, ExportFiles.cmake does not exist dans the build failed at line 70 here.
is it something only related to FreeBSD cmake build ? because just before that all was fine.
@fetzerch ?
cc735b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is strange. The
file(APPEND...)
creates theExportFiles.cmake
already at configure/cmake time. Could you upload a log file of the build with cmake executed with--trace
. To be honest I never ran a BSD build so it's likely that it has some issues in other areas.cc735b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fetzerch thanks for the tips, the problem is line 73, because in my case
${CORE_SOURCE_DIR} == ${CMAKE_BINARY_DIR}
I don't really understand the logic behind this if(), why not use something like that:
if(NOT EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ExportFiles.cmake)
cc735b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The (obviously untested ;)) logic behind that was that for in-source-builds, nothing should be copied to the build directory. So
if(NOT ${CORE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
needs to be the outer condition, and in the else case the export-files target should just have no command associated.Nevertheless, I would highly recommend to build out-of-source.
cc735b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #10078
cc735b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
everything is fine when il build out source, thank you for your help :)