Skip to content

Creating Release Builds

Ravbug edited this page May 20, 2020 · 13 revisions

macOS

For testing:

  1. Select either the Dynamic or Static app scheme from the scheme selector.
  2. Select Product -> Scheme -> Edit Scheme menus.
  3. Select Release from the Build Configuration dropdown, then press Close. release build configuration
  4. By default wxWidgets' build architecture is set to a deprecated version (i386) and will not compile correctly on release mode. Follow the steps below to fix this:
    • Open wxcocoa.xcodeproj using the left sidebar
    • Select the Target your app scheme is using
    • Under Build Settings, change Architectures to anything except i386. wxcocoa correct build configuration
  5. Build and Run your app.

For Distribution:

  1. Select either the Dynamic or Static app scheme from the scheme selector.
  2. Follow Step 4 above (unless you have already done it)
  3. Press Product -> Archive menus. This will create a special release build, open the Archives window, and select the archive automatically.
  4. In the Archives window right sidebar, press Distribute Content. Select Build Products on the popup dialog, then press Next. Xcode archives dialog
  5. Choose a location to write the archive, and a name for the archive.
  6. Open the folder which Xcode wrote, in the location where you told it to, and expand the Products/Applications Folder. Your release built application is located inside there. If you have no external libraries, you do not need the other folders it creates.
  7. (Optional) In the archives dialog, delete the archive (Right click -> Delete Archive)

Windows

For Testing

  1. Select Release for your current Platform from the dropdown in the main menu.

Release mode dropdown

  1. Run the release build in the debugger using the green triangle button. Note that debugging release-mode builds is more difficult than debug-mode builds.

For Distribution

  1. Go to Build -> Batch Build
  2. Check the boxes for application next to Release Win32 and Release x64 and press Rebuild

Batch Build dialog 3. The x86 build is located inside Release/, and the x64 build is located inside x64/Release. You should only need to distribute the .exe files.

Linux

Cross-compilation note!

For best compatibility, compile your release build on the oldest operating system that you support to avoid issues with glibc on other operating systems. For example, I use Ubuntu LTS 18.04 to generate release builds.

For testing

  1. Run make clean && make release. The resulting executable is located in linux-build/.

Packaging for release

The preferred way to generate a release for your users to download is by using AppImage. This template project provides a Make target which will generate an AppImage file out of your code. AppImageTool will be downloaded automatically for your platform and stored in the temporary build directory.

  1. If you are linking any libraries dynamically, Modify linux-pkg.sh to ensure that all dynamic libraries and other dependencies get included in the packaged app.
  2. Run make linux-pkg. A .AppImage file is generated in the linux-build project directory. It is an executable that is ready to be delivered to your users.
    • To make an AppImage with different flags for wxWidgets, assign them to the WXFLAGS variable: make linux-pkg WXFLAGS=--with-opengl or edit the WXFLAGS assignment in the makefile. The latter is preferred.
    • To make an AppImage with a dynamically linked wxWidgets, simply add Dynamic=1 to your command: make linux-pkg Dynamic=1. This is not compatible with monolithic! If you want to use the monolithic library, you must edit linux-pkg.sh to copy the monolithic shared library instead of the separated libraries.

If you do not want to make an AppImage, for example to submit to a package manager, use the release target instead. With this target, you must manage any shared libraries manually.