Skip to content
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

Using WxWidgts on Windows #13180

Open
bilaljo opened this issue May 3, 2024 · 1 comment
Open

Using WxWidgts on Windows #13180

bilaljo opened this issue May 3, 2024 · 1 comment

Comments

@bilaljo
Copy link

bilaljo commented May 3, 2024

Hi there,

I have installed the latest version of Meson, CMake and WxWidgets on Windows 10 and tried to include the WxWidgets dependency on Windows. My Python version is 3.10. The compiler is the MSVC Compiler (2022). However, I get the following error message with the following code:

wx = dependency('wxwidgets')

Runtime dependency wxwidgets found: NO (tried config-tool)

I tried to enforce this with cmake (method: cmake) but it was ignored. WxWidgets is installed in the default path and other libraries like libtorch or spdlog are found. After googeling I figured out that config-tool is Unix only. This StackOverflow answer says that this should have been fixed since version 0.51.

https://stackoverflow.com/a/54197888/12585571

Thank you very much.

Kind regards

@eli-schwartz
Copy link
Member

I tried to enforce this with cmake (method: cmake) but it was ignored.

Dependencies without custom definitions in the meson source code automatically implement the pkg-config and cmake methods. Dependencies with custom definitions support whichever methods the python code says to implement. In this case,

class WxDependency(ConfigToolDependency):
tools = ['wx-config-3.0', 'wx-config-3.1', 'wx-config', 'wx-config-gtk3']
tool_name = 'wx-config'
def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
super().__init__('WxWidgets', environment, kwargs, language='cpp')
if not self.is_found:
return
self.requested_modules = self.get_requested(kwargs)
extra_args = []
if self.static:
extra_args.append('--static=yes')
# Check to make sure static is going to work
err = Popen_safe(self.config + extra_args)[2]
if 'No config found to match' in err:
mlog.debug('WxWidgets is missing static libraries.')
self.is_found = False
return
# wx-config seems to have a cflags as well but since it requires C++,
# this should be good, at least for now.
self.compile_args = self.get_config_value(['--cxxflags'] + extra_args + self.requested_modules, 'compile_args')
self.link_args = self.get_config_value(['--libs'] + extra_args + self.requested_modules, 'link_args')
@staticmethod
def get_requested(kwargs: T.Dict[str, T.Any]) -> T.List[str]:
if 'modules' not in kwargs:
return []
candidates = extract_as_list(kwargs, 'modules')
for c in candidates:
if not isinstance(c, str):
raise DependencyException('wxwidgets module argument is not a string')
return candidates
packages['wxwidgets'] = WxDependency

It's defined as an exclusive ConfigToolDependency. This could be changed but would require a proposal/PR and wouldn't apply before meson 1.5.0

This StackOverflow answer says that this should have been fixed since version 0.51.

The answer says that using the wx-config provided by mingw was fixed in meson 0.51.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants