是否可以自动生成Xcode项目?

时间:2009-07-11 16:59:00

标签: xcode scons

简单的问题。是否有任何工具可以从命令行生成Xcode项目?我们使用SCons构建我们的跨平台应用程序,但这不支持内在的Xcode项目生成。我们希望避免手动创建项目,因为这将涉及维护多个文件列表。

7 个答案:

答案 0 :(得分:4)

看看CMake。您可以自动从中生成XCode项目。我找到了之前关于其使用情况的StackOverflow问题here。要让它生成一个XCode项目,你可以这样使用它:

CMake -G xcode

答案 1 :(得分:3)

您可以使用预制(http://industriousone.com/premake)来生成Xcode项目。它还可以生成Visual Studio项目。

答案 2 :(得分:1)

Qt工具链中的qmake生成Xcode项目。您至少可以下载它并查看其来源here(LGPL)。

答案 3 :(得分:1)

我认为你的问题应该是“有没有办法从SCons生成一个XCode项目?”。我想,通过你的询问和阅读其他人,答案是'不'。

SCons people应该更清楚地了解它。如果你贡献一个SCons Xcode项目生成器,我想他们会很高兴。

与此同时,您可以选择切换到CMake或手动创建XCode项目,如果有一个良好的源树组织,可能是最好的实用解决方案。

答案 4 :(得分:1)

为了任何关于这个问题的人的利益,我实际上只是把an Xcode project file generator for SCons推到了Bitbucket。

答案 5 :(得分:0)

您可以使用名为waf的基于python的构建系统生成XCode项目。您需要使用xcode6扩展名download and install 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

这将创建一个waf可执行文件,可以构建您的项目。您需要配置如何在名为wscript的文件中生成XCode项目,该文件应驻留在项目文件夹中。 wscript文件使用Python语法。以下是an example如何配置项目:

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'
    )

您可以使用许多设置为项目配置它。

然后实际生成XCode项目cdwscript所在的项目文件夹中并运行waf可执行文件,如

$ ./waf configure xcode6

答案 6 :(得分:-1)

您可以使用Automator为您生成它们。

我查了一下,没有预先建立的动作。 因此,您必须使用Automator记录您的操作才能执行此操作。

相关问题