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
Windows testing: run the suite under Wine, and UI tests on Windows CI
islandmed090815dde6eb
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 546c1bcf..1790daed 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -49,8 +49,22 @@ jobs:sudo apt-get install -y xvfb libgl1-mesa-drixvfb-run -a -s "-screen 0 1920x1080x24" env LIBGL_ALWAYS_SOFTWARE=1 \ctest --test-dir build -C Release --output-on-failure -L ui+ - name: UI tests (real app, Mesa llvmpipe)+ if: runner.os == 'Windows'+ shell: pwsh+ run: |+ # The runner has no GPU driver: Mesa's software OpenGL (pal1000/mesa-dist-win), pinned by hash.+ $url = 'https://github.com/pal1000/mesa-dist-win/releases/download/26.2.4/mesa3d-26.2.4-release-msvc.7z'+ Invoke-WebRequest $url -OutFile mesa.7z+ if ((Get-FileHash mesa.7z -Algorithm SHA256).Hash -ne '351FC8C8B695878FFB3EAA044B3EAD08672A48B1A045E3C3E3975811DF0F6695') {+ throw 'mesa3d archive hash mismatch'+ }+ 7z e mesa.7z x64/opengl32.dll x64/libgallium_wgl.dll -obuild/Release -y | Out-Null+ $env:GALLIUM_DRIVER = 'llvmpipe'+ ctest --test-dir build -C Release --output-on-failure -L ui+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }- name: UI test screenshots- if: always() && runner.os == 'Linux'+ if: always() && runner.os != 'macOS'uses: actions/upload-artifact@v4with:name: ui-shots-${{ matrix.os }}diff --git a/CMakeLists.txt b/CMakeLists.txtindex df50d770..904a418e 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -170,7 +170,9 @@ if(SCULPTFORGE_BUILD_APP)if(WIN32)set_target_properties(sculptforge PROPERTIES WIN32_EXECUTABLE $<CONFIG:Release,MinSizeRel>)set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/assets/branding/sculptforge.ico")- string(REPLACE "/" "\\\\" ICON_PATH "${ICON_PATH}")+ if(CMAKE_HOST_WIN32)+ string(REPLACE "/" "\\\\" ICON_PATH "${ICON_PATH}")+ endif()configure_file(packaging/windows/sculptforge.rc ${CMAKE_CURRENT_BINARY_DIR}/sculptforge.rc @ONLY)target_sources(sculptforge PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/sculptforge.rc)endif()@@ -336,13 +338,28 @@ if(SCULPTFORGE_BUILD_TESTS)endif()add_test(NAME sculptforge_tests COMMAND sculptforge_tests)+ # Tests that launch our programs from Python get a path they can run directly. When cross-compiling+ # (e.g. a Windows build tested under Wine, tools/wintest.sh) that is a script calling the emulator.+ function(sculptforge_runner out target)+ if(CMAKE_CROSSCOMPILING_EMULATOR)+ list(JOIN CMAKE_CROSSCOMPILING_EMULATOR " " emulator)+ file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/run-${target}.sh+ CONTENT "#!/bin/sh\nexec ${emulator} \"$<TARGET_FILE:${target}>\" \"$@\"\n"+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)+ set(${out} ${CMAKE_CURRENT_BINARY_DIR}/run-${target}.sh PARENT_SCOPE)+ else()+ set(${out} $<TARGET_FILE:${target}> PARENT_SCOPE)+ endif()+ endfunction()+# The seeded community brush gallery (tools/brush-gallery/repo) must stay valid# and its index.json current: every brush is round-tripped through sculptforge-cli.find_package(Python3 COMPONENTS Interpreter QUIET)if(Python3_Interpreter_FOUND)+ sculptforge_runner(SCULPTFORGE_CLI_RUNNER sculptforge-cli)add_test(NAME brush_gallery_indexCOMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/brush-gallery/build_index.py- ${CMAKE_CURRENT_SOURCE_DIR}/tools/brush-gallery/repo --check --cli $<TARGET_FILE:sculptforge-cli>)+ ${CMAKE_CURRENT_SOURCE_DIR}/tools/brush-gallery/repo --check --cli ${SCULPTFORGE_CLI_RUNNER})# The user guide (docs/guide): every link, anchor and image resolves, only characters the app's font has,# and the website pages build.add_test(NAME guide_site COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/guide/build_site.py --check@@ -370,8 +387,9 @@ if(SCULPTFORGE_BUILD_TESTS)set_tests_properties(ui_user_guide_1080 PROPERTIES LABELS ui TIMEOUT 300)# The guide's keyboard table must match the app's default shortcuts (tools/guide/update_shortcuts.py).if(Python3_Interpreter_FOUND)+ sculptforge_runner(SCULPTFORGE_APP_RUNNER sculptforge)add_test(NAME ui_guide_shortcuts COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/guide/update_shortcuts.py- --app $<TARGET_FILE:sculptforge> --check)+ --app ${SCULPTFORGE_APP_RUNNER} --check)set_tests_properties(ui_guide_shortcuts PROPERTIES LABELS ui TIMEOUT 300)endif()endif()diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 49022b3b..5a8b35cd 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -49,7 +49,15 @@ The step reference is at the top of `src/app/UiTest.cpp`. Tests run headless ontake under a second. They use a throwaway settings folder and never touch your own. A failing step stopsthe script and saves `FAIL-line-N.png`, and clicking a missing item lists similarly named items. Clicksscroll panels as needed, and clicking an item a person couldn't reach (off screen) fails. CI runs the UI-tests on Linux under Xvfb and uploads the screenshots as an artifact.+tests on Linux under Xvfb and on Windows with Mesa's software OpenGL, and uploads the screenshots as an+artifact.++### Windows, from Linux++`tools/wintest.sh` cross-compiles SculptForge for Windows with llvm-mingw (downloaded once into+`~/.cache/sculptforge`) and runs every test, UI tests included, under Wine. It catches Windows API, path and+file-sharing problems before a push; extra arguments go to `ctest` (`tools/wintest.sh -R ui_subtools`). On an+ARM machine it builds for Windows on ARM, which Wine runs natively.## Demo videosdiff --git a/src/app/Pickers.cpp b/src/app/Pickers.cppindex a8385c1a..00c4e555 100644--- a/src/app/Pickers.cpp+++ b/src/app/Pickers.cpp@@ -19,6 +19,7 @@#include <array>#include <cctype>#include <cmath>+#include <cstdlib>#include <cstring>namespace sf {diff --git a/tools/wintest.sh b/tools/wintest.shnew file mode 100755index 00000000..d0f372a9--- /dev/null+++ b/tools/wintest.sh@@ -0,0 +1,57 @@+#!/usr/bin/env bash+# Builds SculptForge for Windows with llvm-mingw and runs the whole test suite (unit, Python-driven and UI+# tests) under Wine, so Windows-only breakage shows up before a push. Needs wine, cmake, curl and python3;+# the toolchain (pinned below) is downloaded once into ~/.cache/sculptforge.+# SPDX-License-Identifier: GPL-3.0-or-later+#+# tools/wintest.sh build build-win<arch>, run every test+# tools/wintest.sh -R ui_subtools extra arguments go to ctest+#+# The Windows architecture follows the host: ARM64 on an ARM machine (Wine runs ARM64 Windows programs+# natively; its x64 emulation is too unreliable for tests), x64 on an x86 machine. This complements CI's+# MSVC builds and the Windows VM (tools/winvm.sh): it catches Windows API, path and file-sharing issues, not+# MSVC-only compiler problems.+set -euo pipefail++ROOT=$(cd "$(dirname "$0")/.." && pwd)+LLVM_MINGW=20261006+CACHE=${XDG_CACHE_HOME:-$HOME/.cache}/sculptforge++case "$(uname -m)" in+ aarch64|arm64) HOST=aarch64; TARGET=aarch64; ARCH=arm64; PROCESSOR=ARM64 ;;+ x86_64) HOST=x86_64; TARGET=x86_64; ARCH=x64; PROCESSOR=AMD64 ;;+ *) echo "wintest: unsupported host $(uname -m)" >&2; exit 1 ;;+esac++command -v wine >/dev/null || { echo "wintest: install wine first" >&2; exit 1; }++TOOLCHAIN=$CACHE/llvm-mingw-$LLVM_MINGW-ucrt-ubuntu-22.04-$HOST+if [ ! -x "$TOOLCHAIN/bin/$TARGET-w64-mingw32-clang++" ]; then+ echo "wintest: downloading llvm-mingw $LLVM_MINGW"+ mkdir -p "$CACHE"+ curl -fsSL "https://github.com/mstorsjo/llvm-mingw/releases/download/$LLVM_MINGW/$(basename "$TOOLCHAIN").tar.xz" |+ tar -xJ -C "$CACHE"+fi++BUILD=$ROOT/build-win$ARCH+T=$TOOLCHAIN/bin/$TARGET-w64-mingw32+cmake -S "$ROOT" -B "$BUILD" -Wno-dev \+ -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_PROCESSOR=$PROCESSOR \+ -DCMAKE_C_COMPILER="$T-clang" -DCMAKE_CXX_COMPILER="$T-clang++" -DCMAKE_RC_COMPILER="$T-windres" \+ -DCMAKE_FIND_ROOT_PATH="$TOOLCHAIN/$TARGET-w64-mingw32" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \+ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \+ -DCMAKE_EXE_LINKER_FLAGS=-static -DCMAKE_CROSSCOMPILING_EMULATOR=wine \+ -DCMAKE_BUILD_TYPE=Release -DSCULPTFORGE_USE_SYSTEM_SDL=OFF -DSCULPTFORGE_BUILD_PYTHON=OFF >/dev/null+cmake --build "$BUILD" --parallel++# A prefix of our own, so tests never touch the user's Wine setup.+export WINEPREFIX=$CACHE/wine-$ARCH WINEDEBUG=-all+[ -d "$WINEPREFIX" ] || wineboot -i >/dev/null 2>&1++RUN=(ctest --test-dir "$BUILD" --output-on-failure --parallel 4 "$@")+if [ -z "${DISPLAY:-}" ] && command -v xvfb-run >/dev/null; then+ RUN=(xvfb-run -a -s "-screen 0 1920x1080x24" "${RUN[@]}")+fi+"${RUN[@]}"+echo "wintest: UI screenshots in $BUILD/ui-shots"