How can I automate the creation of XCode projects within a terminal? If you are asking the purpose of this... I wish to create a service that can automatically create multiple different projects for different users.
I believe this is possible with AppleScript, but this would be a big drain of ressources since it would open XCode. Also, this would most likely take a lot of time to create multiple projects.
*Edit: The use of AppleScript is definitely not what I am searching for in terms of performant solution.
I have looked into CMake, but I am a bit lost and confused with the documentation given for it...
*Edit: I have found the following for a CMakeLists.txt at https://gist.github.com/740257. Yet, the settings have to be modified.
# See original post at http://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")
I will build my own solution from that file. For instance, I know that the SDK version is wrong.
Are there some Developer Tools (that comes with XCode 4.2.1) for the Terminal that I could leverage for my situation?
Try https://github.com/CocoaPods/Xcodeproj. It's a ruby gem that allows to create and modify xcode projects. You could use it in your scripts.
Example usage:
~/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
See documentation here: http://rubydoc.info/gems/xcodeproj/frames
Hope this will help you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With