Sparkle is a C++20 static library that bundles a resource pipeline and an OpenGL rendering layer. The project is driven by CMake, uses Ninja as its default generator, and relies on vcpkg to resolve third-party dependencies (GLEW, OpenGL, stb, and GoogleTest for optional unit tests).
Follow the numbered subsections below to install each prerequisite before building Sparkle.
- Download and install Visual Studio 2022 Build Tools.
- During setup, enable the Desktop development with C++ workload to obtain the MSVC compiler, Windows SDK, and Ninja support.
- Open a new
x64 Native Tools Command Promptor PowerShell session and verify the compiler is available:The command should print the compiler version banner instead of an error.cl
Sparkle uses vcpkg in manifest mode to fetch GLEW, OpenGL, stb, and GoogleTest.
- Clone the vcpkg repository:
git clone https://github.com/microsoft/vcpkg.git C:\dev\vcpkg
- Bootstrap vcpkg:
& C:\dev\vcpkg\bootstrap-vcpkg.bat
- Make the installation discoverable by CMake (per-session example):
Optionally, add
$env:VCPKG_ROOT = 'C:\dev\vcpkg'
VCPKG_ROOTto your global environment variables so it persists across terminals.
- Download the Windows x64 installer from the CMake downloads page.
- Run the installer and choose Add CMake to the system PATH when prompted.
- Confirm the version:
cmake --version
- Use your preferred package manager to install Doxygen:
Alternatively, download the Windows installer from doxygen.nl and follow the setup steps.
choco install doxygen.portable
- (Optional) Install Graphviz to enable diagram generation:
choco install graphviz
- Confirm both tools are available:
doxygen --version dot -V
Sparkle's static analysis pipeline relies on clang-tidy. Install LLVM to get both the Clang compiler and clang-tidy command-line tool:
- Install the LLVM toolchain:
If you prefer manual installation, download the Windows package from the LLVM releases page and follow the installer steps.
choco install llvm
- Verify the tools are on your
PATH:Both commands should print version banners. Theclang --version clang-tidy --version
clang-tidypreset described below requires these binaries.
- Clone the repository (skip if you already have a working copy):
git clone https://github.com/YourOrganization/Sparkle.git cd Sparkle
- Configure the project with one of the supplied presets:
The presets automatically point CMake to
cmake --preset release # or debug
VCPKG_ROOT, enable C++20, and cap object-path lengths for Windows builds. - Build the library and tools:
Artifacts are emitted to
cmake --build --preset release # or debug
build/<preset>/out/{bin,lib}/<Config>/<x64|x86>.
Use the dedicated preset to perform static analysis with clang-tidy. The preset reconfigures the project in a separate build tree so it does not disturb your normal build artifacts:
cmake --preset clang-tidy
cmake --build --preset clang-tidyAny diagnostics reported by clang-tidy are treated as errors and will cause the step to fail.
After a successful build, you can produce the HTML documentation configured in Doxyfile:
doxygen DoxyfileThe output is written to docs/build/html/index.html. Open that file in your browser to review the API documentation. Any warnings reported by Doxygen must be addressed because the configuration treats warnings as errors.
Sparkle includes a CMake target that builds the unit tests with Clang's coverage instrumentation and fails when the line coverage drops below the configured threshold (75% by default). Make sure LLVM/Clang is installed as described in section 1.5, then run:
cmake --preset coverage-clang
cmake --build --preset coverage-clangThe second command compiles the library, executes the test suite, and enforces the coverage gate by invoking the custom coverage target. The run emits a human-readable summary at build/coverage-clang/coverage/summary.txt, which is also uploaded as a CI artifact. Adjust the minimum line coverage from the command line if required, for example:
cmake --preset coverage-clang -DSPARKLE_COVERAGE_MIN_LINE_RATE=80Running the build preset again will reuse the existing coverage configuration while applying the stricter threshold.
In addition to the summary text, the coverage run produces a full HTML report that highlights every instrumented region. You can open build/coverage-clang/coverage/html/index.html for the build-tree view, review the mirrored copy under docs/build/coverage/index.html, or browse the live site at https://hyarius.github.io/HiddenSparkle/coverage/.
Install the compiled headers, library, and CMake package configuration:
cmake --install build/release # or build/debug- By default, CMake installs to
C:\Program Files\Sparkleon Windows. - To customize the destination, pass a prefix during configuration or installation:
cmake --preset release -DCMAKE_INSTALL_PREFIX=C:\Dev\Sparkle cmake --install build/release --prefix C:\Dev\Sparkle
- The install tree contains:
include\– public headers plus the generatedspk_generated_resources.hpplib\– static librarieslib\cmake\Sparkle\–SparkleConfig.cmake,SparkleTargets.cmake, and version file
Once installed, CMake also registers the build tree with your user package registry so local projects can reference Sparkle without a manual install while you iterate.
- Make sure CMake can locate the Sparkle package:
- If you used the default install prefix, CMake finds Sparkle automatically.
- For a custom prefix, point CMake at the install directory:
cmake -S <project> -B <build> -DCMAKE_PREFIX_PATH="C:/Dev/Sparkle"
- Alternatively, reference the package directory explicitly:
cmake -S <project> -B <build> -DSparkle_DIR="C:/Dev/Sparkle/lib/cmake/Sparkle"
- In your project’s
CMakeLists.txt, consume the package and link against the imported target:cmake_minimum_required(VERSION 3.16) project(MyApp LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Sparkle REQUIRED) add_executable(MyApp src/main.cpp # ...your sources... ) target_link_libraries(MyApp PRIVATE Sparkle::Sparkle)
- Sparkle exports its include directories, so once linked you can include headers directly:
#include <sparkle>
You are now ready to integrate Sparkle into your project