Skip to main content

Setup & Dependencies

Just want to build quickly?

See the Quickstart for the condensed, just-driven workflow. This page covers the full manual toolchain in detail.

Prerequisites

Verify Prerequisite Installations

Paste this in your terminal
git --version
docker --version
Docker Dev Environment

We recommend using the Docker dev environment. Setting up the environment locally adds unnecessary complexity and is not officially supported.

If you choose to develop locally, you are responsible for configuring and maintaining your own environment.

Clone the repository

Paste this in your terminal
git clone --recursive https://github.com/Ryan-Millard/Img2Num.git
cd Img2Num/
Missing submodules after cloning

If you cloned without --recursive, required dependencies will be missing.

This clones all submodules:

  • stb (required)
  • dawn (optional, required for local native builds)
git submodule update --init third_party

Docker

Start Docker

Paste this in your terminal
./img2num sh
About the img2num script

It is a thin wrapper around Docker and pnpm that allows you to conveniently run scripts inside the Docker environment.

See img2num, img2num.ps1, and img2num.bat.

Using the Docker wrapper script

You can view the list of available commands by running the below in your terminal:

Paste this in your terminal
./img2num help
Warning: Environment assumptions

Elsewhere in this documentation (specifically the Internal Documentation), we assume that all commands are to be run in the Docker terminal.

Set up the C++ Library

All CMake commands should be run from the root of the project (and inside the Docker container as mentioned above).

Compilation & Installation

Compilation

Compile Release build
cmake -B build-release/ .
cmake --build build-release/

Installation

The library must be compiled before you can run this command.

Install the library
cmake --install build

WebAssembly (WASM) Compilation

JavaScript Prerequisite

Excluding the documentation and CLI scripts, compiling the library to WASM is required before using the JavaScript library.

The JavaScript example apps depend on the library, so they will also fail if you have not compiled the WASM.

This compiles the core C++ image processing library to WebAssembly using Emscripten.

Compile Release build
emcmake cmake -B build-wasm-release/ .
cmake --build build-wasm-release/

JavaScript

Install JavaScript dependencies

These are required for running the documentation, packages, and some example apps.

From inside the Docker terminal
pnpm install

Running a project

pnpm -F react-example dev