在 Xcode 中保留静态库的头目录结构
我正在使用 Xcode 开发 C++ 静态库。我有一个安装目录集,它复制所有公共头文件,但当我编译时,它只是将所有头文件复制到一个目录中。有没有办法告诉 Xcode 保留我的头文件的目录结构?
I'm developing a static library in C++ using Xcode. I have an Installation Directory set where it copies all of my public header files, but when I compile it just copies all the headers into one directory. Is there a way to tell Xcode to preserve the directory structure of my header files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我还需要保留 C++ 库项目的头文件目录结构,我终于成功做到了。与任务的简单性质相比,XCode 的复杂性高得离谱。关键是首先创建“文件夹引用”,然后在额外的构建阶段复制头文件夹,然后使用脚本从这些导出的头文件夹中删除 .c/.cpp 文件,因为 XCode 不仅会复制.h 文件。
我写了一篇 博客文章这里介绍了如何实现这一目标,因为细节上更加棘手。您可能还想查看我在 上创建的示例 XCode 项目github。
I also needed to preserve the header file directory structure for a C++ library project and I finally managed to do it. It is ridiculously complicated with XCode, compared to the simple nature of the task. The key is to create "folder references" at first, then to copy the header folders in an extra build phase and afterwards to delete .c/.cpp-files from these exported header folders with a script, because XCode will not only copy the .h-files.
I've written a blog post here on how to all achieve that, because it's more tricky in detail. You might also want to check out an example XCode project that I've pot on github.
将文件添加到项目时,必须在附加窗口“为任何添加的文件夹创建文件夹引用”上选择下一个参数。然后您的所有文件都将具有固定的文件路径,并在编译后保存结构。
When you add files to your project, you have to choose next parameter on an additional window "Create folder references for any added folders". And then all your files will have fixed path for your files and will save structure after compilation.