从 Xcode 项目生成 Makefile 以将项目移植到其他 UNIX 系统
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2471648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Generate Makefile from Xcode Project for port of project to other UNIX systems
提问by Manfred R. Koethe
(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.
(之前有人问过这个问题,但答案并不确定)虽然我喜欢使用 Xcode (3.2.1) 进行开发,但我需要将一些项目移植到其他 UNIX 系统,甚至是 Windows。代码都是C++,但相当复杂。我正在寻找一种从我的 Xcode 项目中自动/半自动生成等效 Makefile 的方法,在厌倦了通过手动试错来做到这一点之后。
Thanks for any hints.
感谢您的任何提示。
Manfred
曼弗雷德
回答by Michael Aaron Safyan
You should probably switch to CMakefor 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 Templateand C++ Library Project Templatewhich use CMake (although I have tested them only with the Makefile generator and not with the Xcode generator).
您可能应该为所有平台切换到CMake。反过来,CMake 可以使用 CMake 项目描述生成 Makefile、Xcode、Visual Studio 和 KDevelop 项目/构建。首先,您需要为您的项目创建一个 CMake 描述,但是如果您只更新 CMake 项目,那么从 CMake 到 Xcode 是非常容易的。或者您可以使用 Makefile 生成器并创建一个基于 Makefile 的 Xcode 项目。要开始使用 CMake,您应该阅读CMake wiki,查看CMake 手册,如果您愿意,可以查看我的C++ 应用程序项目模板和C++ 库项目模板使用 CMake(虽然我只使用 Makefile 生成器而不是 Xcode 生成器测试了它们)。
回答by Paul R
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.
如果您需要跨平台,那么对所有平台使用 makefile 可能更好。Xcode 支持将 makefile 构建为“遗留项目”——当你这样做时,你会失去一些功能/灵活性,但你仍然可以获得相同的代码浏览、源级调试等。