#pragma once #include #include #include #include #include #include "breeze/Presets.hpp" #include "breeze/Project.hpp" /// Building, installing, running and cleaning a project -- by driving the SDK's own scripts, so the /// environment they set up (the pinned Ninja, the MSVC environment on Windows) is always the one /// used. Where a request needs something the scripts don't offer (extra `cmake --build` arguments, /// skipping the configure), the CLI runs `cmake --build` itself against the build the scripts made. namespace breeze { struct BuildRequest { PresetQuery preset; /// Release, Debug, ReleaseDebugSymbols or MinSizeRel (any case). std::optional mode; std::optional jobs; std::vector configureArgs; std::vector buildArgs; bool noConfigure = false; bool noBuild = false; }; /// The CMake build type for a mode name; throws Error for an unknown one. std::string buildTypeFor(const std::string& mode); /// Values of the project's settings (BUILD_OUTPUT_DIR, DOCS_OUTPUT_DIR, ...) as the SDK /// computes them. Falls back to the SDK's defaults for a legacy layout that can't be asked. std::map readConfigVariables(const Project& project, const std::vector& names); /// The build directory for the preset (or the one built last), as the SDK defines it. std::filesystem::path buildDirFor(const Project& project, const std::optional& preset); /// Each returns the exit code of the command that did the work. int build(const Project& project, const BuildRequest& request); int install(const Project& project, const BuildRequest& request); int docs(const Project& project); int run(const Project& project, const std::optional& id, const PresetQuery& where, const std::vector& programArgs); int setup(const Project& project, bool required, bool all); /// Removes the build directories (unless keepBuild) and the documentation (if alsoDocs). /// Returns the paths removed, relative to the project. std::vector clean(const Project& project, bool keepBuild, bool alsoDocs); }