从 Xcode 项目生成 Makefile,以便将项目移植到其他 UNIX 系统
(之前有人问过这个问题,但答案并不明确) 虽然我喜欢使用 Xcode (3.2.1) 进行开发,但我需要将一些项目移植到其他 UNIX 系统,甚至 Windows。代码全部是 C++,但相当复杂。在厌倦了通过手动试错来完成此操作后,我正在寻找一种从 Xcode 项目中自动/半自动生成等效 Makefile 的方法。
感谢您的任何提示。
曼弗雷德
(This was asked before but the answers were not conclusive)
While I love development using Xcode (3.2.1), I have the need to port some projects to other UNIX systems, and even Windows. The code is all C++ but fairly complex. I'm looking for a way to automated / semi-automated generation of equivalent Makefiles out of my Xcode projects, after getting tired to do this by manual trial-and-error.
Thanks for any hints.
Manfred
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能应该针对所有平台切换到 CMake。反过来,CMake 可以使用 CMake 项目描述生成 Makefile、Xcode、Visual Studio 和 KDevelop 项目/构建。首先,您需要为您的项目创建 CMake 描述,但是如果您只更新 CMake 项目,从 CMake 到 Xcode 就非常容易。或者您可以使用 Makefile 生成器并创建基于 Makefile 的 Xcode 项目。要开始使用 CMake,您应该阅读 CMake wiki,查看 CMake 手册,并且 - 如果您愿意 - 您可以查看我的 C++ 应用程序项目模板 和 C++ 库项目模板 使用 CMake(尽管我仅使用 Makefile 生成器而不是 Xcode 生成器测试了它们)。
You should probably switch to CMake for all your platforms. CMake, in turn, can generate Makefile, Xcode, Visual Studio, and KDevelop projects/builds using the CMake project description. You will, at first, need to create a CMake description for your project, but then if you only update the CMake project, going from CMake to Xcode is very easy. Or you can use the Makefile generator and create a Makefile-based Xcode project. To get started using CMake, you should read the the CMake wiki, look at the CMake Manual, and -- if you like -- you can look at my C++ Application Project Template and C++ Library Project Template which use CMake (although I have tested them only with the Makefile generator and not with the Xcode generator).
如果您需要跨平台,那么最好对所有平台使用 makefile。 Xcode 支持将 makefile 构建为“遗留项目” - 当您这样做时,您会失去一些功能/灵活性,但您仍然可以获得相同的代码浏览、源代码级调试等。
If you need to go cross-platform then it's probably better to use a makefile for all platforms. Xcode supports makefile builds as "legacy projects" - you lose some functionality/flexibility when you do this, but you still get the same code browsing, source level debugging, etc.
您尝试过 Pbxbuild 吗?
Have you tried Pbxbuild?