简体   繁体   English

通过Boost构建链接到OS X框架

[英]Link to OS X framework with boost build

How do I link to an OS X framework using boost build? 如何使用Boost构建链接到OS X框架? I have tried the following (in Jamroot): 我已经尝试了以下方法(在Jamroot中):

frameworks_directory = "/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/" ;

lib CoreFoundation
:
: <file>$(frameworks_directory)"CoreFoundation.framework/CoreFoundation"
:
: <include>$(frameworks_directory)"CoreFoundation.framework/Headers/" ;

exe Test : main.cpp CoreFoundation ;

However this produces the following error (shortened for space): 但是,这会产生以下错误(缩短了空间):

error: target { /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation. } has no type

I presume this is because the CoreFoundation file does not have an extension, and so boost-build is unable to deduce its type. 我认为这是因为CoreFoundation文件没有扩展名,因此boost-build无法推断其类型。 Is there any way to explicitly specify the type of a file, or to in some other way link to a framework on OS X ? 是否有任何方法可以明确指定文件的类型,或以其他方式链接到OS X上的框架?

The simple way: 简单的方法:

exe Test : main.cpp : <framework>CoreFoundation ;

This is of course assuming you are using the "darwin" toolset. 当然,这是假设您使用的是“ darwin”工具集。 And have set it up correctly such that it knows about all the SDKs you have installed. 并正确设置它,使其了解您已安装的所有SDK。

The following works, but assumes that you are building using a compiler which supports the "-frameworks" linker option: 以下工作正常,但假定您正在使用支持“ -frameworks”链接器选项的编译器进行构建:

alias CoreFoundation : : : : <linkflags>"-framework CoreFoundation" ;

exe Test : main.cpp CoreFoundation ;

This is a pretty reasonable assumption, given that you want to link to a framework! 假设您要链接到框架,这是一个非常合理的假设!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM