如何在终端中自动创建XCode项目?如果您要问这个目的……我希望创建一个可以为不同用户自动创建多个不同项目的服务.
ApplesScript
我相信AppleScript可以实现这一点,但这会耗尽资源,因为它会打开XCode.此外,这很可能需要花费大量时间来创建多个项目.
*编辑:AppleScript的使用绝对不是我在高性能解决方案方面所寻求的.
CMake的
我已经看过CMake,但是我有点迷失并且对它给出的文档感到困惑……
*编辑:我在https://gist.github.com/740257找到了CMakeLists.txt的以下内容.但是,必须修改设置.
# See original post at https://stackoverflow.com/questions/822404/how-to-set-up-cmake-to-build-an-app-for-the-iphone cmake_minimum_required(VERSION 2.8) cmake_policy(SET CMP0015 NEW) cmake_policy(SET CMP0016 NEW) project(test) set(NAME test) file(GLOB headers *.h) file(GLOB sources *.cpp) SET (SDKVER "4.1") SET (DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer") SET (SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk") SET (CMAKE_OSX_SYSROOT "${SDKROOT}") SET (CMAKE_OSX_ARCHITECTURES "$(ARCHS_UNIVERSAL_IPHONE_OS)") #Other 'CMAKE_OSX_ARCHITECTURES' iPhone/IOS option examples #SET (CMAKE_OSX_ARCHITECTURES "armv6" "armv7") #SET (CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) set(CMAKE_CXX_FLAGS "-x objective-c++") set(CMAKE_EXE_LINKER_FLAGS "-framework AudioToolBox -framework CoreGraphics -framework QuartzCore -framework UIKit" ) link_directories(\${HOME}/\${SDKROOT}/lib) set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.mycompany.\${PRODUCT_NAME:identifier}") set(APP_TYPE MACOSX_BUNDLE) add_executable(${NAME} ${APP_TYPE} ${headers} ${sources} ) target_link_libraries(${NAME} # other libraries to link ) # code signing set_target_properties(${NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: My Name")
我将从该文件构建自己的解决方案.例如,我知道SDK版本是错误的.
终端工具
是否有一些开发人员工具(XCode 4.2.1附带)可以用于我的情况?
解决方法
尝试
https://github.com/CocoaPods/Xcodeproj.它是一个ruby gem,允许创建和修改xcode项目.您可以在脚本中使用它.
用法示例:
~/code/temp % irb 18:17 irb(main):001:0> require 'rubygems' => true irb(main):002:0> require 'xcodeproj' => true irb(main):003:0> project = Xcodeproj::Project.new => #<Xcodeproj::Project:0x400dfc080 @plist={"archiveVersion"=>"1","classes"=>{},"objectVersion"=>"46","objects"=>{"ED69A76A86EE4CBD96F96E4D"=>{"isa"=>"PBXGroup","sourceTree"=>"<group>","children"=>[]},"17739AA030054D088B3B573E"=>{"attributes"=>{"LastUpgradeCheck"=>"0420"},"compatibilityVersion"=>"Xcode 3.2","developmentRegion"=>"English","hasScannedForEncodings"=>"0","knownRegions"=>["en"],"mainGroup"=>"ED69A76A86EE4CBD96F96E4D","projectDirPath"=>"","projectRoot"=>"","targets"=>[],"isa"=>"PBXProject"}},"rootObject"=>"17739AA030054D088B3B573E"} @objects=<PBXObjectList: ["#<PBXGroup UUID: `ED69A76A86EE4CBD96F96E4D',name: `'>","#<PBXProject UUID: `17739AA030054D088B3B573E',name: `'>"]>> irb(main):004:0> project.save_as('MyProject') => true
请参阅此处的文档:http://rubydoc.info/gems/xcodeproj/frames
希望对你有帮助!