-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DIA SDK dependency #13638
Add DIA SDK dependency #13638
Conversation
@@ -0,0 +1,8 @@ | |||
project('diatest', 'cpp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should rather add the tests to test cases/windows
instead of creating a new test category
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think Windows would be appropriate. The other option would be frameworks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good, I've got a few things we could fix up though
@@ -0,0 +1,8 @@ | |||
project('diatest', 'cpp') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think Windows would be appropriate. The other option would be frameworks
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 #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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple more things, mostly around the version I think we need to work out, but I think we're getting close.
52eeb49
to
10f9fa1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
482b7ac
to
41f0bdf
Compare
mesonbuild/dependencies/dev.py
Outdated
mlog.error('DIA SDK is only supported in C and C++ projects') | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can raise DependencyException('DIA SDK is ....')
here instead, and meson will make it look like this:
Dependency lookup for diasdk with method 'system' failed: DIA SDK is only supported in C and C++ projects
mesonbuild/dependencies/dev.py
Outdated
def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None, | ||
configtool: T.Optional[str] = None, internal: T.Optional[str] = None, | ||
default_value: T.Optional[str] = None, | ||
pkgconfig_define: PkgConfigDefineType = None) -> str: | ||
if internal == 'dll': | ||
return self.dll | ||
if default_value is not None: | ||
return default_value | ||
raise DependencyException(f'Cannot get variable {internal}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I... get what this is trying to do, but it still seems weird. :D
@dcbaker this is a system dependency piggybacking onto the mechanism for declare_dependency(variables: [...])
support?
Do we want to extend the get_variable interface to cope with system dependencies? consider them equivalent to configtool or internal? Simply expect them to use get_variable('dll') without a type-specific request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to extend with system
type. I still think the no type selection thing is an anti-feature, it lulls people into a false sense of "everything will work right all the time!" and it only happens to work in the case of pkg-config and wraps, but keeps them from even thinking about the less common cases like cmake.
endif | ||
|
||
dia = dependency('diasdk', required: true) | ||
dia_dll_name = dia.get_variable(internal: 'dll') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need "internal" here. The get_variable() method accepts a generic variable name, and a type-specific one. The latter is intended to be useful for cases where e.g. the same information is available via both pkg-config and cmake but the name of the pkg-config variable is different from the name of the cmake variable.
(e.g. because cmake loves capitalized variable names.)
It is therefore necessary to pass a different name into get_variable() depending on which type of dependency was found -- or use dep.get_variable(pkgconfig: 'foo', cmake: 'FOO')
5c5009a
to
eb2e95c
Compare
Solves: #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:
Not sure if this is tolerable, or if there is some better way.