Skip to content

Building on macOS

Tiger Kaovilai edited this page Feb 4, 2024 · 4 revisions

Overview

Before You Start

You should be at least moderately comfortable with Git, CMake, and the command line before relying on this method. It requires a good bit of free hard drive space due to the large amount of dependencies required for the build (see below) and is meant for programmers that want to help discover and fix programming errors. When in doubt go for binaries instead!

How to Build InputLeap.app on MacOS

as of May 2020

  • Install Xcode from the App Store or download and install it from the Apple Developer Website
  • Install either MacPorts or Homebrew following the instructions on their websites
  • Install dependencies with either MacPorts or Homebrew (see below)
  • Build either the Debug or the Release targets (see below)

Install dependencies with MacPorts

  • Install packages for Qt5, OpenSSL, and PkgConfig
sudo port install qt5 openssl pkgconfig

Install dependencies with Homebrew

  • Install packages for Qt5, OpenSSL, and pkgconfig
brew install qt5 openssl pkg-config cmake

Clone the repository

git clone https://github.com/input-leap/input-leap
  • Change directories into the cloned repository
cd input-leap

Build the Debug target

The debug target produces un-stripped binaries that have symbols that can be used for debugging.

  • Build the Debug target using the clean_build.sh script
./clean_build.sh

By default the resulting binaries will be in ./build/bin and the application bundle (.app) will be in ./build/bundle. The debug target does not create a disk image (dmg).

Build the Release target

The release target produces smaller stripped binaries and distributable disk image. This is probably what you want if you are a user.

  • Build the Release target using the clean_build.sh script with environment variables

This step assumes the use of a bourne-like shell (i.e. bash). If using another shell like csh change the export command to use setenv instead.

export B_BUILD_TYPE=Release
./clean_build.sh

By default the resulting binaries will be in ./build/bin and the application bundle (.app) will be in ./build/bundle. The release target also creates a disk image (dmg).

Code signing the .app

If you do not code sign the .app inside the bundle folder, a crash can occur when you try to run it depending on your system configuration. The crash report will show the Termination Reason as:

...
Termination Reason:    Namespace CODESIGNING, Code 2 Invalid Page"
...
  • Sign the InputLeap.app bundle to prevent this crash
codesign --force --deep --sign - ./build/bundle/InputLeap.app

You do not need to have set up a signing identity with apple for this to prevent the crash.

Notes

A build_env.sh file can be created for persistent build environment variables without being tracked by git