Setup & Dependencies
Prerequisites
- Git
- Docker (choose one of the following):
- Docker Desktop (recommended)
- Docker Engine
Verify Prerequisite Installations
git --version
docker --version
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
git clone --recursive https://github.com/Ryan-Millard/Img2Num.git
cd Img2Num/
Docker
Start Docker
- Linux / macOS
- Windows CMD
- PowerShell
./img2num sh
.\img2num.bat sh
.\img2num.ps1 sh
img2num scriptIt 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:
- Linux / macOS
- Windows CMD
- PowerShell
./img2num help
.\img2num.bat help
.\img2num.ps1 help
In future docs, assume that the commands are to be run in the Docker terminal.
More about the img2num script
img2num script-
./img2num pnpm <args>is a proxy to pnpm inside the Docker container's shell.- Root
- Docs
- React Example App
bash title="Fuzzy find scripts local to the root project" ./img2num pnpm run helpbash title="Fuzzy find scripts local to the documentation" ./img2num pnpm run -F docs helpbash title="Fuzzy find scripts local to the React Example app" ./img2num pnpm run -F react-example help -
./img2num sh,./img2num shell, and./img2num bashall open the Docker container's interactive terminal.Open the Docker terminal./img2num sh -
The rest of the arguments that can be passed to the script (e.g.,
stop,restart,down,purge,destroy, andlogs) manage the container itself.
Set up the C++ Library
All CMake commands should be run from the root of the project.
Compilation & Installation
Compilation
- Release Build
- Debug Build
cmake -B build-release/ .
cmake --build build-release/
cmake -B build/ . -DCMAKE_BUILD_TYPE=Debug
cmake --build build/
Installation
The library must be compiled before you can run this command.
cmake --install build
WebAssembly (WASM) Compilation
Excluding the documentation and CLI scripts, compiling the library to WASM is required before using the JavaScript library.
The 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.
- Release Build
- Debug Build
emcmake cmake -B build-wasm-release/ .
cmake --build build-wasm-release/
emcmake cmake -B build-wasm/ . -DCMAKE_BUILD_TYPE=Debug
cmake --build build-wasm/
JavaScript
Install JavaScript dependencies
These are required for running the documentation, packages, and some example apps.
- Docker Terminal
- Normal Terminal
pnpm install
./img2num pnpm install
Running a project
- React Example App
- Documentation Site
pnpm -F react-example dev
pnpm -F docs start