xcode 是否可以自动生成Xcode项目?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1114140/
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
Is it possible to automatically generate Xcode projects?
提问by Nick Bolton
Simple question. Are there any tools for generating Xcode projects from the command line? We use SCons to build our cross-platform application, but that doesn't support intrinsic Xcode project generation. We'd like to avoid creating the project manually, since this would involve maintaining multiple file lists.
简单的问题。是否有任何工具可以从命令行生成 Xcode 项目?我们使用 SCons 来构建我们的跨平台应用程序,但这不支持内在的 Xcode 项目生成。我们希望避免手动创建项目,因为这会涉及维护多个文件列表。
采纳答案by IlDan
I think that your question should be "Is there a way to generate an XCode project from a SCons one?". I suppose, by your asking and by reading the others, that the answer is 'no'.
我认为您的问题应该是“有没有办法从 SCons 生成 XCode 项目?”。我想,通过你的提问和阅读其他人,答案是否定的。
SCons peopleshould know it better. I think they will be happy if you contribute a SCons Xcode project generator.
SCons 的人应该更了解它。我认为如果你贡献一个 SCons Xcode 项目生成器,他们会很高兴。
In the meantime you may choose to switch to CMake or to create your XCode project by hand that, given a good source tree organization, may be the best pragmatic solution.
与此同时,您可以选择切换到 CMake 或手动创建您的 XCode 项目,鉴于良好的源代码树组织,这可能是最好的务实解决方案。
回答by Jared Oberhaus
回答by Mircea Ispas
You can use premake (http://industriousone.com/premake) to generate Xcode projects. It can also generate Visual Studio projects.
您可以使用 premake ( http://industriousone.com/premake) 生成 Xcode 项目。它还可以生成 Visual Studio 项目。
回答by alastair
For the benefit of anyone who lands on this question, I've actually just pushed an Xcode project file generator for SConsup to Bitbucket.
为了解决这个问题的任何人的利益,我实际上只是将SCons 的 Xcode 项目文件生成器推送到 Bitbucket。
回答by Barry Wark
回答by mrmclovin
You can generate a XCode project using the python based build system called waf. You need to download and install wafwith the xcode6 extension:
您可以使用名为waf 的基于 python 的构建系统生成 XCode 项目。您需要下载并安装带有 xcode6 扩展的 waf:
$ curl -o waf-1.9.7.tar.bz2 https://waf.io/waf-1.9.7.tar.bz2
$ tar xjvf waf-1.9.7.tar.bz2
$ cd waf-1.9.7
$ ./waf-light --tools=xcode6
That will create a waf
executable which can build your project. You need to configure how to generate your XCode project inside a file called wscript
that should reside in your project folder. The wscript
file uses Python syntax. Here's an exampleof how you could configure your project:
这将创建一个waf
可以构建您的项目的可执行文件。您需要配置如何在一个名为的文件中生成您的 XCode 项目,该文件wscript
应位于您的项目文件夹中。该wscript
文件使用 Python 语法。以下是如何配置项目的示例:
def configure(conf):
# Use environment variables to set default project configuration
# settings
conf.env.FRAMEWORK_VERSION = '1.0'
conf.env.ARCHS = 'x86_64'
# This must be called at the end of configure()
conf.load('xcode6')
# This will build a XCode project with one target with type 'framework'
def build(bld):
bld.load('xcode6')
bld.framework(
includes='include',
# Specify source files.
# This will become the groups (folders) inside XCode.
# Pass a dictionary to group by name. Use a list to add everything in one
source_files={
'MyLibSource': bld.path.ant_glob('src/MyLib/*.cpp|*.m|*.mm'),
'Include': bld.path.ant_glob(incl=['include/MyLib/*.h', 'include'], dir=True)
},
# export_headers will put the files in the
# 'Header Build Phase' in Xcode - i.e tell XCode to ship them with your .framework
export_headers=bld.path.ant_glob(incl=['include/MyLib/*.h', 'include/MyLib/SupportLib'], dir=True),
target='MyLib',
install='~/Library/Frameworks'
)
There are a bunch of settings you can use to configure it for your project.
您可以使用许多设置来为您的项目配置它。
Then to actually generate the XCode project, cd
into your project folder where the wscript
is and run your waf
executable like
然后实际生成 XCode 项目,cd
到您的项目文件夹中,wscript
并运行您的waf
可执行文件,例如
$ ./waf configure xcode6
回答by Brock Woolf
You could use Automator to generate them for you.
您可以使用 Automator 为您生成它们。
I checked and there is no prebuilt action. Therefore you would have to record your actions with Automator to do this.
我检查过,没有预先构建的操作。因此,您必须使用 Automator 记录您的操作才能执行此操作。