Adding support for other build systems (Cargo, Maven, fpm, ...) is
currently blocked by CMake being special-cased at every layer. This is
the first step: pull the build-system-specific parts of the ~250 line
BaseCompiler.cmake() out behind a driver interface, with no change in
behaviour.
BaseCompiler.buildProject() now orchestrates everything that is not
specific to a build system -- temp dirs, caching, the compilation queue,
remote execution, afterCompilation and cleanup -- and CMakeBuildSystem
supplies the rest. The two hardcoded build steps became a loop over
BuildPlan.steps, each carrying its own name, executable, arguments, exec
parameters and failure placeholder. cmake() is now a delegate onto
buildProject(), so the API handler, the SQS worker and subclass
overrides are untouched.
The per-compiler hooks (getExtraCMakeArgs, getCMakeExtToolchainParam,
getCmakeBaseEnv, createCmakeExecParams) deliberately keep their
CMake-specific names and are now called by CMakeBuildSystem rather than
the orchestrator; they are CMake concepts and a Cargo driver will want
different ones. win32-vc, llvm-mos, cc65 and beebasm are unchanged.
Generalised in passing: writeAllFilesCMake() -> writeProjectFiles(),
taking the manifest filename, and getCmakeCacheKey() ->
getBuildProjectCacheKey(), which sets `api` from the driver id -- still
'cmake' for CMake, so cached builds survive.
docs/BuildSystems.md describes how CMake is wired in today and the
incremental plan for the remaining phases, with links to the issues
asking for Maven, fpm and Cargo support.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>