Starting from Visual Studio 2005, every executable or dynamic library must declare the libraries it uses with a manifest file. This manifest can be embedded in the executable or library, and this is the best way to deal with it.

When using Scons, this embedding does not occur automatically. One has to overload the SharedLibrary builder so that a post-action is made after building the library :

def MSVCSharedLibrary(env, library, sources, **args):
  cat=env.OriginalSharedLibrary(library, sources, **args)
  env.AddPostAction(cat, 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;2')
  return cat
 
 env['BUILDERS']['OriginalSharedLibrary'] = env['BUILDERS']['SharedLibrary']
 env['BUILDERS']['SharedLibrary'] = MSVCSharedLibrary

With this method, the embedding is made for every library, which is handy. The same can be done for the Program builder with the line :

  env.AddPostAction(cat, 'mt.exe -nologo -manifest ${TARGET}.manifest -outputresource:$TARGET;1')

I now regularly use Scons as a cross-platform software construction tool. It is easy, written in Python, and I know Python, so no problem learning a new language as for CMake. In some cases when I use SWIG, the target platform does not have the SWIG executable. But when compiling a module, Scons must use this executable, whatever you try to do. In this case, one need to create a new SharedLibrary builder, so that this attribute will determine if SWIG is present or if the generated .c or .cpp files must be used instead.

Read More