将现有的c ++项目导入Xcode IDE

将现有的c ++项目导入Xcode IDE

问题描述:

我试图在XCode中打开一个现有的C ++开源库,以使用我自己的修改/添加来发布它。库是 Tesseract-OCR ,其中不包括 .xcodeprojet 文件。

I am trying to open an existing C++ open-source library in XCode to publish it with my own modification/additions. The library is Tesseract-OCR, which does not include a .xcodeprojet file.

由于XCode可以作为一个IDE,是否可以打开一堆文件作为一个单一的项目在XCode?是否有一个简单的方法来生成XCode项目?

Since XCode can function as an IDE, is it possible to open a bunch of files as a single project in XCode? Is there an easy way to produce an XCode project?

有几种方法可以做到, IDE集成。没有直接的方法将基于Makefile的项目导入Xcode。您可以通过Makefile创建构建 的项目,但是您不会获得使用IDE的许多好处,因为编辑器功能(如字完成)依赖于Xcode能够解析文件在项目中。你将能够使用调试器。要做到这一点,创建一个新的项目,并添加一个脚本生成阶段只需调用Makefile的自定义目标。

There are several ways you could do it, depending on the level of IDE integration you want. There's no direct way of importing a Makefile-based project into Xcode. You can create a project that builds via the Makefile, but you wouldn't get many of the benefits of using an IDE, since the editor features such as word completion rely on Xcode being able to parse the files in the project. You will be able to use the debugger though. To do this, create a new project and add a custom target with a script build phase that just calls down to Makefile.

如果你正在编译的项目非常容易地,即,不需要设置大量的宏,包括路径等,则可以简单地创建空项目并且仅将所有源文件添加到其中。我已经广泛使用这种方法来构建boost库。如果这是一个配置&& make 类型项目,那么您可能必须首先运行配置步骤,并确保项目中包含任何顶级 config.h 文件。

If however the project you're building compiles very easily, ie without requiring a lot of macros to be set up, include paths, etc, then it may be simple to just create an empty project and merely add all source files to it. I've used this method extensively for building boost libraries. If this is a configure && make type project then you will probably have to run the configure step first, and ensure any top level config.h files are included in the project.

如果项目有一个复杂的makefile,那么它可能是一个涉及的任务来创建一个有用的Xcode项目

If the project has a complex makefile then it is likely to be an involved task to create a useful Xcode project