货物构建脚本以检测目标最小值和最大MacOS版本?

发布于 2025-02-10 18:37:10 字数 438 浏览 1 评论 0原文

我正在为C库编写一个Rust包装器,该库有条件地需要uniformTypeIdentifiers框架,具体取决于__ mac_os_os_os_os_x_version_min_lowled__ mac_os_os_os_os_os_x_x_max_max_max_max_allowed UnibrolTypeIdentifiers 库(最近引入了),因为现在正在弃用旧的做事方式。

是否有一种方法可以在build.rs中获取这两个值(针对目标的最小和最大MACOS版本),以便我可以决定是否发射货物:Rustc-link-lib-lib = framework =链接库的UnibrolTypeIdentifier行?我不能一直发出它,因为在较旧的Mac上,这将导致构建错误,因为库将不可用。

I'm writing a Rust wrapper for a C library that conditionally requires the UniformTypeIdentifiers framework depending on the values of __MAC_OS_X_VERSION_MIN_ALLOWED and __MAC_OS_X_VERSION_MAX_ALLOWED (which are the minimum and maximum macOS versions targeted). The C library does conditional compilation that uses the UniformTypeIdentifiers library (which was introduced recently) because the old way of doing things is now deprecated.

Is there a way to obtain these two values (the minimum and maximum macOS versions targeted) in build.rs so that I can decide whether to emit the cargo:rustc-link-lib=framework=UniformTypeIdentifiers line that links the library? I can't simply emit it all the time, because on older Macs this will lead to a build error, since the library would be unavailable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文