从命令行创建 Xcode 项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3518719/
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
Creating Xcode project from command line
提问by Mithun Nair
My question is how can I create and Xcode project from the command line. By create I don't mean building a project. I mean how can i create a project forlder i.e shift + cmd + N.
我的问题是如何从命令行创建和 Xcode 项目。我所说的创建并不是指构建一个项目。我的意思是如何创建一个项目文件夹,即 shift + cmd + N。
回答by Ferruccio
An Xcode project consists of the source files for the project and and .xcodeproj folder (it looks like a file, but it's actually a bundle, i.e. a folder and files within it treated by Finder as a single object).
一个 Xcode 项目由项目的源文件和 .xcodeproj 文件夹组成(它看起来像一个文件,但实际上是一个包,即一个文件夹和其中的文件被 Finder 视为单个对象)。
If you look inside the .xcodeproj folder (you can do this with the terminal app or you can right-click on the .xcodeproj bundle and select "Show Package Contents") you will see several files. The only file that matter is project.pbxproj. The format of this file is undocumented, but it is a text file and if you take a look at it, the format doesn't seem too complicated.
如果您查看 .xcodeproj 文件夹(您可以使用终端应用程序执行此操作,也可以右键单击 .xcodeproj 包并选择“显示包内容”),您将看到几个文件。唯一重要的文件是 project.pbxproj。这个文件的格式没有记录,但它是一个文本文件,如果你看一看,格式似乎并不太复杂。
To generate a project you need to create a folder with an appropriate .xcodeproj folder within it and an appropriate project.pbxproj file inside that folder. If your project needs are simple, you could always start with a canned project.pbxproj file generated by Xcode and stick it in your .xcodeproj folder.
要生成项目,您需要创建一个文件夹,其中包含一个适当的 .xcodeproj 文件夹,并在该文件夹中创建一个适当的 project.pbxproj 文件。如果您的项目需求很简单,您始终可以从 Xcode 生成的罐装 project.pbxproj 文件开始,并将其粘贴到您的 .xcodeproj 文件夹中。
回答by utahwithak
Cmake will create Xcode projects along with any other type of build file you could desire. It is heavily customizable and can handle multiple targets, dependencies, linking, and any other property you could image. It has a steep learning curve but is a very very powerful tool. We currently use cmake to genererate both the Xcode and visual studio solution from the same code base.
Cmake 将创建 Xcode 项目以及您可能需要的任何其他类型的构建文件。它是高度可定制的,可以处理多个目标、依赖项、链接和您可以想象的任何其他属性。它有一个陡峭的学习曲线,但它是一个非常强大的工具。我们目前使用 cmake 从相同的代码库生成 Xcode 和 Visual Studio 解决方案。
The simplest example of cmake is $cmake -G "Xcode" ...args...
this would create and all all the nessecary files to your project from your args.
最简单的 cmake 示例是,$cmake -G "Xcode" ...args...
这将从您的 args 创建所有必要的文件到您的项目中。
Here is the main page: http://www.cmake.org
这是主页:http: //www.cmake.org