Skip to content

aregtech/areg-sdk-demo

Repository files navigation

Areg SDK Demo Project

Repository Status

This project demonstrates how to integrate and use the Areg SDK for various purposes. The current build status is shown below:

CMake MSBuild CodeQL


Table of Contents


Introduction

The Areg SDK Demo Project provides a practical example and template for developers to create new projects using the Areg SDK or integrating it into existing projects.

This demo showcases three primary ways to integrate Areg SDK into your project:

  1. Fetching source code using CMake — directly fetch Areg SDK source files and build them alongside your project.
  2. Using pre-built vcpkg packages — integrate the Areg SDK as a package via CMake and vcpkg.
  3. Adding Areg SDK as a Git submodule — integrate Areg SDK into your project to work with MSBuild and/or CMake.

Each method is described in detail below.


System Requirements

General Requirements

Ensure your system includes the following:

  • Git for repository cloning.
  • Java 17+ for code generation tools.
  • Compilers: GNU or LLVM (Linux); MSVC or Clang (Windows). Must support C++17 or newer.
  • Build Tools: CMake 3.20+ or Microsoft Visual Studio 2019+.

Platform-Specific Requirements

  • Linux: Install ncurses if you want to compile with extended objects.
  • Windows: Requires Microsoft Visual C++, including CMake, Clang for Windows, and MFC for GUI examples.
  • Optional Libraries:
    • Google Test (GTest) for unit tests (or let Areg SDK build it from sources).
    • SQLite3 (or let Areg SDK build from sources).

Integration Methods

Method 1: Integrate by Fetching Areg SDK Source Code

Modify your project’s CMakeLists.txt to include:

include(FetchContent)
FetchContent_Declare(
  areg-sdk
  GIT_REPOSITORY https://github.com/aregtech/areg-sdk.git
  GIT_TAG "master"
)
FetchContent_MakeAvailable(areg-sdk)

# Set the root directory of the fetched Areg SDK
set(AREG_SDK_ROOT "${areg-sdk_SOURCE_DIR}")
include_directories(${AREG_SDK_ROOT}/framework)

Once fetched, you can use the Areg SDK libraries via the areg:: namespace:

  • areg::areg — core framework library
  • areg::aregextend — extended objects
  • areg::areglogger — logging client API

This method also gives access to the code generator (codegen), multicast router (mcrouter), and logging services (logger).


Method 2: Integrate via Areg SDK Package (vcpkg)

Important

Areg SDK is prepared and tested as a vcpkg package. It is expected to be included in the upcoming version 2.0.0.

Steps:

  1. Clone, build, and install vcpkg (see vcpkg repo).
  2. Install the Areg SDK package:

Windows (64-bit):

vcpkg install areg:x64-windows

Linux (64-bit):

vcpkg install areg:x64-linux
  1. Integrate vcpkg into your project:
vcpkg integrate install
  1. Update CMakeLists.txt:
find_package(areg CONFIG REQUIRED)
include_directories(${AREG_FRAMEWORK})

Compile with:

cmake -B ./build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake

This method offers a modular approach to using the Areg SDK.


Method 3: Integrate Areg SDK as a Git Submodule

Add Areg SDK as a submodule (useful for Visual Studio):

[submodule "thirdparty/areg-sdk"]
  path = thirdparty/areg-sdk
  url = https://github.com/aregtech/areg-sdk.git

Initialize:

git submodule update --init --recursive
git submodule update --remote --recursive

Update CMakeLists.txt:

set(AREG_SDK_ROOT "${CMAKE_SOURCE_DIR}/thirdparty/areg-sdk")
include("${AREG_SDK_ROOT}/CMakeLists.txt")

This allows direct inclusion of Areg SDK projects in Visual Studio solutions.


Advanced Features

The Areg SDK can be integrated before or after the first project() call in CMake, enabling flexible customization (e.g., compiler choice, shared/static libraries, logging, advanced objects).

This demo includes an option INTEGRATE_AREG_BEFORE_PROJECT. Set it to TRUE or FALSE to experiment with both approaches.

For more customization, include areg.cmake and check user.cmake.

You can include via:

include("${AREG_CMAKE_CONFIG_DIR}/areg.cmake")

or (for vcpkg integration):

include("${AREG_CMAKE_EXPORTS}")

Building the Areg SDK Demo Project

Ensure:

  1. CMake 3.20+
  2. Java 17+
  3. C++17+ compiler

Clone the repo:

git clone https://github.com/aregtech/areg-sdk-demo.git

Build (fetching Areg SDK sources):

cmake -B ./build
cmake --build ./build

Build (Areg SDK via vcpkg):

cmake -B ./build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake
cmake --build ./build

Build with Visual Studio:

Open areg-sdk-demo.sln and compile.

Important

For Visual Studio builds, clone with submodules:

git clone --recurse-submodules https://github.com/aregtech/areg-sdk-demo.git

Demo Applications

Located in ./demo/. They are adapted from Areg SDK examples. You can explore, modify, or add new demos.


Contribution Guidelines

Contributions are welcome! You can:

  • Add new example projects
  • Provide configuration/build examples
  • Create CI/CD workflows

To contribute:

  1. Fork the repo.
  2. Make your changes.
  3. Ensure compatibility (CMake, Visual Studio, GCC, MSVC, Clang).
  4. Open a Pull Request with details.

License

Licensed under the MIT License. Free for personal and commercial use.


Issues and Feedback

For bugs or feature requests, open an issue in the Issues section. Your feedback is appreciated!

Releases

No releases published

Packages

No packages published

Languages