Wiki

Clone wiki

karhu / karhubuild

This is the command line tools that deals with building, deploying and running a project on the available devices. Note that currently Windows cannot be used for this, while Mac and Linux (assuming the proper setup) only support some systems each, currently requiring a remote build setup of at least two machines for the full range:

  • Mac: macOS, iOS, Android, web
  • Linux: Linux, Windows

Most of the necessary tools have been packaged alongside the Mac distribution, but manual installation of some libraries, such as SDL2 (Homebrew recommended) is necessary, and certain programs such as Xcode with its command line tools need to be present. Linux requires a recent version of MinGW to build for Windows and Wine to run the product.

These are the commands available:

clean

Removes generated files and build files for the target system.

#!

karhubuild clean
    [--sys <mac|windows|linux|ios|android|web>=local]
    [--dir <path>=current]
  • --sys: the target system to clean; local system of the build machine if omitted
  • --dir: the project directory to work from; current if omitted; 'karhu' for Karhu project

make

Generates build files and so on for the target system.

#!

karhubuild make
    [--sys <mac|windows|linux|ios|android|web>=local]
    [--dir <path>=current]
  • --sys: the target system to clean; local system of the build machine if omitted
  • --dir: the project directory to work from; current if omitted; 'karhu' for Karhu project

build

Compiles the made target for the target system.

#!

karhubuild build
    [--sys <mac|windows|linux|ios|android|web>=local]
    [--conf <debug|release>=debug]
    [--dir <path>=current]
  • --sys: the target system to clean; local system of the build machine if omitted
  • --conf: the configuration to build; debug if omitted
  • --dir: the project directory to work from; current if omitted; 'karhu' for Karhu project

run

Runs the built product for the target system. For PC currently requires that it be run on the system on which it was compiled (see list at top), for mobile devices requires an emulator or a plugged in device.

#!

karhubuild run
    [--sys <mac|windows|linux|ios|android|web>=local]
    [--conf <debug|release>=debug]
    [--args <...>]
    [--capture]
    [--dir <path>=current]
  • --sys: the target system to clean; local system of the build machine if omitted
  • --conf: the configuration to build; debug if omitted
  • --args: any number of arguments to pass to the program (argv)
  • --capture: waits until the program quits so that console output can be captured while running
  • --dir: the project directory to work from; current if omitted

By default the terminal simply detaches from the program after starting it, returning control to the user and ignoring any console output. If you do want to capture the output, use the capture flag.

ssh

Connects to another computer over SSH and carries out the specified actions. Requires a setup where no password has to be typed in order to access the other computer, because Karhu does not keep track of passwords; this needs to be managed externally using a setup with keys. See SSH.

#!

karhubuild ssh
    --sys <mac|windows|linux|ios|android|web>
    --acts <clean, make, build, run>
    --conf <debug|release>
    --addr <name@host>
    --remotedir <path>
    [--preacts <pull, push>]
    [--kacts <clean, make, build>]
    [--kpreacts <pull, push>]
    [--args <...>]
    [--capture]
    [--dir <path>=current]
  • --sys: the target system to clean; local system of the build machine if omitted
  • --acts: a list of build actions to carry out
  • --conf: the configuration to build; debug if omitted
  • --addr: the user and host to connect to
  • --remotedir: full path to the project directory on the remote machine
  • --preacts: a list of actions to carry out before the build actions
  • --kacts: a list of build actions to carry out on the Karhu project first
  • --kpreacts: a list of pre-build actions to carry out on the Karhu project first
  • --args: any number of arguments to pass to the program (argv)
  • --capture: when running, waits until the program quits so that console output can be captured
  • --dir: the project directory (on the local machine) to work from; current if omitted; 'karhu' for Karhu project

The pre-build actions can be used to make sure the project is up to date on the remote machine first: 'push' will be called on the local machine to push any changes on it, and 'pull' will be called on the remote machine to then fetch them before building.

By default the terminal simply detaches from the program after starting it, returning control to the user and ignoring any console output. If you do want to capture the output, use the capture flag.

The options to apply actions on the Karhu project first are there to make it easy to work on the Karhu library and testing and updating it a project at the same time, so that Karhu can be synchronised and rebuilt before rebuilding or rerunning the project using it, if any changes have been made to Karhu.

apply

Reads the build settings from build.karhuproj.xml in the project root and carries out the specified build actions according to those. The file specifies which target systems should be built on the local machine and which should be built over SSH, and what address and remote directory to use (see previous command).

#!

karhubuild apply
    --acts <clean, make, build, run>
    [--preacts <pull, push>] 
    [--kacts <clean, make, build>]
    [--kpreacts <pull, push>]
    [--sys <[mac, windows, linux, ios, android, web]|all>=local]
    [--conf <debug|release>=debug]
    [--args <...>]
    [--capture]
    [--dir <path>=current]
  • --acts: a list of build actions to carry out
  • --preacts: a list of actions to carry out before the build actions
  • --kacts: a list of build actions to carry out on the Karhu project first
  • --kpreacts: a list of pre-build actions to carry out on the Karhu project first
  • --sys: list of target systems to apply build actions to, or 'all'; local system if omitted
  • --conf: the configuration to build; debug if omitted
  • --args: any number of arguments to pass to the program (argv)
  • --capture: when running, waits until the program quits so that console output can be captured
  • --dir: the project directory (on the local machine) to work from; current if omitted; 'karhu' for Karhu project

Unlike most of the other commands, this one allows a list of systems rather than only one, making it possible to build or run for many or all of them at once. Repository synchronisation pre-build is again possible; see previous command.

By default the terminal simply detaches from the program after starting it, returning control to the user and ignoring any console output. If you do want to capture the output, use the capture flag.

The options to apply actions on the Karhu project first are there to make it easy to work on the Karhu library and testing and updating it a project at the same time, so that Karhu can be synchronised and rebuilt before rebuilding or rerunning the project using it, if any changes have been made to Karhu.

Updated