waf -如何将外部库添加到 wscript_build 文件
我尝试将外部库添加到我的 waf:winmm.lib 库,
它现在看起来像这样:
srcs = ['timers.cpp']
LIBS ='winmm.lib';
create_lib('timers', srcs,LIBS)
它不起作用。它说我在当前库中找不到 vmp 库“winmm.lib.py”。
有人可以帮忙吗?
I tried to add an external library to my waf: the winmm.lib library
it looks like this now:
srcs = ['timers.cpp']
LIBS ='winmm.lib';
create_lib('timers', srcs,LIBS)
it doesn't work. It says I vmp library 'winmm.lib.py' was not found in the current library.
can someone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从未听说过 waf 中的“create_lib”,所以我不知道该函数是什么或做什么,但无论如何我会尝试回答您的问题。下面我有一个非常基本的 wscript,这是我设置简单项目(在 Linux 上)的典型方法。如果 waf 正如它声称的那样是平台独立的,那么这也应该适用于 Windows;我还没有测试过。这应该创建一个简单的共享库。
将来请提供您的整个 wscript 和堆栈跟踪,以便更轻松地回答您的问题。
I have never heard of "create_lib" in waf, so I have no idea what that function is or does, but I'll try to answer your question anyway. Below I have a very basic wscript that is my typical way of setting up a simple project (on linux). If waf is as platform independent as it claims, then this should work for windows as well; I have not tested it. This should create a simple shared library.
In the future please provide your whole wscript and the stack trace so its easier to answer your question.
我想通了,步骤如下:
在 wscript 文件的配置函数中添加了以下检查。这告诉脚本检查给定的库文件(在本例中为 libmongoclient),并将检查结果存储在 MONGOCLIENT 中。
完成此步骤后,我们需要将包配置文件(.pc)添加到 /usr/local/lib/pkgconfig 路径中。这是我们指定 lib 和 headers 路径的文件。将此文件的内容粘贴到下面。
将依赖项添加到依赖于上述库(即 MongoClient)的特定程序的构建函数中。下面是一个例子。
之后,再次运行配置并构建代码。
I figured this out and the steps are as follows:
Added following check in the configure function in wscript file. This tells the script to check for the given library file (libmongoclient in this case), and we store the results of this check in MONGOCLIENT.
After this step, we need to add a package configuration file (.pc) into /usr/local/lib/pkgconfig path. This is the file where we specify the paths to lib and headers. Pasting the content of this file below.
Added the dependency into the build function of the sepcific program which depends on the above library (i.e. MongoClient). Below is an example.
After this, run the configure again, and build your code.