Skip to content

Commit 30c8108

Browse files
authored
Updated demo project (#41)
* Update demo to adapt to the new changes of areg-sdk
1 parent 77b13ec commit 30c8108

File tree

255 files changed

+3508
-2066
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+3508
-2066
lines changed

README.md

Lines changed: 103 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
# AREG SDK Demo Project
1+
# Areg SDK Demo Project
22

33
## Repository Status
44

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

77
[![CMake](https://github.com/aregtech/areg-sdk-demo/actions/workflows/cmake.yml/badge.svg?branch=master)](https://github.com/aregtech/areg-sdk-demo/actions/workflows/cmake.yml)
88
[![MSBuild](https://github.com/aregtech/areg-sdk-demo/actions/workflows/msbuild.yml/badge.svg?branch=master)](https://github.com/aregtech/areg-sdk-demo/actions/workflows/msbuild.yml)
99
[![CodeQL](https://github.com/aregtech/areg-sdk-demo/actions/workflows/codeql.yml/badge.svg)](https://github.com/aregtech/areg-sdk-demo/actions/workflows/codeql.yml)
1010

1111
---
1212

13-
# Tarble of Contents
13+
# Table of Contents
1414

1515
- [Introduction](#introduction)
1616
- [System Requirements](#system-requirements)
1717
- [General Requirements](#general-requirements)
1818
- [Platform-Specific Requirements](#platform-specific-requirements)
1919
- [Integration Methods](#integration-methods)
20-
- [Method 1: Integrate by Fetching AREG SDK Source Code](#method-1-integrate-by-fetching-areg-sdk-source-code)
21-
- [Method 2: Integrate via AREG SDK Package (vcpkg)](#method-2-integrate-via-areg-sdk-package-vcpkg)
22-
- [Method 3: Integrate AREG SDK as a Git Submodule](#method-3-integrate-areg-sdk-as-a-git-submodule)
20+
- [Method 1: Integrate by Fetching Areg SDK Source Code](#method-1-integrate-by-fetching-areg-sdk-source-code)
21+
- [Method 2: Integrate via Areg SDK Package (vcpkg)](#method-2-integrate-via-areg-sdk-package-vcpkg)
22+
- [Method 3: Integrate Areg SDK as a Git Submodule](#method-3-integrate-areg-sdk-as-a-git-submodule)
2323
- [Advanced Features](#advanced-features)
24-
- [Building the AREG SDK Demo Project](#building-the-areg-sdk-demo-project)
24+
- [Building the Areg SDK Demo Project](#building-the-areg-sdk-demo-project)
2525
- [Demo Applications](#demo-applications)
2626
- [Contribution Guidelines](#contribution-guidelines)
2727
- [License](#license)
@@ -31,13 +31,13 @@ This project demonstrates how to integrate and use the AREG SDK for various purp
3131

3232
## Introduction
3333

34-
The **AREG SDK Demo Project** provides a practical example and template for developers to create new projects using the [AREG SDK](https://github.com/aregtech/areg-sdk/) or integrating it into existing projects.
34+
The **Areg SDK Demo Project** provides a practical example and template for developers to create new projects using the [Areg SDK](https://github.com/aregtech/areg-sdk/) or integrating it into existing projects.
3535

36-
This demo showcases three primary ways for seamless integration of AREG SDK into your project:
36+
This demo showcases three primary ways to integrate Areg SDK into your project:
3737

38-
1. **Fetching source code using cmake**: Directly fetch AREG SDK source files and build them alongside your project using CMake.
39-
2. **Using pre-built vcpkg packages**: Integrate the AREG SDK as a package via CMake and vcpkg.
40-
3. **Adding AREG SDK as a submodule**: Add AREG SDK as a Git submodule to your project to integrate with `MSBuild` and/or `cmake`.
38+
1. **Fetching source code using CMake** — directly fetch Areg SDK source files and build them alongside your project.
39+
2. **Using pre-built vcpkg packages** — integrate the Areg SDK as a package via CMake and vcpkg.
40+
3. **Adding Areg SDK as a Git submodule** — integrate Areg SDK into your project to work with MSBuild and/or CMake.
4141

4242
Each method is described in detail below.
4343

@@ -47,25 +47,27 @@ Each method is described in detail below.
4747

4848
### General Requirements
4949
Ensure your system includes the following:
50-
- **Git** for repository cloning.
51-
- **Java** version 17 or newer for code generation tools.
52-
- **Compatible Compilers**: *GNU* or *LLVM* to build for Linux; *MSVC* or *Clang* to build for Windows. All compilers should support **C++17** or newer.
53-
- **Build Tools**: *Cmake* version 3.20 or newer, or Microsoft Visual Studio 2019 or newer.
50+
51+
- **Git** for repository cloning.
52+
- **Java 17+** for code generation tools.
53+
- **Compilers**: GNU or LLVM (Linux); MSVC or Clang (Windows). Must support **C++17** or newer.
54+
- **Build Tools**: CMake 3.20+ or Microsoft Visual Studio 2019+.
5455

5556
### Platform-Specific Requirements
56-
- **Linux**: Install **ncurses** if you want to compile with extended objects.
57-
- **Windows**: Requires Microsoft Visual C++, including packages **CMake** and **CLang compiler for Windows**, and **MFC** for GUI examples.
58-
- **Optional Libraries**:
59-
- **Google Test (GTest)** for unit tests or AREG SDK automatically builds from sources.
60-
- **SQLite3** or AREG SDK can build from sources.
57+
58+
- **Linux**: Install **ncurses** if you want to compile with extended objects.
59+
- **Windows**: Requires Microsoft Visual C++, including **CMake**, **Clang for Windows**, and **MFC** for GUI examples.
60+
- **Optional Libraries**:
61+
- **Google Test (GTest)** for unit tests (or let Areg SDK build it from sources).
62+
- **SQLite3** (or let Areg SDK build from sources).
6163

6264
---
6365

6466
## Integration Methods
6567

66-
### Method 1: Integrate by Fetching AREG SDK Source Code
68+
### Method 1: Integrate by Fetching Areg SDK Source Code
6769

68-
To integrate the AREG SDK by fetching its source code, modify your project’s `CMakeLists.txt` to include the following script:
70+
Modify your project’s `CMakeLists.txt` to include:
6971

7072
```cmake
7173
include(FetchContent)
@@ -76,162 +78,190 @@ FetchContent_Declare(
7678
)
7779
FetchContent_MakeAvailable(areg-sdk)
7880
79-
# Set the root directory of the fetched AREG SDK
81+
# Set the root directory of the fetched Areg SDK
8082
set(AREG_SDK_ROOT "${areg-sdk_SOURCE_DIR}")
8183
include_directories(${AREG_SDK_ROOT}/framework)
82-
```
84+
````
8385
84-
Once fetched, you can use the AREG SDK libraries in your project via the `areg::` namespace:
86+
Once fetched, you can use the Areg SDK libraries via the `areg::` namespace:
8587
86-
- `areg::areg` for the core framework library
87-
- `areg::aregextend` for extended objects
88-
- `areg::areglogger` for the logging client API
88+
* `areg::areg` core framework library
89+
* `areg::aregextend` extended objects
90+
* `areg::areglogger` logging client API
8991
90-
Projects built by fetching the AREG SDK source code directly, compile it alongside project code.
91-
Developers can also access the code generator (`codegen`), multicast router (`mcrouter`), and logging services (`logger`).
92+
This method also gives access to the **code generator (`codegen`)**, **multicast router (`mcrouter`)**, and **logging services (`logger`)**.
9293
9394
---
9495
95-
### Method 2: Integrate via AREG SDK Package (vcpkg)
96+
### Method 2: Integrate via Areg SDK Package (vcpkg)
9697
9798
> [!IMPORTANT]
98-
> AREG SDK is prepared and tested to be a `vcpkg` package. It is expected to be included in the upcoming version 2.0.0
99+
> Areg SDK is prepared and tested as a `vcpkg` package. It is expected to be included in the upcoming version 2.0.0.
99100
100-
Projects using CMake can integrate AREG SDK through the `vcpkg` package manager. To install, follow these steps:
101+
Steps:
101102
102-
1. Clone, build and install vcpkg by following the instructions in the [official vcpkg repository](https://github.com/microsoft/vcpkg).
103-
2. Install the AREG SDK package using the following commands:
103+
1. Clone, build, and install vcpkg (see [vcpkg repo](https://github.com/microsoft/vcpkg)).
104+
2. Install the Areg SDK package:
104105
105106
**Windows (64-bit):**
107+
106108
```bash
107109
vcpkg install areg:x64-windows
108110
```
109111

110112
**Linux (64-bit):**
113+
111114
```bash
112115
vcpkg install areg:x64-linux
113116
```
114117

115-
After installing the package, add the vcpkg toolchain to your project displayed after running this command:
118+
3. Integrate vcpkg into your project:
119+
116120
```bash
117121
vcpkg integrate install
118122
```
119123

120-
To include the AREG SDK package in your project, update your `CMakeLists.txt` like this:
124+
4. Update `CMakeLists.txt`:
125+
121126
```cmake
122127
find_package(areg CONFIG REQUIRED)
123128
include_directories(${AREG_FRAMEWORK})
124129
```
125130

126-
To compile the sources, configure the project with CMake option `-DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake`, where `<vcpkg-root>` should indicate the root folder of `vcpkg`, and build it.
131+
Compile with:
132+
133+
```bash
134+
cmake -B ./build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake
135+
```
127136

128-
This method provides a simpler and more modular approach to integrating the AREG SDK.
137+
This method offers a modular approach to using the Areg SDK.
129138

130139
---
131140

132-
### Method 3: Integrate AREG SDK as a Git Submodule
141+
### Method 3: Integrate Areg SDK as a Git Submodule
133142

134-
Alternatively, you can add AREG SDK as a submodule to your project. This is particularly useful for managing dependencies in Microsoft Visual Studio solutions. To integrate AREG SDK as a submodule, add the following to your `.gitmodules` file:
143+
Add Areg SDK as a submodule (useful for Visual Studio):
135144

136145
```txt
137146
[submodule "thirdparty/areg-sdk"]
138147
path = thirdparty/areg-sdk
139148
url = https://github.com/aregtech/areg-sdk.git
140149
```
141150

142-
Then run the following commands to update and/or fetch the submodule:
151+
Initialize:
143152

144153
```bash
145154
git submodule update --init --recursive
146155
git submodule update --remote --recursive
147156
```
148157

149-
Add the AREG SDK to your `CMakeLists.txt` like this:
158+
Update `CMakeLists.txt`:
159+
150160
```cmake
151161
set(AREG_SDK_ROOT "${CMAKE_SOURCE_DIR}/thirdparty/areg-sdk")
152162
include("${AREG_SDK_ROOT}/CMakeLists.txt")
153163
```
154164

155-
This method is particularly useful for Microsoft Visual Studio builds by including desired project of AREG SDK in your solution file.
165+
This allows direct inclusion of Areg SDK projects in Visual Studio solutions.
156166

157167
---
158168

159169
## Advanced Features
160170

161-
The AREG SDK can be integrated before or after the first call of `project()` in CMake, depending on your needs.
162-
This flexibility allows for custom configurations, such as specifying the compiler or enabling features like shared/static libraries, logging, and advanced objects.
163-
To explore this flexibility, the demo project includes a compiler option `INTEGRATE_AREG_BEFORE_PROJECT`. Set this option to `TRUE` or `FALSE` to experiment with both approaches.
171+
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).
164172

165-
For more advanced configuration, include [areg.cmake](https://github.com/aregtech/areg-sdk/blob/master/conf/cmake/areg.cmake) in your `CMakeLists.txt` file
166-
and refer to the available options described in the [user.cmake](https://github.com/aregtech/areg-sdk/blob/master/conf/cmake/user.cmake)
167-
file located in the `conf/cmake` directory of the AREG SDK. Your can use this CMake script in your CMakeLists.txt: `include("${AREG_CMAKE_CONFIG_DIR}/areg.cmake")`
168-
or script `include("${AREG_CMAKE_EXPORTS}")` if use AREG SDK package.
173+
This demo includes an option `INTEGRATE_AREG_BEFORE_PROJECT`. Set it to `TRUE` or `FALSE` to experiment with both approaches.
174+
175+
For more customization, include [areg.cmake](https://github.com/aregtech/areg-sdk/blob/master/conf/cmake/areg.cmake) and check [user.cmake](https://github.com/aregtech/areg-sdk/blob/master/conf/cmake/user.cmake).
176+
177+
You can include via:
178+
179+
```cmake
180+
include("${AREG_CMAKE_CONFIG_DIR}/areg.cmake")
181+
```
182+
183+
or (for vcpkg integration):
184+
185+
```cmake
186+
include("${AREG_CMAKE_EXPORTS}")
187+
```
169188

170189
---
171190

172-
## Building the AREG SDK Demo Project
191+
## Building the Areg SDK Demo Project
173192

174-
To build the demo applications, ensure that you have:
193+
Ensure:
175194

176-
1. CMake (version 3.20 or higher)
177-
2. Java (version 17 or higher)
178-
3. C++ compiler (standard 17 or higher)
195+
1. CMake 3.20+
196+
2. Java 17+
197+
3. C++17+ compiler
198+
199+
**Clone the repo:**
179200

180-
**Clone the demo project:**
181201
```bash
182202
git clone https://github.com/aregtech/areg-sdk-demo.git
183203
```
184204

185-
**Build using CMake (fetching AREG SDK sources):**
205+
**Build (fetching Areg SDK sources):**
206+
186207
```bash
187208
cmake -B ./build
188209
cmake --build ./build
189210
```
190211

191-
**Build using AREG SDK as a package:**
212+
**Build (Areg SDK via vcpkg):**
213+
192214
```bash
193215
cmake -B ./build -DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake
194216
cmake --build ./build
195217
```
196218

197-
**Build with Microsoft Visual Studio:**
219+
**Build with Visual Studio:**
198220

199-
Open the solution file (`areg-sdk-demo.sln`) and compile.
221+
Open `areg-sdk-demo.sln` and compile.
200222

201223
> [!IMPORTANT]
202-
> Compilation with Visual Studio requires to clone this repository with AREG SDK submodule. Make sure that you have cloned the repository by calling `git clone --recurse-submodules https://github.com/aregtech/areg-sdk-demo.git`.
224+
> For Visual Studio builds, clone with submodules:
225+
>
226+
> ```bash
227+
> git clone --recurse-submodules https://github.com/aregtech/areg-sdk-demo.git
228+
> ```
203229
204230
---
205231
206232
## Demo Applications
207233
208-
The demo applications are located in the `./demo/` directory. They are simple examples taken from the [AREG SDK examples](https://github.com/aregtech/areg-sdk/tree/master/examples). You can explore, modify, or contribute new examples to showcase additional features or use cases.
234+
Located in `./demo/`.
235+
They are adapted from [Areg SDK examples](https://github.com/aregtech/areg-sdk/tree/master/examples).
236+
You can explore, modify, or add new demos.
209237
210238
---
211239
212240
## Contribution Guidelines
213241
214242
Contributions are welcome! You can:
215243
216-
- Add new example projects
217-
- Provide configuration and build examples
218-
- Create workflows for automated builds and tests
244+
* Add new example projects
245+
* Provide configuration/build examples
246+
* Create CI/CD workflows
219247
220248
To contribute:
221249
222-
1. Fork the repository.
223-
2. Implement your changes.
224-
3. Ensure compatibility with CMake, Microsoft Visual Studio, and multiple compilers (GCC, MSVC, Clang).
225-
4. Submit a Pull Request with a detailed description.
250+
1. Fork the repo.
251+
2. Make your changes.
252+
3. Ensure compatibility (CMake, Visual Studio, GCC, MSVC, Clang).
253+
4. Open a Pull Request with details.
226254
227255
---
228256
229257
## License
230258
231-
This project is licensed under the [MIT License](https://github.com/aregtech/areg-sdk-demo/blob/main/LICENSE), offering flexibility for personal and commercial use.
259+
Licensed under the [MIT License](https://github.com/aregtech/areg-sdk-demo/blob/main/LICENSE).
260+
Free for personal and commercial use.
232261
233262
---
234263
235264
## Issues and Feedback
236265
237-
For any change requests or bug reports, please submit an issue in the [Issues](https://github.com/aregtech/areg-sdk-demo/issues) section. We value your feedback and contributions!
266+
For bugs or feature requests, open an issue in the [Issues](https://github.com/aregtech/areg-sdk-demo/issues) section.
267+
Your feedback is appreciated!

0 commit comments

Comments
 (0)