I am going to shock you all and admit that I am not a Windows programmer! I do however know quite a bit about cross-platform development and have now learnt the joy that is the manifest in Windows development. It seems that DLL hell is now a thing of the past, all hail manifest hell. A week ago I was not aware of these wonderful little files and this post is an attempt to document what I learned while packaging Avogadro for Windows.
After listening to Bill's talk at Camp KDE I was convinced that it really was a good idea to use CPack to package Avogadro. So when I got back home I spent a day or two getting a Windows development environment set up for Avogadro. We have several dependencies such as Qt and this post documenting a bug in the Visual Studio 9 service pack. So I edited the manifest and lied about the version of the DLLs - it believed me.
Next I found that none of our plugins would load. They are Qt plugins that implement most of the functionality in Avogadro. I found a very long thread on this subject, the crux of which is that the embedded manifests are causing Windows to look for the runtime libraries in the plugin directory. Copying them did indeed work but was not optimal. I found that by adding set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /MANIFEST:NO") to our CMakeLists.txt manifests were no longer made for our plugins (which are loadable modules).
So all is quite well with our Windows build now I think. If you would like to try out a new Windows installer, then please download it from here and let me know if it works for you. I have tested it on Windows 2000 and XP virtual machines. This is not the final installer, I need to add some extra data files for OpenBabel and ensure I got the other dependencies right.
If anyone with more Windows experience knows of better solutions please let me know. CPack is absolutely awesome, it seems a shame that the deployment of applications is made so difficult. I know that plugins are not as widely used and so hopefully this post will add to the collective knowledge indexed by Google.