Skip to content

Packaging

nick_tsaizer edited this page Apr 25, 2026 · 3 revisions

Tensor Planner includes distribution scripts for POSIX shells and PowerShell:

build.sh
build.ps1

Both scripts build native libraries and stage selected binding/package outputs.

Basic usage

sh ./build.sh -release -target unity cpp sharp jai -o ./dist

PowerShell on Windows:

pwsh ./build.ps1 -release -os windows -target unity cpp sharp jai -o ./dist

Arguments:

-release       Build Release artifacts. Default.
-debug         Build Debug artifacts.
-os            One or more target OS values: linux windows.
-target        One or more targets: unity cpp sharp jai.
-o             Output directory. Defaults to ./dist.
-no-clean      Keep build-process files after packaging.

Command snippets:

sh ./build.sh -release -os linux -target unity cpp sharp jai -o ./dist
sh ./build.sh -release -os windows -target unity cpp sharp -o ./dist
sh ./build.sh -target unity cpp -os linux windows -o ./dist
pwsh ./build.ps1 -release -os windows -target unity cpp sharp jai -o ./dist
pwsh ./build.ps1 -target unity cpp -os windows -o ./dist
pwsh ./build.ps1 -debug -target cpp sharp -o ./dist -no-clean

Target OS

Supported values:

  • linux
  • windows

Linux builds use the host C++ toolchain through CMake.

Native Windows builds from build.ps1 use the host CMake toolchain. Install a C++ toolchain supported by CMake, such as Visual Studio Build Tools.

Windows cross-builds from Linux require:

x86_64-w64-mingw32-g++

Target: cpp

Stages:

dist/cpp/
├── include/
│   ├── tensor_planner.h
│   └── tensor_planner.hpp
└── lib/
    └── libtensor_planner.so or tensor_planner.dll

When building multiple OS targets, output is split by OS:

dist/cpp/linux/
dist/cpp/windows/

Target: sharp

Stages the .NET wrapper assembly and native runtime assets:

dist/sharp/
├── lib/netstandard2.1/TensorPlanner.dll
└── runtimes/
    ├── linux-x64/native/libtensor_planner.so
    └── win-x64/native/tensor_planner.dll

Target: unity

Stages a Unity package folder:

dist/unity/dev.nick.tensor-planner/
├── package.json
├── Runtime/
│   ├── TensorPlanner.cs
│   └── Plugins/x86_64/...

Target: jai

Stages a Jai module folder:

dist/jai/Tensor_Planner/

The script stages native libraries under:

dist/jai/Tensor_Planner/lib/<os>/

Current note: verify Jai packaging when adding platform-specific generated Jai binding files. The source module currently includes the Linux generated binding.

Cleanup behavior

By default, each distribution script removes build-process files after staging outputs:

  • per-OS CMake build directories,
  • C# bin/<Configuration>,
  • C# obj.

Use -no-clean to inspect intermediate files:

sh ./build.sh -debug -target cpp sharp -o ./dist -no-clean
pwsh ./build.ps1 -debug -target cpp sharp -o ./dist -no-clean

Manual CMake install

The CMake project installs headers, library, and CMake package config files:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel
cmake --install build --prefix ./install

Installed headers:

include/tensor_planner.h
include/tensor_planner.hpp

Clone this wiki locally