HeaderImporter (Legacy)

HeaderImporter is the command line tool behind FXGen that does the bulk work of importing new Cocoa SDKs or Cocoa and Island libraries into .fx Files for use with the Elements compiler.

HeaderImporter.exe is a .NET executable that can be run on Windows, and on Mac via Mono. It's a tool designed mainly for internal use, and as such its command line options are not for the faint of heart. We recommend not running HeaderImporter.exe directly, but instead running a Train script leveraging the functions exposed by generate.train. Train uses JavaScript scripts.

You can run these from the command line by simply passing the script to the train executable, once Train has been installed.

train myImportScript.train

Example Train Scripts for HeaderImporter

Import one or more new SDKs:

hi = "/path/to/HeaderImporter.exe";
include("generate.train");

var base = '/Users/mh/Code/Toffee_SDKs'; // target folder
var developerFolder = '/Applications/Xcode-Beta.app/Contents/Developer';

processiOSSDK('12.0');
processmacOSSDK('10.14');

Note: generate.train is written to be forward-looking, but if new SDKs contain drastic changes such as new CPU architectures or structural changes, we may need to update the file before it can support the new SDKs. If you run into any problems, Please contact our support.

Import a simple static library:

hi = "/path/to/HeaderImporter.exe";
include("generate.train");

var base = '/Users/mh/Code/Toffee_SDKs'; // where the SDK .fx files are
var developerFolder = '/Applications/Xcode-Beta.app/Contents/Developer';
iOSSdkVersion="8.0" ;  // optionally, pick a target SDK
OSXSdkVersion="10.10"; // optionally, pick a target SDK

processiOSLibrary({
    library: "libsqlite3.dylib",
    headers: ["sqlite3.h;"],
    explicitHeaders: true,
    link: ["sqlite3"],
    includePaths: ["$(iOS)/usr/include/"],
    namespacePrefix: "libsqlite3",
    architectures: standardiOSArchitectures()
});
processOSXLibrary({
    library: "libsqlite3.dylib",
    headers: ["sqlite3.h;"],
    explicitHeaders: true,
    link: ["sqlite3"],
    includePaths: ["$(macOS)/usr/include/"],
    namespacePrefix: "libsqlite3",
    architectures: standardOSXArchitectures()
});

Import a "fake" iOS 7.0-and-older framework (i.e. a static library packaged as .framework for IDE convenience, as was common practice before full framework support came to iOS):

hi = "/path/to/HeaderImporter.exe";
include("generate.train");
var base = '/Users/mh/Code/Toffee_SDKs'; // where the SDK .fx files are

processiOSFakeFramework({
    framework: "~/Downloads/google-plus-ios-sdk-1.5.1/GooglePlus.framework",
    link: ["c++"]
});
processiOSFakeFramework({
    framework: "~/Downloads/google-plus-ios-sdk-1.5.1/GoogleOpenSource.framework",
    link: ["c++"]
});

Import an OS X Framework:

hi = "/path/to/HeaderImporter.exe";
include("generate.train");
var base = '/Users/mh/Code/Toffee_SDKs'; // where the SDK .fx files are

processOSXFramework({
    framework: "/Users/mh/Code/rofx-xcode/Bin/Debug/RemObjectsSDK.framework",
    link: ["libxml2"],
    headers: [] // default is just the header named after the framework ("main header")
    //allHeaders: true // import all headers, NOT just the main one
});