如何使用 wxWidgets depends for Windows 设置介子项目?

How do I set up meson project with wxWidgets depends for Windows?

我正在尝试新的设置。我在 64 位 Windows 10。我有介子示例项目和 clang 编译器堆栈 Visual Studio 2017。这两个都在我的路径中。

[0/1] Regenerating build files.
The Meson build system Version: 0.49.0
Source dir: C:\WORK\cpp-example\wx-example
Build dir: C:\WORK\cpp-example\wx-example\builddir
Build type: native build
Project name: wx-example
Project version: undefined
Native C++ compiler: clang++ (clang 7.0.0 "clang version 7.0.0 (tags/RELEASE_700/final)")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found wx-config '>=3.0.0' NO
Dependency WxWidgets found: NO (tried config-tool)

meson.build:8:2: ERROR:  Dependency "wxwidgets" not found, tried config-tool

A full log can be found at C:\WORK\cpp-example\wx-example\builddir\meson-logs\meson-log.txt
FAILED: build.ninja

我的meson.build是

project('wx-example', 'cpp')

#if build_machine.system() == 'windows'
#  cpp = meson.get_compiler('cpp')
#  add_project_link_arguments(['C:\WORK\wxWidgets-3.1.2\include'], language : 'cpp')
#  wx_dep = cpp.find_library('wxwidgets', dirs : ['C:\WORK\wxWidgets-3.1.2\lib\vc_x64_dll'])
#else
  wx_dep = dependency('wxwidgets', version : '>=3.0.0', required : true)
#endif

executable('wx-example.exe', ['main.cpp'], dependencies : [wx_dep])

你知道如何编译我的示例吗? 也许我应该使用 MinGW wxWitgets 包?

MesonwxWidgets的依赖只支持wx-config工具,本来是打算for *nix only的。所以你需要先获取 wx-config Windows 本机端口才能使其与 VC++.

一起使用

顺便说一句。也许最简单的事情就是自己编写它,因为它只是一个常规的控制台应用程序,它解析命令行并输出到标准输出相应的 compiler/linker 标志。

Maybe I should use MinGW wxWitgets package?

嗯,这当然是可能的,但是您还必须切换到 gcc/g++。此外,MesonwxWidgets 依赖 is still brokenMSYS2/MinGW 下。问题是 Meson 错误地尝试直接执行 wx-config,而在 Windows 下它必须以 env/sh/bash 或其他任何前缀。修复它不是什么大问题,但您仍然需要做一些工作。

更新:问题似乎已在 Meson 0.51.0

中修复