有什么方法可以让捆绑 xcode 项目包含一个静态库 xcode 项目? [英] Any way to make bundle xcode project to include a static library xcode project?
问题描述
我有一个静态库 xcode 项目 (.a) 和一个捆绑 xcode 项目 (.bundle)我将 (.a) 添加为 (.bundle) 的子项目,并添加到 [Target Dependencies] 和 [Link Binary With Libraries].
I have a static library xcode project (.a) and a bundle xcode project (.bundle) I added the (.a) as a sub project of (.bundle) and added to [Target Dependencies] and [Link Binary With Libraries].
运行 bulid 后,(.bundle) 仍然不包含任何二进制文件 (.bundle).
After run the bulid the (.bundle) still not contain any binary file inside (.bundle).
如果我将 .c 和 .h 文件直接添加到 (.bundle) 下是可行的,但这使我需要处理两个项目文件.任何方法都可以让 (.bundle) 只用 (.a) 构建?
It's work if I add the .c and .h files to under (.bundle) directly, but that make me need to handle two project files. Any way can make (.bundle) just build with the (.a) ?
这个问题 和我问的一样,我试着按照他的 11 个步骤而不是第 10 步,因为他最后说不需要那个步骤.但是生成的 (.bundle) 仍然不包含任何二进制文件
This question same as what I asked, I tried to follow his 11 steps without the step 10 because he said lastly no need that step. But the generated (.bundle) still without contain any binary
推荐答案
最后,我让它工作了.
第 10 步仍然很重要,下面是更正的第 10 步.
The step 10 still important and below is corrected step 10.
- 在 (.bundle) 项目下创建一个 dummy.c,dummy.c 可以完全为空.删除要在
Link Binary With Libraries
中链接的库的设置,而是使用-Wl,-force_load,$(CONFIGURATION_BUILD_DIR)/libYourLib.a
或-all_load
到Other Linker Flags
- create a dummy.c under (.bundle) project and the dummy.c can just totally empty. remove the setting for the library you want to link inside
Link Binary With Libraries
instead use-Wl,-force_load,$(CONFIGURATION_BUILD_DIR)/libYourLib.a
or-all_load
toOther Linker Flags
PS:也可以使用子项目代替工作区.并使用 Target Dependencies
而不是 Edit Scheme
来达到相同的效果.
PS: And also can use sub-project instead of workspace. and use Target Dependencies
instead of Edit Scheme
to achieve the same effect.
这篇关于有什么方法可以让捆绑 xcode 项目包含一个静态库 xcode 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!