Importing a New or Beta SDK for Use with Elements for Cocoa

From The Elements Wiki
Jump to: navigation, search

This is a HowTo about Oxygene for Cocoa

The .fx files that Oxygene and RemObjects C# use to build against SDKs (and other third-party C or Objective-C frameworks or libraries) are not magic, and are not created or tweaked manually. You can think of them as something along the lines of "pre-compiled headers", and they can be generated semi-automatically, if you want to work with a new SDK version that we don't ship "official" support for.

Elements comes with a GUI tool called "FXGen" that you can use to generate .fx files for a new SDK easily, with a single drag and drop operation. (There's also a lower-level command line called "HeaderImporter", if you want to tinker.)

FXGen is a standalone .app, but included as part of CrossBox and you can launch it from the CrossBox Dock menu:

Launch FXGen from CrossBox.png

If you use FXGen often, you can of course keep a direct link to it in the Dock, once launched, by right-clicking the Dock icon and selecting Options|Keep in Dock.

FXGen opens as a tabbed window providing three separate import modes; for the purpose of this how-to, we'll be using the first tab, Import SDK, which initially presents as a simple area that asks you to drop in your copy of or browse for it:

Nougat FXGen SDK Import Step 1.png

To import one or more SDKs from your version of Xcode, simply locate in the Finder (for example by Cmd-clicking its Dock icon) and then drag the app into the big area of FXGen. Once you let go, FXGen will show you details about the version of Xcode you dropped in, including a list of all SDKs it found inside:

Nougat FXGen SDK Import Step 2.png

From the popup button, you can choose to either import All, or a specific version of iOS or OS X (as indicated in the example screenshot above, iOS 6.0 would be imported).

Of course, Elements for Cocoa already comes with full support for iOS 6.0, so in real life you would use FXGen not with Xcode 4.5, but with a beta version (the names and version numbers of which we cannot show here because they would be under NDA) or a newer version of Xcode — for example one could imagine that at some time during the year 2013 there will be an Xcode 4.x which contains a beta version of an iOS 7.0 SDK or an OS X 10.7 one.

Once you selected the SDK(s) you want to import, simply click Start Import and FXGen will start its work and generate a list of .fx files for all frameworks it finds in these SDKs. Depending on the size and scope of the SDKs, this can take a minute or two.

iOS 6.0, for example, generates 51 .fx files (rtl.fx and 50 frameworks from Accelerate.fx to UIKit.fx), in three versions — armv7 and armv7s versions for the device, which will then be merged to a Universal .fx, and a single i386 version for the Simulator — and OS X 10.8 generates 136 .fx files, from Accelerate.fx to WebKit.fx. Chances are that newer SDK versions will have even more frameworks.

While it is working, FXGen will show a progress indicator, and once it is done, the finished SDK import is passed off to CrossBox, where your copy of Elements for Cocoa (in Visual Studio) will automatically pick it up next time you use it and — sticking with the "made up" SDK versions from above, you will then see "iOS 7.0" or "OS X 10.9" as SDK options.