Learn how to create a self-sufficient executable of a Corona-built application for Windows

In this tutorial you will learn how to pack Corona-built executable along with required files: DLLs, lua scripts and assets. It's a good idea to have a single exe file if one wants to hide his assets, simplify distribution, or even hide the way the application was built.

You can get the sample files on GitHub.

What is Corona?

Corona is a framework that allows to create 2D applications for mobile platforms, Windows and MacOS from a single source code. Developers write code in lua, add assets and build their graphical applications with the help of Corona.

Alexa says that Corona popularity is growing up:

The sample

For this tutorial let's take a standard sample application "Clock" that is available at Program Files (x86)\Corona Labs\Corona\Sample Code\GettingStarted\Clock after installlation Corona SDK.

Run Corona Simulator, click to Open Project, then select Program Files (x86)\Corona Labs\Corona\Sample Code\GettingStarted\Clock\main.lua.

Corona Simulator shows the application screen immediately:

To build the Win32 executable click to File - Build - Windows. You are prompted to choose an output folder (I've choosen I:\Projects\Corona\Clock.out), where the application files will be placed:

Click to Build. In a moment the build is done and you are asked what to do next:

Click to View in Explorer. You will get some set of files (yes, there are a lot):

|   ALmixer.dll
|   Clock.exe
|   CoronaLabs.Corona.Native.dll
|   lua.dll
|   msvcp120.dll
|   msvcr120.dll
|   OpenAL32.dll
|   pthreads.dll
|   vccorlib120.dll
|   
\---Resources
    |   Icon-hdpi.png
    |   Icon-ldpi.png
    |   Icon-mdpi.png
    |   Icon-xhdpi.png
    |   Icon-xxhdpi.png
    |   Icon-xxxhdpi.png
    |   Icon.png
    |   ReadMe.txt
    |   resource.car
    |   widget_theme_android.png
    |   widget_theme_android@2x.png
    |   widget_theme_android_holo_dark.png
    |   widget_theme_android_holo_dark@2x.png
    |   widget_theme_android_holo_dark@4x.png
    |   widget_theme_android_holo_light.png
    |   widget_theme_android_holo_light@2x.png
    |   widget_theme_android_holo_light@4x.png
    |   widget_theme_ios.png
    |   widget_theme_ios7.png
    |   widget_theme_ios7@2x.png
    |   widget_theme_ios7@4x.png
    |   widget_theme_ios@2x.png
    |   widget_theme_onOff_mask.png
    |   widget_theme_onOff_mask_android_holo.png
    |   widget_theme_pickerWheel_mask.png
    |   
    +---Images.xcassets
    |   |   Contents.json
    |   |   
    |   \---AppIcon.appiconset
    |           Contents.json
    |           Icon-1024.png
    |           Icon-120.png
    |           Icon-152.png
    |           Icon-167.png
    |           Icon-180.png
    |           Icon-40.png
    |           Icon-58.png
    |           Icon-76.png
    |           Icon-80.png
    |           Icon-87.png
    |           
    +---LaunchScreen.storyboardc
    |       01J-lp-oVM-view-Ze5-6b-2t3.nib
    |       designable.storyboard
    |       Info.plist
    |       UIViewController-01J-lp-oVM.nib
    |       
    \---sampleUI
            back-darkgrey.png
            back-darkgrey@2x.png
            back-darkgrey@4x.png
            infobutton.png
            infobutton@2x.png
            infobutton@4x.png
			

Run Clock.exe to ensure it works as expected:

So far so good. It's time to make a single executable.

Packing

If you don't have BoxedApp Packer yet please install it.

Start BoxedApp Packer. Click to Select - Browse..., choose Clock.exe. This is an input executable. The path of packed executable is set to output\Clock.exe automatically.

Switch to Files section, select Application Directory and add the files that should be placed in the application directory. To do this click to Add Files... and select required files.

The application also needs some files in the directory Resources. Click to Import Directory... and select Resources.

Here is what you get:

Click to Build and then run packed executable. It's a single file and it works well: