Add DIA SDK dependency
Solves: https://github.com/mesonbuild/meson/issues/13627
Tested on Windows with [msvc, clang_cl], building [x86, x86_64, arm, aarch64] targets (latter two via cross-compiling). AFAIK this is all that DIA SDK supports.
Possible issues:
-
Version of dependency is not provided. The only way I could find would require us to drag in some library for parsing the version out of msdiaXXX.dll resources.
-
Should the dependency be named 'dia' or 'diasdk'? I am afraid the name 'dia' may be too generic and may conflict with something else in future. This library in particular is very commonly called 'DIA SDK', including the 'SDK' part, maybe for the very same reason.
-
Trickiest part is how to allow users to copy the runtime DLL to build directory, if they want to. This is not strictly required, but a very nice practical feature, without which an application must ask its users to manually register some DLL somewhere inside Program Files from admin console. To provide a better option, the dependency needs to return DLL path to meson.build script. I may have abused dependency variables here a bit. Currently this dependency returns a "internal" variable 'dll' (despite "internal" variables being only used with internal dependencies?). I am not aware of any other way to return such value from dependency. It works like this:
dia = dependency('diasdk', required: true)
dia_dll_name = dia.get_variable(internal: 'dll')
fs = import('fs')
fs.copyfile( dia_dll_name )
conf = configuration_data()
conf.set('msdia_dll_name', fs.name(dia_dll_name))
configure_file(input: 'config.h.in', output: 'config.h', configuration: conf)
executable('dia_from_dll', ['dia_from_dll.cpp'], dependencies: [dia])
Not sure if this is tolerable, or if there is some better way.
All requested changes should now be incorporated. Sorry for chaos with commits & reverts - still learning.
I had to do detection of MSVC 'clang' (not 'clang-cl') compiler in a bit more complicated manner, in order to differentiate MSVC clang vs. MinGW clang.
In my tests, building with this dependency is still failing on x86 clang-cl, due to https://github.com/mesonbuild/meson/issues/13643 . Apparently Meson doesn't have a CI/CD testing for that scenario(?). As soon as that issue gets resolved, this problem should disappear as well.