Skip to content

[CMAKE] Standardize the build outputs - #113

Open
lukeyreyno wants to merge 3 commits into
nianticlabs:mainfrom
lukeyreyno:lreyna/build-cleanup
Open

lukeyreyno wants to merge 3 commits into
nianticlabs:mainfrom
lukeyreyno:lreyna/build-cleanup

Conversation

@lukeyreyno

Copy link
Copy Markdown
Collaborator

Summary

Standardizes how the repo is built and tested. CMake presets give each configuration a named build folder under build/<preset>/, helper scripts wrap those presets for users and CI, and .gitignore now covers build output by explicit rules instead of by accident.

Changes

  • Presets: new CMakePresets.json (CMake 3.21+) with dev, dev-ext, debug, wasm, wasm-ext, android-arm64 and android-arm64-ext; each builds into build/<preset>/, and the native presets have matching test presets.
  • Scripts: scripts/build.sh <preset> checks prerequisites and then configures and builds; scripts/test.sh <preset> builds and then runs CTest; scripts/test-python.sh [--ext] builds the bindings into .venv/ and runs pytest.
  • ⚠️ WASM output: spz.js, spz.d.ts and the helper files now go to build/<preset>/dist/ instead of the in-repo dist/; the new SPZ_WASM_OUTPUT_DIR setting overrides the location. Separate builds with and without extensions no longer overwrite each other.
  • C++ tests: the CLI tools now have CTest smoke tests that round-trip samples/hornedlizard.spz (SPZ to PLY to SPZ) and check the point count. They are enabled only when BUILD_TESTING is on and spz is the top-level project.
  • CMake fixes:
    • Minimum version is 3.14...3.31 (FetchContent_MakeAvailable needs 3.14).
    • zlib downloads from its GitHub release (same SHA256) instead of zlib.net, which removes old tarballs.
    • -O3 is no longer applied to Debug WASM builds.
    • Removed the duplicate -sUSE_ZLIB flag and the copy_spz_dts target, which did nothing.
    • zstd multithreading is off for Emscripten.
    • The WASM presets fail with a clear message if configured without emcmake.
  • Python packaging: removed the unused python_devtools build requirement, moved the scikit-build folder to build/py/, and cibuildwheel now installs the tests extra and runs tests/python.
  • CI and repo hygiene:
    • All CI jobs go through the presets and scripts, and native jobs get separate Build and Test steps.
    • The WASM job checks that all four files are produced.
    • .gitignore now ignores /build/, /build-*/, /dist/, .venv/, node_modules/ and .claude/worktrees/, and the repo-wide *.cmake rule is replaced with specific file names.
    • README build docs are rewritten around the presets and scripts.

Testing

  • Locally on macOS:
    • scripts/test.sh dev, scripts/test.sh dev-ext and scripts/test.sh debug pass 4/4 smoke tests.
    • scripts/build.sh wasm and scripts/build.sh wasm-ext produce all four files in build/<preset>/dist/.
    • Configuring a WASM preset without emcmake fails with the guard message.
    • scripts/test.sh wasm exits early with the list of presets that have tests.
  • Not yet run: scripts/test-python.sh and scripts/test-python.sh --ext (blocked in the dev sandbox), and the Android presets (need ANDROID_NDK_HOME).
  • Check: git status stays clean after builds; git check-ignore cmake/Foo.cmake reports the file as not ignored.

@lukeyreyno
lukeyreyno requested a review from ProjitB as a code owner November 10, 2026 00:54
@lukeyreyno lukeyreyno self-assigned this Nov 10, 2026

@skywolf829 skywolf829 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @lukeyreyno, this is a nice cleanup! presets + scripts are much easier to follow, and CI is green across the board. a few things:

  • CMakePresets.json: build presets don't pin a configuration. the test presets run RelWithDebInfo, but the build presets don't set configuration. with a multi-config generator (VS is the default on windows when ninja isn't on PATH), cmake --build --preset dev builds Debug, and then ctest --preset dev can't find the binaries. you can repro on mac with rm -rf build/dev && CMAKE_GENERATOR="Ninja Multi-Config" scripts/test.sh dev, which gives 4/4 "Not Run". CI forces ninja, so it never hits this. adding "configuration": "RelWithDebInfo" to the build presets (and "Debug" for debug) should fix it.
  • wasm output moving out of dist/. just flagging that this hits every wasm build, not only preset builds: plain emcmake cmake -B build-wasm . now writes to build-wasm/dist/. anything that copies from <repo>/dist/ (e.g. however we're producing @adobe/spz) will need updating. it also overlaps with lreyna/spz-packages, which writes the 2gb/4gb variants to ${CMAKE_CURRENT_SOURCE_DIR}/dist and dist/4gb, so it's probably worth deciding which layout wins before both land.
  • nits:
    • .gitignore: the .claude/worktrees/ and .claude/settings.local.json entries feel like personal tooling for a shared upstream repo. maybe drop them, or put them in .git/info/exclude?
    • test.yml: the android job name still uses matrix.abi, but the preset hard-codes arm64-v8a.
    • the debug test preset repeats output from base instead of inheriting it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants