It's now time to take a deeper look at how Marmalade handles the deployment process. If you've been following the sample code, you may be wondering how we are able to make a deployment package that contains all the necessary resource files in order to function. Or, if we're creating multiple resource sets, how do we choose which one to pair with our code when creating the installer package?
We also need a way of including icons and captions that will be used to represent our application when installed on a device.
All of this magic occurs in the MKB file, and the following sections aim to explain exactly what you have to do.
The deployments
section of the MKB file is where we can set all manner of attributes that will be applied to the final installation package of our application. There are a huge number of deployment options that can be specified, some of which are global to all supported platforms and some that are operating system specific.
The following table lists several of the more immediately useful attributes, but you should go to Marmalade | Marmalade Development Tools Reference | MKB File Settings | Deployment Options in the Marmalade documentation for full details.
Attribute |
Description |
---|---|
|
Specifies which asset group to use in a deployment. This will be explained in greater detail in the following sections. |
|
Specifies the name of the deployment. This name will be used for the name of the installation directory, the executable file, and the installation package file. If this value is not specified, the filename of the MKB file will be used instead. |
|
This is the name that will be used to identify the application once installed on the device—for example, the text that appears underneath a program icon. If no caption is specified, the |
|
Allows an alternative file to be specified for use instead of the default |
|
Specifies the version number of the application. It should be provided in the form |
|
An alternative way of specifying the version number. Each of these attributes should be followed by a number representing the respective part of the version number. |
|
Sets the icons for use in iOS deployment. These settings specify a filename to an icon of suitable format and dimension to be used as the specified icon type. |
|
Sets the filenames containing the icons for use on Android deployments. |
|
Specifies the file to be used for the icon on Bada deployments. |
As you can see, there are options for specifying the icon files for most platforms and indeed there are further platform-specific attributes for specifying information such as application signing keys.
You should check out the aforementioned page of the Marmalade documentation for further details on this, as you will be unable to produce final deployment packages for submission purposes without this information.
We need some way of listing all the resource files that have to be included in the deployment package so our game can run. Marmalade allows us to do this by way of the assets
section of the MKB file. Here's an example from this chapter's version of the Skiing project:
assets { [common] (data) sound/music.mp3 [normal] <include common> (data-ram/data-gles1) skiing.dz [highres] <include common> (data-ram/data-highres) skiing.dz }
This small example demonstrates most of the functionality available in the assets
section. First, you will notice the use of square brackets to create named groups of assets. In the example we have asset groups called common
, normal
, and highres
.
Normal brackets are used to specify a directory, relative to the directory containing the MKB file, where files that need to be included in the deployment package can be located. This is then followed by the files themselves. You can have any number of these blocks of files in an asset group.
The important thing to remember about how directories and files are specified in an asset group is that the directory in brackets becomes the root path of the application's installation directory on the device. Let's illustrate this by looking at an example.
First we have the common
asset group, which specifies that the file called sound/music.mp3
can be found in the data
directory. When installed on the device, the music.mp3
file will be written into a subdirectory called sound
in the application's installation directory.
Now let's consider the asset group called normal
. Here the path to the file is completely enclosed in the brackets and just the name of the file, skiing.dz
, is specified. This will result in the skiing.dz
file being written into the application's installation directory.
There is one final feature of the assets section demonstrated by the example, which is the ability to include an asset group from within another asset group. This is done using the include
keyword, which is enclosed in angle brackets along with the name of the asset group to be included.
Looking at the example we can see that both the normal
and highres
asset groups include the common
asset group.
We can now look at
creating different configurations for different devices. The deployments
sections of the MKB file also allows us to create different deployment types by specifying a name in square brackets. All settings that are made after this will only apply to that deployment type. Settings can be applied globally across all deployment types by specifying them with square brackets before defining a deployment type.
It is possible to limit a deployment type to a certain set of mobile platforms by following the name in square brackets with a platform identifier or a comma-separated list of platforms in quote marks.
A full list of all the platforms supported by Marmalade at the time of this writing is provided in the following table:
Platform |
Notes |
---|---|
|
Specifies the Android operating system. |
|
Any iOS-based device—iPhone, iPod touch, or iPad. |
|
Targets the Samsung Bada platform. |
|
Specifies the LG Smart TV system. |
|
For targeting the Blackberry Playbook tablet. |
|
Builds an application that runs on Symbian 9 S60 or Symbian ^3 devices. |
|
Targets the webOS platform, the best known device being the now discontinued HP TouchPad. |
|
Allows for Windows Mobile 6 device support. Note that Marmalade cannot target Windows Phone 7. |
|
For x86 Windows builds. |
|
For x86 Apple Mac builds (when using the Mac version of Marmalade). |
It is not mandatory to specify a platform list in a deployment type. If no list is given, it is assumed that any platform is a valid target.
Once a deployment
type has been specified, any attributes will only apply to that deployment type. This is particularly useful to us for being able to specify different sets of resources. By using the assets
attribute we can specify the asset group that we want to be included in the final deployment package. The following example of the deployments
section is taken from the Skiing project for this chapter.
deployments { name="SkiingC8" caption="SkiingC8" [normal] assets=normal [highres] assets=highres }
To create an installation package for a particular deployment type, all we have to do is follow the same deployment instructions provided in Chapter 1, Getting Started with Marmalade, of this book to start up the Marmalade System Deployment Tool. The second page of this application allows us to choose the deployment types that we want to create by clicking on checkboxes, as shown in the following screenshot:
This page does allow you to create and modify deployment types by way of the Add <config>, Copy <config>, and Remove <config> buttons, but I personally prefer specifying them by hand in the MKB file. Using these buttons modifies the MKB file accordingly.
Once you have progressed through all the pages of the deployment tool and made the deployment packages, they can be found in the folder build_projectname_vcxxdeployments
, where projectname
is the name of the MKB file and vcxx
refers to the version of Microsoft Visual C++ that you are using for development.
18.221.117.214