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
Build speed: mold, precompiled std/glm headers, shared app libraries, ccache for PCH compiles
islandmeda412ff09fc25
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d7d66dd9..c4b09b3b 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -124,7 +124,7 @@ jobs:if: runner.os == 'Linux'run: |sudo ./packaging/linux/install-build-deps.sh- sudo apt-get install -y --no-install-recommends ccache xvfb libgl1-mesa-dri+ sudo apt-get install -y --no-install-recommends ccache xvfb libgl1-mesa-dri mold # mold: faster links (docs/build-speed.md)- name: ccache (macOS; the release binary, pinned by hash)if: runner.os == 'macOS'run: |diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.ymlindex 6d25197e..964979f3 100644--- a/.github/workflows/packages.yml+++ b/.github/workflows/packages.yml@@ -80,7 +80,7 @@ jobs:- name: Buildrun: |cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSCULPTFORGE_USE_SYSTEM_SDL=OFF \- -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache+ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSCULPTFORGE_MOLD=OFFcmake --build build --parallel 4ccache -s- if: env.SAVE_CACHE == 'true'@@ -203,7 +203,7 @@ jobs:run: |source /opt/rh/gcc-toolset-14/enablecmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DSCULPTFORGE_USE_SYSTEM_SDL=OFF \- -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \+ -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSCULPTFORGE_MOLD=OFF \-DSCULPTFORGE_BUILD_PYTHON=ON -DPython_EXECUTABLE="$PYTHON313" -DSCULPTFORGE_PYTHON_INSTALL_DIR=lib/sculptforge/pythoncmake --build build --parallel 4ccache -sdiff --git a/CMakeLists.txt b/CMakeLists.txtindex ea9f2a18..ff6ff0c8 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -25,6 +25,7 @@ endif()# Position-independent code so the core libraries can also go into the Python module.set(CMAKE_POSITION_INDEPENDENT_CODE ON)+include(cmake/BuildSpeed.cmake)include(cmake/Dependencies.cmake)# --- Core library: geometry, sculpting, undo, commands, file IO (no GPU/UI) ---@@ -229,6 +230,9 @@ else()# packages build at -O2; face_weights' fast path is tested to match a full evaluation exactly).target_compile_options(sculptforge_core PRIVATE -Wall -Wextra -Wno-unused-parameter -ffp-contract=off)endif()+sculptforge_pch(sculptforge_core)+set_source_files_properties(third_party/xatlas/xatlas.cpp third_party/tinyexr/tinyexr_impl.cpp ${CMAKE_CURRENT_BINARY_DIR}/EmbeddedRecipes.cpp+ PROPERTIES SKIP_PRECOMPILE_HEADERS ON)# --- Bring-your-own-AI (brush assistant). HTTPS via WinHTTP or libcurl. ---add_library(sculptforge_ai STATIC src/ai/Http.cpp src/ai/AiPolicy.cpp src/ai/BrushAssistant.cpp src/ai/Generator3D.cpp@@ -254,6 +258,7 @@ if(MSVC)else()target_compile_options(sculptforge_ai PRIVATE -Wall -Wextra -Wno-unused-parameter)endif()+sculptforge_pch(sculptforge_ai)# --- Phone link (src/link/PhoneLink.h, docs/phone-link.md): the capture page server, AR export, live face feed ---option(SCULPTFORGE_WEBRTC "Live face feed over WebRTC (fetches libdatachannel and Mbed TLS; OFF: capture and AR only)" ON)@@ -279,11 +284,42 @@ else()target_compile_options(sculptforge_phone PRIVATE -Wall -Wextra -Wno-unused-parameter)set_source_files_properties(third_party/qrcodegen/qrcodegen.cpp PROPERTIES COMPILE_OPTIONS "-w")endif()+sculptforge_pch(sculptforge_phone)+set_source_files_properties(third_party/qrcodegen/qrcodegen.cpp ${CMAKE_CURRENT_BINARY_DIR}/EmbeddedPhone.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON)# --- Headless command-line tool (pipelines, build farms, AI agents) ----add_executable(sculptforge-cli src/cli/main.cpp src/cli/McpServer.cpp)+# The MCP server (src/cli/McpServer.cpp) is a library of its own: the tool and the tests link it, nobody compiles it twice.+add_library(sculptforge_mcp STATIC src/cli/McpServer.cpp)+target_compile_definitions(sculptforge_mcp PRIVATE SCULPTFORGE_VERSION="${PROJECT_VERSION}")+target_link_libraries(sculptforge_mcp PUBLIC sculptforge_core sculptforge_ai)+add_executable(sculptforge-cli src/cli/main.cpp)target_compile_definitions(sculptforge-cli PRIVATE SCULPTFORGE_VERSION="${PROJECT_VERSION}")-target_link_libraries(sculptforge-cli PRIVATE sculptforge_core sculptforge_ai)+target_link_libraries(sculptforge-cli PRIVATE sculptforge_core sculptforge_ai sculptforge_mcp)++# App code the tests also run (layout, looks, translations, Library, brush previews, camera, clusters): one static+# library both link, so an edit to one of these files compiles once, not once per program.+if(SCULPTFORGE_BUILD_APP OR SCULPTFORGE_BUILD_TESTS)+ add_library(sculptforge_appshared STATIC src/app/AssetLibrary.cpp src/app/BrushPreview.cpp src/app/UiLayout.cpp+ src/app/ShellGeometry.cpp src/app/LookSchemes.cpp src/app/I18n.cpp src/app/I18nSpanish.cpp src/render/Camera.cpp+ src/render/Clusters.cpp src/render/Ghost.cpp)+ target_link_libraries(sculptforge_appshared PUBLIC sculptforge_core)+ if(MSVC)+ target_compile_options(sculptforge_appshared PRIVATE /W4 /utf-8 /permissive-)+ else()+ target_compile_options(sculptforge_appshared PRIVATE -Wall -Wextra -Wno-unused-parameter)+ endif()+ sculptforge_pch(sculptforge_appshared)+endif()+# The action registry (key chords, shortcut overrides; needs SDL's key names): the app and its tests.+if(SCULPTFORGE_BUILD_APP)+ add_library(sculptforge_actions STATIC src/app/Actions.cpp src/app/BlenderKeymap.cpp)+ target_link_libraries(sculptforge_actions PUBLIC sculptforge_core SDL3::SDL3)+ if(MSVC)+ target_compile_options(sculptforge_actions PRIVATE /W4 /utf-8 /permissive-)+ else()+ target_compile_options(sculptforge_actions PRIVATE -Wall -Wextra -Wno-unused-parameter)+ endif()+endif()# --- Desktop application ---if(SCULPTFORGE_BUILD_APP)@@ -311,26 +347,17 @@ if(SCULPTFORGE_BUILD_APP)src/app/AsyncStroke.cppsrc/app/Demo.cppsrc/app/UiTest.cpp- src/app/Actions.cpp- src/app/BlenderKeymap.cppsrc/app/Ui.cpp- src/app/UiLayout.cppsrc/app/Shell.cpp- src/app/ShellGeometry.cppsrc/app/Palettes.cppsrc/app/Theme.cpp- src/app/LookSchemes.cpp- src/app/I18n.cpp- src/app/I18nSpanish.cppsrc/app/CommandPalette.cppsrc/app/Console.cppsrc/app/Config.cppsrc/app/LibraryBrowser.cpp- src/app/BrushPreview.cppsrc/app/Thumbnails.cppsrc/app/Pickers.cppsrc/app/UserGuide.cpp- src/app/AssetLibrary.cppsrc/app/PanelMasking.cppsrc/app/PanelCut.cppsrc/app/PanelView.cpp@@ -382,14 +409,12 @@ if(SCULPTFORGE_BUILD_APP)src/app/RadialMenu.cppsrc/app/StrokePopup.cppsrc/render/GL.cpp- src/render/Camera.cpp- src/render/Clusters.cpp- src/render/Ghost.cppsrc/render/Renderer.cppsrc/render/UvView.cppsrc/render/MicroRenderer.cpp)- target_link_libraries(sculptforge PRIVATE sculptforge_core sculptforge_ai sculptforge_phone imgui SDL3::SDL3)+ target_link_libraries(sculptforge PRIVATE sculptforge_core sculptforge_ai sculptforge_phone sculptforge_appshared+ sculptforge_actions imgui SDL3::SDL3)target_include_directories(sculptforge PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/lucide)target_compile_definitions(sculptforge PRIVATE SCULPTFORGE_VERSION="${PROJECT_VERSION}"SCULPTFORGE_PRERELEASE="${SCULPTFORGE_PRERELEASE}"@@ -408,6 +433,9 @@ if(SCULPTFORGE_BUILD_APP)else()target_compile_options(sculptforge PRIVATE -Wall -Wextra -Wno-unused-parameter)endif()+ sculptforge_pch(sculptforge <imgui.h>)+ set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/EmbeddedFonts.cpp ${CMAKE_CURRENT_BINARY_DIR}/EmbeddedGuide.cpp+ PROPERTIES SKIP_PRECOMPILE_HEADERS ON)if(WIN32)set_target_properties(sculptforge PROPERTIES WIN32_EXECUTABLE $<CONFIG:Release,MinSizeRel>)set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/assets/branding/sculptforge.ico")@@ -580,15 +608,13 @@ endif()if(SCULPTFORGE_BUILD_TESTS)# tests/test_main.cpp plus every tests/test_*.cpp (add a file to add tests; see tests/TestHarness.h).file(GLOB SCULPTFORGE_TEST_SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_*.cpp)- add_executable(sculptforge_tests ${SCULPTFORGE_TEST_SOURCES} src/cli/McpServer.cpp src/app/AssetLibrary.cpp src/app/BrushPreview.cpp- src/app/UiLayout.cpp src/app/ShellGeometry.cpp src/app/LookSchemes.cpp src/app/I18n.cpp src/app/I18nSpanish.cpp src/render/Camera.cpp- src/render/Clusters.cpp src/render/Ghost.cpp)+ add_executable(sculptforge_tests ${SCULPTFORGE_TEST_SOURCES})target_include_directories(sculptforge_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tests)target_compile_definitions(sculptforge_tests PRIVATE SF_TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/tests/data")- target_link_libraries(sculptforge_tests PRIVATE sculptforge_core sculptforge_ai sculptforge_phone)+ target_link_libraries(sculptforge_tests PRIVATE sculptforge_core sculptforge_ai sculptforge_phone sculptforge_mcp sculptforge_appshared)+ sculptforge_pch(sculptforge_tests)if(SCULPTFORGE_BUILD_APP) # the action registry (key chords, shortcut overrides) needs SDL's key names- target_sources(sculptforge_tests PRIVATE src/app/Actions.cpp src/app/BlenderKeymap.cpp)- target_link_libraries(sculptforge_tests PRIVATE SDL3::SDL3)+ target_link_libraries(sculptforge_tests PRIVATE sculptforge_actions)target_compile_definitions(sculptforge_tests PRIVATE SF_TEST_ACTIONS)endif()if(MSVC)diff --git a/changes/feat-link-speed.md b/changes/feat-link-speed.mdnew file mode 100644index 00000000..a364bd95--- /dev/null+++ b/changes/feat-link-speed.md@@ -0,0 +1,7 @@+---+changed: **Faster builds from source**: on Linux the build links with mold when it is installed and precompiles the+ standard library and glm headers; app code the tests also run is a static library both link, so it compiles once.+ Packagers: `-DSCULPTFORGE_MOLD=OFF` keeps the system linker (the release packages do), `-DSCULPTFORGE_PCH=OFF`+ turns the precompiled headers off. See docs/build-speed.md.+---+Edit-build loop numbers (before/after, PC and laptop) are in docs/build-speed.md and REPORT.md.diff --git a/cmake/BuildSpeed.cmake b/cmake/BuildSpeed.cmakenew file mode 100644index 00000000..e1fc5f22--- /dev/null+++ b/cmake/BuildSpeed.cmake@@ -0,0 +1,82 @@+# Edit-build loop speed (docs/build-speed.md): mold for links, precompiled standard headers. Both have an off switch;+# release packaging builds pass -DSCULPTFORGE_MOLD=OFF (the shipped binaries keep the system linker).+# included before cmake/Dependencies.cmake (the ccache settings below apply to the dependencies too).++# --- mold (MIT licence, github.com/rui314/mold): links in a fraction of ld.bfd's time. On when installed. ---+if(NOT MSVC AND NOT APPLE)+ find_program(SF_MOLD_PROGRAM mold)+endif()+if(SF_MOLD_PROGRAM)+ set(sf_mold_default ON)+else()+ set(sf_mold_default OFF)+endif()+option(SCULPTFORGE_MOLD "Link with mold when it is installed (faster links; release packaging turns it off)" ${sf_mold_default})+if(SCULPTFORGE_MOLD)+ include(CheckLinkerFlag)+ check_linker_flag(CXX -fuse-ld=mold SF_LINKER_MOLD) # GCC 12.1+ and Clang+ if(SF_LINKER_MOLD)+ add_link_options(-fuse-ld=mold)+ message(STATUS "Linker: mold (${SF_MOLD_PROGRAM}); -DSCULPTFORGE_MOLD=OFF for the default linker")+ else()+ message(STATUS "Linker: mold requested but ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} can't use it")+ endif()+endif()++# --- Debug info in separate .dwo files for Debug and RelWithDebInfo builds on Linux: the linker skips it. ---+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND CMAKE_BUILD_TYPE MATCHES "^(Debug|RelWithDebInfo)$")+ option(SCULPTFORGE_SPLIT_DWARF "Debug info in .dwo files beside the objects (faster links)" ON)+ if(SCULPTFORGE_SPLIT_DWARF)+ add_compile_options(-gsplit-dwarf)+ endif()+endif()++# --- Precompiled headers: the standard library and glm, parsed once per target instead of once per file. ---+# Only headers that never change with our sources (an edit to src/ never rebuilds a PCH). On by default where the+# edit loop runs (Linux, GCC or Clang); elsewhere opt-in: CI on Windows caches with ccache standing in for cl.exe,+# which can't cache /Yu compiles, and macOS release builds are universal (one PCH can't serve two architectures).+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")+ set(sf_pch_default ON)+else()+ set(sf_pch_default OFF)+endif()+option(SCULPTFORGE_PCH "Precompile the standard library and glm headers for each target" ${sf_pch_default})+# ccache caches compiles that use a PCH (ours, and SDL's own) only with these sloppiness settings; ccache 4.8+ takes+# them on its command line. Set before the dependencies are configured, so their PCH compiles are cached too.+foreach(lang C CXX)+ if(CMAKE_${lang}_COMPILER_LAUNCHER MATCHES "ccache" AND NOT CMAKE_${lang}_COMPILER_LAUNCHER MATCHES "sloppiness")+ list(GET CMAKE_${lang}_COMPILER_LAUNCHER 0 sf_ccache)+ execute_process(COMMAND ${sf_ccache} --version OUTPUT_VARIABLE sf_ccache_version ERROR_QUIET)+ string(REGEX MATCH "version ([0-9]+\\.[0-9]+)" _ "${sf_ccache_version}")+ if(CMAKE_MATCH_1 VERSION_GREATER_EQUAL 4.8)+ set(CMAKE_${lang}_COMPILER_LAUNCHER ${sf_ccache} sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime)+ elseif(lang STREQUAL "CXX" AND SCULPTFORGE_PCH)+ message(STATUS "ccache older than 4.8: precompiled headers off (ccache would not cache those compiles)")+ set(SCULPTFORGE_PCH OFF)+ endif()+ endif()+endforeach()+if(SCULPTFORGE_PCH)+ message(STATUS "Precompiled headers: on; -DSCULPTFORGE_PCH=OFF to build without")+endif()++set(SF_PCH_HEADERS+ <algorithm> <array> <atomic> <chrono> <cmath> <cstddef> <cstdint> <cstdio> <cstdlib> <cstring> <filesystem>+ <format> <fstream> <functional> <map> <memory> <mutex> <optional> <set> <span> <sstream> <string> <string_view>+ <thread> <tuple> <unordered_map> <unordered_set> <utility> <variant> <vector> <glm/glm.hpp>)++# sculptforge_pch(target [extra headers...]): precompile SF_PCH_HEADERS (+ extras) for the target's C++ files.+function(sculptforge_pch target)+ if(NOT SCULPTFORGE_PCH)+ return()+ endif()+ set(headers)+ foreach(h ${SF_PCH_HEADERS} ${ARGN})+ string(REGEX REPLACE ">$" "$<ANGLE-R>" h "${h}") # a bare > would end the generator expression+ list(APPEND headers "$<$<COMPILE_LANGUAGE:CXX>:${h}>")+ endforeach()+ target_precompile_headers(${target} PRIVATE ${headers})+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # no timestamp in the PCH, or ccache can never reuse a compile using it+ target_compile_options(${target} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:SHELL:-Xclang -fno-pch-timestamp>")+ endif()+endfunction()diff --git a/docs/build-speed.md b/docs/build-speed.mdnew file mode 100644index 00000000..68b01c54--- /dev/null+++ b/docs/build-speed.md@@ -0,0 +1,49 @@+# Build speed: the edit-build loop++How long it takes from saving one file to rebuilt `sculptforge`, `sculptforge_tests` and `sculptforge-cli`, and what+keeps it short. Measure with `tools/dev/edit_timing.sh BUILD_DIR [JOBS]` (a configured, built tree; Ninja gives the+compile/link split, Make only the wall time).++## What the build does (cmake/BuildSpeed.cmake)++| | default | off switch | why |+|---|---|---|---|+| mold linker | ON when `mold` is installed (Linux, GCC 12.1+ or Clang) | `-DSCULPTFORGE_MOLD=OFF` | links in a fraction of ld.bfd's time. MIT licence (mold 2.0+). Output is deterministic (same inputs, same bytes: checked by linking three times). Release packaging (packages.yml, PKGBUILD, Flatpak, rez) passes OFF: shipped binaries keep the system linker. CI's Linux test jobs install it from apt. |+| precompiled headers | ON on Linux with GCC/Clang | `-DSCULPTFORGE_PCH=OFF` | the standard library, glm and (app) imgui parsed once per target. Only headers that never change with our code, so editing `src/` never rebuilds a PCH. Windows (ccache as cl.exe can't cache `/Yu`) and macOS (universal builds) build without; those CI jobs keep the includes honest. With ccache 4.8+ the build passes ccache the `sloppiness` PCH needs; older ccache turns PCH off. |+| shared app libraries | always | | `sculptforge_appshared` (layout, looks, translations, Library, brush previews, camera, clusters), `sculptforge_actions` (key chords; SDL) and `sculptforge_mcp` (MCP server): the app, the CLI and the tests link them instead of each compiling the files again. |+| split DWARF | ON for Debug/RelWithDebInfo on Linux | `-DSCULPTFORGE_SPLIT_DWARF=OFF` | debug info stays in `.dwo` files; the linker never reads it. Release builds have no debug info, so nothing changes there. |++Not done: unity builds. Our TUs are optimiser-bound at `-O2`, and a unity batch turns a one-file edit into an+eight-file compile, which is the case this work is about.++## Numbers (2026-11-04, `tools/dev/edit_timing.sh`; seconds of wall time to rebuilt sculptforge + sculptforge_tests + sculptforge-cli)++PC (WSL2 Ubuntu 24.04, GCC 13, 12 threads, Ninja + ccache; the whole PC to itself; mold + PCH; "after" is two runs):++| case | before | after | |+|---|---|---|---|+| cold build (no ccache) | 189 | 154-170 | -10 to -19 % |+| one `src/core` .cpp (Sculpt.cpp) | 5.5 | 4.3 | links 1.7 s -> 0.7 s |+| widely included header (core/Mesh.h, ~280 files) | 157.5 | 114-139 | -12 to -28 %; CPU 1839 s -> 1345-1648 s |+| one app-only .cpp (PanelBrushes.cpp) | 0.8 | 0.3 | link 0.5 s -> 0.1 s |+| one app .cpp the tests also use (AssetLibrary.cpp) | 3.9 | 2.6 | compiled once instead of twice |+| one test .cpp (test_brushes.cpp) | 0.7 | 0.3 | |+| clean rebuild from a warm ccache | | 7 | 868/868 hits, SDL's own PCH compiles included (before: 266 uncacheable) |++Laptop (Arch, GCC 16, ARM64, Make, no ccache, -j3 through heavy.sh, other sessions running; no mold installed, so PCH ++shared libraries only):++| case | before | after |+|---|---|---|+| cold build | 339 | 290 |+| one `src/core` .cpp | 6.3 | 5.5 |+| widely included header | 269 | 225 |+| one app-only .cpp | 3.6 | 2.7 |+| one app .cpp the tests also use | 7.6 | 4.2 |+| one test .cpp | 4.8 | 4.3 |++mold's output is deterministic: three links of sculptforge and sculptforge-cli gave identical bytes.++What is left is the header case: an edit to `core/Mesh.h` recompiles ~280 files at `-O2`, and that time is the+optimiser, not parsing or linking. The next lever is fewer files depending on the core headers (forward+declarations, splitting Mesh.h's rarely changing data from its helpers), not the build system.diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILDindex 234332a8..2f53c46d 100644--- a/packaging/arch/PKGBUILD+++ b/packaging/arch/PKGBUILD@@ -26,6 +26,7 @@ build() {-DSCULPTFORGE_USE_SYSTEM_SDL=ON \-DSCULPTFORGE_UPDATE_CHECK=OFF \-DSCULPTFORGE_WEBRTC=OFF \+ -DSCULPTFORGE_MOLD=OFF \-DFETCHCONTENT_FULLY_DISCONNECTED=ON \-DFETCHCONTENT_SOURCE_DIR_IMGUI="$srcdir/imgui-$_imgui" \-DFETCHCONTENT_SOURCE_DIR_GLM="$srcdir/glm-$_glm"diff --git a/packaging/flatpak/org.sculptforge.SculptForge.yml b/packaging/flatpak/org.sculptforge.SculptForge.ymlindex c1ec8c34..5558135d 100644--- a/packaging/flatpak/org.sculptforge.SculptForge.yml+++ b/packaging/flatpak/org.sculptforge.SculptForge.yml@@ -42,6 +42,7 @@ modules:- -DSCULPTFORGE_USE_SYSTEM_SDL=OFF # SDL 3.2.30, the version every other package ships (pen and tablet fixes)- -DSCULPTFORGE_BUILD_TESTS=OFF # the tests run in CI and in the release jobs, outside the sandbox- -DSCULPTFORGE_BUILD_PYTHON=OFF+ - -DSCULPTFORGE_MOLD=OFF # the shipped binary keeps the system linker (docs/build-speed.md)- -DFETCHCONTENT_FULLY_DISCONNECTED=ON- -DFETCHCONTENT_SOURCE_DIR_GLM=/run/build/sculptforge/_deps-src/glm- -DFETCHCONTENT_SOURCE_DIR_SDL3=/run/build/sculptforge/_deps-src/SDL3diff --git a/packaging/rez/build.sh b/packaging/rez/build.shindex c4ddcf2d..2f99c361 100755--- a/packaging/rez/build.sh+++ b/packaging/rez/build.sh@@ -8,7 +8,7 @@ if [ -n "$python" ]; thenpython_args=(-DSCULPTFORGE_BUILD_PYTHON=ON "-DPython_EXECUTABLE=$python" -DSCULPTFORGE_PYTHON_INSTALL_DIR=python)ficmake -S "$source_dir" -B . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$REZ_BUILD_INSTALL_PATH" \- -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_LIBDIR=lib "${python_args[@]}"+ -DCMAKE_INSTALL_BINDIR=bin -DCMAKE_INSTALL_LIBDIR=lib -DSCULPTFORGE_MOLD=OFF "${python_args[@]}"cmake --build . --parallel "${REZ_BUILD_THREAD_COUNT:-4}"ctest --output-on-failureif [ "${1:-}" = "install" ]; thendiff --git a/tools/dev/edit_timing.sh b/tools/dev/edit_timing.shnew file mode 100755index 00000000..6d96268b--- /dev/null+++ b/tools/dev/edit_timing.sh@@ -0,0 +1,35 @@+#!/usr/bin/env bash+# Edit-one-file -> rebuilt binaries: how long the edit-build loop takes for the common cases (docs/build-speed.md).+# tools/dev/edit_timing.sh BUILD_DIR [JOBS] (BUILD_DIR configured and built already; run from the source tree)+# Each case changes one file's content (a comment line, so ccache misses like a real edit), rebuilds sculptforge,+# sculptforge_tests and sculptforge-cli, and prints the wall time plus the compile and link seconds from .ninja_log;+# then puts the file back and rebuilds (a ccache hit). With Make instead of Ninja only the wall time is printed.+set -euo pipefail+build=$1; jobs=${2:-$(nproc)}+targets=(sculptforge_tests sculptforge-cli)+grep -q '^SCULPTFORGE_BUILD_APP:BOOL=ON' "$build/CMakeCache.txt" && targets+=(sculptforge)+log=$build/.ninja_log; [ -f "$log" ] || log=/dev/null+cases=(+ "core_cpp src/core/Sculpt.cpp"+ "header src/core/Mesh.h"+ "app_cpp src/app/PanelBrushes.cpp"+ "app_shared_cpp src/app/AssetLibrary.cpp"+ "test_cpp tests/test_brushes.cpp"+)+cmake --build "$build" -j"$jobs" --target "${targets[@]}" >/dev/null 2>&1+printf '%-15s %8s %6s %9s %8s %s\n' case wall_s units compile_s link_s links+for c in "${cases[@]}"; do+ set -- $c; name=$1; file=$2+ cp "$file" "$build/.edit_timing.bak"+ printf '\n// edit_timing %s\n' "$(date +%s%N)" >> "$file"+ lines=$(wc -l < "$log")+ t0=$(date +%s.%N)+ cmake --build "$build" -j"$jobs" --target "${targets[@]}" >/dev/null 2>&1 || { cp "$build/.edit_timing.bak" "$file"; exit 1; }+ t1=$(date +%s.%N)+ cp "$build/.edit_timing.bak" "$file"+ # .ninja_log v5: start_ms end_ms mtime output hash; the new lines are this build's steps.+ tail -n +"$((lines + 1))" "$log" | awk -v wall="$(awk "BEGIN{print $t1 - $t0}")" -v name="$name" '+ { d = ($2 - $1) / 1000; if ($4 ~ /\.(o|obj)$/) { n++; c += d } else if ($4 ~ /\.(a|lib)$/) { a += d } else { l += d; links = links sprintf("%s=%.1f ", $4, d) } }+ END { printf "%-15s %8.1f %6d %9.1f %8.1f %s\n", name, wall, n, c, l + a, links }'+ cmake --build "$build" -j"$jobs" --target "${targets[@]}" >/dev/null 2>&1+done