开发者

How to convert Xcode project type from a Cocoa framework to a Cocoa application?

开发者 https://www.devze.com 2023-03-07 15:26 出处:网络
Please tell me what is the most efficient way? I need to save at least开发者_如何学C compiler / linker settings and source files structure.

Please tell me what is the most efficient way? I need to save at least开发者_如何学C compiler / linker settings and source files structure.


I need to save at least compiler / linker settings

the easy way to do this is to move the settings from the target/project settings to an xcconfig file. the xcconfig file may then be (re)used to define the build settings for multiple targets and/or projects. to do this:

  • create a new xcconfig file for each tier, target, and each configuration where you have defined settings (e.g. Project_Debug, Project_Release, Target_Debug, Target_Release), and follow these steps for each tier/combination:

    • open the build configuration settings pane for the project
    • specify one configuration.
    • hide the settings which are not defined at that level. in Xcode 3, that means you only want the bold settings to be visible.
    • select all visible settings
    • dragon drop (sic) the selection to the appropriate xcconfig file
    • assign the xcconfig file to the configuration/tier you took it from
    • finally, delete all the definitions in the build settings pane which you just copied to the xcconfig
  • repeat until all settings have been exported to separate/appropriate xcconfigs

to make life easier, you may #include one xcconfig into another xcconfig.

since an app is different from a framework, you'll have a few settings to change, delete, or move back to the framework target.

now nothing should be defined in the target or project levels (apart from your framework specific stuff), and you may easily apply the same set of build settings to any target.

and source files structure...

the easiest way here is to:

  • create a new target in your project (yup - of the app variety).

  • for each build phase in the framework:

    • verify the app has a similar build phase (e.g. compile sources, or copy resources)
    • select all the items in the framework's build phase
    • get info
    • add the references to the corresponding build phase of the app target by checking the box for the app target in the info panel (this approach assumes the references are added to the default phase for the type of reference, you may have a little extra ordering to do at this stage if your reference->target phase relations deviate from the defaults)
  • repeat

  • add your main entry
  • build and sort out the rest manually

you may want to clone the Xcode project first (as easy as duplication with git) -- and definitely make sure you have your project/sources under scm.

if you'd rather not maintain these in parallel, then move it all over to a static library, then just link each target to the static lib.

gooood luck!

(the question was initially asked regarding Xcode 3 - some differences will exist in Xcode 4. the process should be the same in Xcode 2)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号