Skip to content
  • Thomas Debesse's avatar
    bundle: store dll in lib subdirectory, bundle all of them at once · 7962186b
    Thomas Debesse authored
    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
    7962186b