Installation

Installation of Aspose.Slides FOSS for C++

Aspose.Slides FOSS for C++ is a header-and-source library built with CMake. It has no binary distribution; you integrate it directly into your CMake project from the GitHub repository. No Microsoft Office or other proprietary runtime is required.


Prerequisites

RequirementDetail
C++ standardC++20 or later
Build systemCMake 3.20 or later
CompilerGCC 10+, Clang 13+, or MSVC 2019+ (any compiler with C++20 support)
Operating systemWindows, macOS, Linux
External dependenciesNone (all dependencies are vendored or header-only)

1. CMake FetchContent (Recommended)

The simplest way to add Aspose.Slides FOSS to your project is CMake FetchContent. Add this to your CMakeLists.txt:

cmake_minimum_required(VERSION 3.20)
project(my_slides_app LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(FetchContent)
FetchContent_Declare(
    aspose_slides_foss
    GIT_REPOSITORY https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git
    GIT_TAG        main
)
FetchContent_MakeAvailable(aspose_slides_foss)

add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE aspose_slides_foss)

CMake downloads the repository and makes the library target available. No manual cloning or system-level installation is needed.

To pin a specific version for reproducible builds, replace main with a release tag or commit hash:

FetchContent_Declare(
    aspose_slides_foss
    GIT_REPOSITORY https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git
    GIT_TAG        v26.3.0
)

2. Git Submodule

If you prefer vendoring the source code inside your repository:

git submodule add https://github.com/aspose-slides-foss/Aspose.Slides-FOSS-for-Cpp.git third_party/aspose_slides_foss

Then reference it from your CMakeLists.txt:

add_subdirectory(third_party/aspose_slides_foss)
target_link_libraries(my_app PRIVATE aspose_slides_foss)

3. Build and Verify

After adding the dependency, configure and build your project:

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Create a minimal main.cpp to verify the build:

#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>

#include <iostream>

using namespace Aspose::Slides::Foss;

int main() {
    Presentation pres;
    std::cout << "Aspose.Slides FOSS built successfully" << std::endl;
    std::cout << "Slides in empty presentation: " << pres.slides().size() << std::endl;
    return 0;
}

Expected output:

Aspose.Slides FOSS built successfully
Slides in empty presentation: 1

Quick Start: Create a Presentation with a Shape

The following program creates a new presentation, adds a rectangle with text, and saves it as a .pptx file:

#include <Aspose/Slides/Foss/auto_shape.h>
#include <Aspose/Slides/Foss/export/save_format.h>
#include <Aspose/Slides/Foss/presentation.h>
#include <Aspose/Slides/Foss/shape_collection.h>
#include <Aspose/Slides/Foss/shape_type.h>
#include <Aspose/Slides/Foss/slide.h>
#include <Aspose/Slides/Foss/slide_collection.h>
#include <Aspose/Slides/Foss/text_frame.h>

#include <iostream>

using namespace Aspose::Slides::Foss;

int main() {
    Presentation pres;
    auto& slide = pres.slides()[0];

    // Add a rectangle shape and set its text
    auto& shape = slide.shapes().add_auto_shape(ShapeType::RECTANGLE, 50, 50, 400, 150);
    shape.text_frame()->set_text("Hello from Aspose.Slides FOSS!");

    pres.save("hello.pptx", SaveFormat::PPTX);
    std::cout << "Saved hello.pptx" << std::endl;
    return 0;
}

Important: Presentation uses RAII. When the object goes out of scope, internal resources are released automatically. You can also call pres.dispose() explicitly if needed; calling it multiple times is safe.


Platform Notes

Windows, macOS, Linux: The library builds identically on all platforms. There are no platform-specific code paths or binary extensions.

Docker / CI: Clone or fetch the repository in your build step and run CMake. No additional system packages are required beyond a C++20 compiler and CMake.

vcpkg / Conan: Not currently published to vcpkg or Conan. Use FetchContent or git submodule instead.


Additional Resources

 English