Documentation for Ice 3.4. The latest release is Ice 3.7. Refer to the space directory for other releases.

The Xcode plug-in for Ice manages all aspects of code generation, including automatically recompiling Slice files that have changed, removing obsolete generated classes, and tracking dependencies.

On this page:

Adding Slice Files to an Xcode Project

To add an existing Slice file, select a folder in the project, select File, and choose Add -> Existing Files...

To create a new Slice file, select a folder in the project, select File, and choose New -> New Files... Select the Other category and choose Empty File as the file type. Save the file with a .ice extension.

Configuring Xcode Project Settings

The Xcode plug-in is configured using the per-target info build settings, just as you would configure the compiler settings. Select a target, and then select the build settings tab, and enter Slice in the Search in Build Settings field.

  • Header Directory
    Directory to use as the header include directory in source files.
  • Header Search Paths
    The list of directories to search for included Slice files (-I option). Note that the Ice Slice files are automatically in the header search path.
  • Ice Home
    If you are building with the Ice Touch Xcode SDK, this should be left unset; otherwise, if using the command-line toolkit or regular Ice, set this to the location of the installation (/opt/Ice-3.4.2 or /opt/IceTouch-1.2).
  • Output Directory
    Directory to place files generated by the Slice compiler.
  • Permit `Ice' prefix
    Pass --ice to the Slice compiler.
  • Streaming support
    Pass --stream to the Slice compiler (C++ only).
  • Checksum support
    Pass --checksum to the Slice compiler (C++ only).
  • Preprocessor Macros
    Set the list of preprocessor macros to define (-D option).
  • Translate C++ code
    Leave this option unset for an SDK build. For non-SDK builds, setting this option means slice2cpp is used to compile the Slice files; otherwise, slice2objc is used.
  • Underscore support
    Permit underscores in Slice identifiers.

You can also define Slice compiler options for individual Slice source files. Select your project in the Project Navigator, select the relevant target (you may have only one), then select the Build Phases tab, expand the Compile Sources phase and the Compiler Flags column lets you set each file's options for that target.

Xcode Project Settings for Cocoa and iPhone Applications

For Cocoa and iPhone applications, which use the Xcode SDK, you must add the appropriate directory to Additional SDKs:

 
Ice Touch 1.2.1 or later
Ice Touch 1.2.0
Objective-C SDK/Library/Developer/IceTouch-1.2/SDKs/ObjC/$(PLATFORM_NAME).sdk$(DEVELOPER_DIR)/SDKs/IceTouch-1.2/$(PLATFORM_NAME).sdk
C++ SDK/Library/Developer/IceTouch-1.2/SDKs/Cpp/$(PLATFORM_NAME).sdk$(DEVELOPER_DIR)/SDKs/IceTouchCpp-1.2/$(PLATFORM_NAME).sdk

 

In addition, when creating a new iPhone Xcode project, you must set the Code Signing Resource Rules Path to:

$(SDKROOT)/ResourceRules.plist

You must also add the following to the Frameworks folder:

CFNetwork.framework
Security.framework
Foundation.framework

When using the Objective-C SDK you must also add the following to the Frameworks folder:

ExternalAccessory.framework

Configuring Non-SDK Builds

For non-SDK builds, you must add the location of the Ice installation to the header path (/opt/Ice-3.4.2/include for Ice 3.4.2, or /opt/IceTouch-1.2/include for Ice Touch).

In addition, for non-SDK builds, you must correctly configure Other Linker Flags:

  • For Ice 3.4.2: -L/opt/Ice-3.4.2/lib -lIce -lIceUtil
  • For Ice Touch 1.2.0: -L/opt/IceTouch-1.2/lib -lIceObjC

To be able to run the project from Xcode, you must set DYLD_LIBRARY_PATH correctly. In Xcode, select Product/Edit Scheme, select the scheme you want to run, then select the Arguments tab and add the following to the Environment Variables section:

  • Name=DYLD_LIBRARY_PATH
  • Value=/opt/Ice-3.4.2/lib (for Ice 3.4.2)
  • Value=/opt/IceTouch-1.2/lib (for Ice Touch 1.2.0)

Generating Code using Xcode

The plug-in compiles a Slice file whenever you build the project. The extension tracks dependencies among Slice files in the project and recompiles only those files that require it after a change.

See Also

  • No labels