Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / README.md
1 ![Build Status](https://github.com/rive-app/rive-cpp/actions/workflows/tests.yml/badge.svg) 
2 ![Discord badge](https://img.shields.io/discord/532365473602600965)
3 ![Twitter handle](https://img.shields.io/twitter/follow/rive_app.svg?style=social&label=Follow)
4
5
6 # rive-cpp
7 C++ runtime for [Rive](https://rive.app). Provides these runtime features:
8 - Loading Artboards and their contents from **.riv** files.
9 - Querying LinearAnimations and StateMachines from Artboards.
10 - Making changes to Artboard hierarchy (fundamentally same guts used by LinearAnimations and StateMachines) and effienclty solving those changes via Artboard::advance.
11 - Abstract Renderer for submitting high level vector path commands with retained path objects to optimize and minimize path re-computation (ultimately up to the concrete rendering implementation).
12 - Example concrete renderer written in C++ with [Skia](https://skia.org/). Skia renderer code is in [skia/renderer/src/skia_renderer.cpp](skia/renderer/src/skia_renderer.cpp).
13
14 ## Build System
15 We use [premake5](https://premake.github.io/). The Rive dev team primarily works on MacOS. There is some work done by the community to also support Windows and Linux. PRs welcomed for specific platforms you with to support! We encourage you to use premake as it's highly extensible and configurable for a variety of platforms.
16
17 ## Build
18 In the ```rive-cpp``` directory, run ```build.sh``` to debug build and ```build.sh release``` for a release build.
19
20 If you've put the `premake5` executable in the `rive-cpp/build` folder, you can run it with `PATH=.:$PATH ./build.sh`
21
22 ## Building skia projects
23 ```
24 cd skia/dependencies
25 ./make_skia.sh      // this will invoke get_skia.sh
26 ```
27 To build viewer (plus you'll needed CMake installed)
28 ```
29 ./make_viewer_dependencies.sh
30 ```
31
32 ## Testing
33 Uses the [Catch2](https://github.com/catchorg/Catch2) testing framework.
34
35 ```
36 cd dev
37 ./test.sh
38 ```
39
40 In the ```dev``` directory, run ```test.sh``` to compile and execute the tests.
41
42 (if you've installed `premake5` in `rive-cpp/build`, you can run it with `PATH=../../build:$PATH ./test.sh`)
43
44 The tests live in ```rive/test```. To add new tests, create a new ```xxx_test.cpp``` file here. The test harness will automatically pick up the new file.
45
46 There's a VSCode command provided to ```run tests``` from the Tasks: Run Task command palette. 
47
48 ## Code Formatting
49 rive-cpp uses clang-format, you can install it with brew on MacOS: ```brew install clang-format```.
50
51 ## Memory Checks
52 Note that if you're on MacOS you'll want to install valgrind, which is somewhat complicated these days. This is the easiest solution (please PR a better one when it becomes available).
53 ```
54 brew tap LouisBrunner/valgrind
55 brew install --HEAD LouisBrunner/valgrind/valgrind
56 ```
57 You can now run the all the tests through valgrind by running ```test.sh memory```.
58
59 ## Disassembly Explorer
60 If you want to examine the generated assembly code per cpp file, install [Disassembly Explorer](https://marketplace.visualstudio.com/items?itemName=dseight.disasexpl) in VSCode.
61
62 A ```disassemble``` task is provided to compile and preview the generated assembly. You can reach it via the Tasks: Run Task command palette or you can bind it to a shortcut by editing your VSCode keybindings.json:
63 ```
64 [
65     {
66         "key": "cmd+d",
67         "command": "workbench.action.tasks.runTask",
68         "args": "disassemble"
69     }
70 ]
71 ```