使用 Cygwin 查找第三方库
Find Third-Party Libraries with Cygwin
我开始使用 Cygwin 构建我的项目,但我不知道如何设置它来查找我的第三方库。
例如,我将 directx-headers 放在系统路径中可以找到的位置,但是 Cygwin 似乎没有搜索系统路径变量。
我如何设置 Cygwin 以在第三方文件夹中或在 Windows OS 我的系统路径中查找容器外的库?
如 Meson 手册所述
https://mesonbuild.com/Commands.html
$ meson configure [-h] [--prefix PREFIX] [--bindir BINDIR]
[--datadir DATADIR] [--includedir INCLUDEDIR]
[--infodir INFODIR] [--libdir LIBDIR]
[--libexecdir LIBEXECDIR] [--localedir LOCALEDIR]
.....
您可以使用 --includedir INCLUDEDIR
来包含
--libdir LIBDIR
用于导入库
我相信 答案是使用 PKG_CONFIG_PATH,定义为 , and in the answer given here。
我也在 directx-headers 的 github 页面上找到了这个...
Pkg-config: Use Meson to build this project, and the resulting
installed package can be found via pkg-config.
找到 个答案,也很有用。
最后,我找到了 this,这很有用,并提供了我想知道的关于 Cygwin 搜索 PATH 的信息。
重大编辑[已解决] -
解决方案:Guide to pkg-config
On a typical Unix system, it will search in the directories
/usr/lib/pkgconfig and /usr/share/pkgconfig. This will usually cover
system installed modules. However, some local modules may be installed
in a different prefix such as /usr/local. In that case, it's necessary
to prepend the search path so that pkg-config can locate the .pc
files.
$ pkg-config --modversion hello
Package hello was not found in the pkg-config search path. Perhaps
you should add the directory containing `hello.pc' to the
PKG_CONFIG_PATH environment variable No package 'hello' found
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ pkg-config --modversion hello
1.0.0
需要的是使用 export VAR=value(或路径到目录)
之后,路径将找到成功。
所以要查找第三方库等,只需使用导出变量命令即可。
我开始使用 Cygwin 构建我的项目,但我不知道如何设置它来查找我的第三方库。 例如,我将 directx-headers 放在系统路径中可以找到的位置,但是 Cygwin 似乎没有搜索系统路径变量。
我如何设置 Cygwin 以在第三方文件夹中或在 Windows OS 我的系统路径中查找容器外的库?
如 Meson 手册所述
https://mesonbuild.com/Commands.html
$ meson configure [-h] [--prefix PREFIX] [--bindir BINDIR]
[--datadir DATADIR] [--includedir INCLUDEDIR]
[--infodir INFODIR] [--libdir LIBDIR]
[--libexecdir LIBEXECDIR] [--localedir LOCALEDIR]
.....
您可以使用 --includedir INCLUDEDIR
来包含
--libdir LIBDIR
用于导入库
我相信 答案是使用 PKG_CONFIG_PATH,定义为
我也在 directx-headers 的 github 页面上找到了这个...
Pkg-config: Use Meson to build this project, and the resulting installed package can be found via pkg-config.
找到
最后,我找到了 this,这很有用,并提供了我想知道的关于 Cygwin 搜索 PATH 的信息。
重大编辑[已解决] - 解决方案:Guide to pkg-config
On a typical Unix system, it will search in the directories /usr/lib/pkgconfig and /usr/share/pkgconfig. This will usually cover system installed modules. However, some local modules may be installed in a different prefix such as /usr/local. In that case, it's necessary to prepend the search path so that pkg-config can locate the .pc files.
$ pkg-config --modversion hello
Package hello was not found in the pkg-config search path. Perhaps you should add the directory containing `hello.pc' to the PKG_CONFIG_PATH environment variable No package 'hello' found
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ pkg-config --modversion hello
1.0.0
需要的是使用 export VAR=value(或路径到目录) 之后,路径将找到成功。
所以要查找第三方库等,只需使用导出变量命令即可。