Qt and the Mac app store

18th March 2011

If you are using Qt on the Mac, then you are either:

  • Using qmake to generate some makefiles, which you then build on the command line
  • Using qmake to generate a Xcode project, which you then build via the Xcode IDE.

Or maybe you are just using QtCreator, in which case option 1 is being done behind the scenes for you. In any case, the output of the build will be an application bundle. To prepare this for submission to the Mac app store, you need to make sure your application's Info.plist file is valid and conforms to Apple's requirements.

Qmake .pro file

First to there are some changes required to the standard qmake .pro file, as shown below. This achieves the following:

  • Ensures the app is only built for Intel (PPC binaries are not accepted)
  • Ensures the app is build against v10.6 of the Mac SDK
  • Copies a custom Info.plist to the app bundle
  • Copies a custom icon to the app bundle
mac {
    # Only Intel binaries are accepted so force this
    CONFIG += x86

    # Minimum OS X version for submission is 10.6.6
    QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6

    # Copy the custom Info.plist to the app bundle
    plist.path = "$$DESTDIR/$$join(TARGET,,,.app)/Contents"
    plist.files = Info.plist
    INSTALLS += plist

    # Icon is mandatory for submission
    ICON = appicon.icns
}

Qmake does have a specific option to specify the Info.plist file called QMAKE_INFO_PLIST, but this did not work correctly for me.

Info.plist

The Info.plist itself can be generated by qmake, but in practice its better to maintain your own version, so you have more control over it.
For instance when building Smart Shooter, I use a different file depending on whether I'm building for the Mac app store, or building the version for direct download from my website. This allows Mac app store version to target only Mac OS X 10.6, but the other version to be compatible back to Mac OS X 10.4.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundleExecutable</key>
    <string>SmartShooter</string>
    <key>CFBundleName</key>
    <string>SmartShooter</string>
    <key>CFBundleShortVersionString</key>
    <string>1.1.3</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleIdentifier</key>
    <string>com.hartcw.SmartShooter</string>
    <key>CFBundleIconFile</key>
    <string>appicon.icns</string>
    <key>NSHumanReadableCopyright</key>
    <string>Copyright &copy; 2010-2011, Hart Codeworks Ltd.</string>
    <key>LSApplicationCategoryType</key>
    <string>public.app-category.photography</string>
    <key>LSMinimumSystemVersion</key>
    <string>10.6.6</string>
</dict>
</plist>

blog comments powered by Disqus