Skip to content

improve lib and other stuff bundling on windows

Thomas Debesse requested to merge illwieckz/netradiant:bundle into master
  • export bundling code from cmake to a dedicated script
  • trigger gtk theme/engine bundling on libgtk bundling
  • also bundle hicolor icons
  • now use ntldd on msys2 instead of ldd so it also work when building 32bit build on 64 windows
  • the bundling script may be extended for other OSes
  • the script now avoids to bundle .a and other include files.
  • store dll in lib subdirectory, bundle all of them at once

about the lib subdirectory:

instead of finding and copying the dll each time a binary is produced, the path of the produced binary is stored in a unique file (to avoid race condition) and the target for that binary is added as a dependency to a new target named bundle that does the finding and the copying once for all.

this avoids race condition while building targets in parallel, workaround the inability of cmake to track a common list between all targets and to keep it from configure to build step

this makes the bundle process more reliable and avoid things being copied twice. Before that I've seen copy processes starting to copy the same file even with the -n option telling to not copy if the file exists, then seeing one of them failing because they both started when the file was not yet copied but one finished the copy before the other one

this also makes the bundling faster by only doing things once for all

the dll are then moved to a lib/ subdirectory instead of the root of the buld directory

each binary having dll to find and copy is built with a special resource file embedding a manifest telling there is an assembly directory containing dll named lib, then a manifest is writen for that assembly directory listing all the dll it can find there telling windows to look for them there at binary loading instead of the system directory and the place right to binary

this:

  • helps to ensure the right dll is loaded even if another exists with the same name on the system
  • reduce the mess by storing all dll in one dedicated directory
  • avoids the double cmake configure run by removing the need to glob the build directory before installation
Edited by Thomas Debesse

Merge request reports