Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
#!/bin/sh
# Builds the SculptForge Flatpak from this checkout and writes a single-file bundle,
# SculptForge-<version>-<arch>.flatpak, to the given folder (default: the checkout).
#
# packaging/flatpak/build.sh [out-dir]
#
# Needs flatpak and flatpak-builder. The freedesktop runtime and SDK come from Flathub (only the runtime: the app
# itself is not published there). Work files go to build-flatpak/ (the manifest leaves it out of the sources).
# The release workflow runs this on x86_64 and aarch64; docs/guide/installing.md has the install side.
set -eu
here=$(cd "$(dirname "$0")" && pwd)
root=$(cd "$here/../.." && pwd)
out=$(mkdir -p "${1:-$root}" && cd "${1:-$root}" && pwd)
id=org.sculptforge.SculptForge
flathub=https://dl.flathub.org/repo/flathub.flatpakrepo
version=$(sed -n 's/^project(SculptForge VERSION \([0-9.]*\).*/\1/p' "$root/CMakeLists.txt")
arch=$(flatpak --default-arch)
work=$root/build-flatpak
# --disable-rofiles-fuse: CI runners and containers often have no FUSE.
# SF_FLATPAK_CCACHE=1: compile through the SDK's ccache, kept in $work/state/ccache (CI restores and saves that folder).
ccache=
[ "${SF_FLATPAK_CCACHE:-}" = 1 ] && ccache=--ccache
# The runtime, SDK and the manifest's sources first, retried with backoff (a GitHub 504 on one archive failed 0.11.1's
# Flatpak); the downloads stay in $work/state/downloads (CI caches it), so the build itself downloads nothing.
for wait in 0 15 60 120 x; do
[ "$wait" != x ] || { echo "flatpak-builder: the downloads failed 4 times" >&2; exit 1; }
sleep "$wait"
flatpak --user remote-add --if-not-exists flathub "$flathub" &&
flatpak-builder --user --install-deps-from=flathub --download-only --force-clean --disable-rofiles-fuse \
--state-dir="$work/state" "$work/app" "$here/$id.yml" && break
done
flatpak-builder --user --install-deps-from=flathub --disable-download --force-clean --disable-rofiles-fuse --default-branch=stable $ccache \
--state-dir="$work/state" --repo="$work/repo" "$work/app" "$here/$id.yml"
bundle="$out/SculptForge-$version-$arch.flatpak"
flatpak build-bundle --runtime-repo="$flathub" "$work/repo" "$bundle" "$id" stable
echo "$bundle"