2023-07-12 12:19:27 -07:00
# Yoga [](https://opensource.fb.com/support-ukraine) [](http://cocoapods.org/pods/Yoga) [](https://www.npmjs.com/package/yoga-layout) [](https://search.maven.org/artifact/com.facebook.yoga/yoga)
2023-01-16 07:56:11 -08:00
Yoga is an embeddable and performant flexbox layout engine with bindings for multiple languages.
2017-02-13 09:27:44 -08:00
2016-11-28 15:45:57 -08:00
2023-01-16 07:56:11 -08:00
## Building
2023-07-12 09:38:40 -07:00
Yoga's main implementation targets C++ 17 with accompanying build logic in CMake. A wrapper is provided to build the main library and run unit tests.
Add vcpkg installation instructions (#970)
Summary:
Yoga is available as a port in VCPKG , documenting the install process here will help users get started by providing a single set of commands to build yoga, ready to be included in their projects.
VCPKG is a C++ library manager that simplifies installation for yoga and other project dependencies, we also test whether our library ports build in various configurations (dynamic, static) on various platforms (OSX, Linux, Windows: x86, x64, UWP, ARM) to keep a wide coverage for users.
I'm a maintainer for vcpkg, and here is what the port script looks like. We try to keep the library maintained as close as possible to the original library.
Pull Request resolved: https://github.com/facebook/yoga/pull/970
Reviewed By: yungsters
Differential Revision: D40027569
Pulled By: yungsters
fbshipit-source-id: ca9a6aa481c7b46e96c5937fe3cc7b716e464e4d
2022-10-03 21:10:17 -07:00
```sh
2023-01-16 07:56:11 -08:00
./unit_tests < Debug | Release >
Add vcpkg installation instructions (#970)
Summary:
Yoga is available as a port in VCPKG , documenting the install process here will help users get started by providing a single set of commands to build yoga, ready to be included in their projects.
VCPKG is a C++ library manager that simplifies installation for yoga and other project dependencies, we also test whether our library ports build in various configurations (dynamic, static) on various platforms (OSX, Linux, Windows: x86, x64, UWP, ARM) to keep a wide coverage for users.
I'm a maintainer for vcpkg, and here is what the port script looks like. We try to keep the library maintained as close as possible to the original library.
Pull Request resolved: https://github.com/facebook/yoga/pull/970
Reviewed By: yungsters
Differential Revision: D40027569
Pulled By: yungsters
fbshipit-source-id: ca9a6aa481c7b46e96c5937fe3cc7b716e464e4d
2022-10-03 21:10:17 -07:00
```
2023-01-16 07:56:11 -08:00
While not required, this script will use [ninja ](https://ninja-build.org/ ) if it is installed for faster builds.
Yoga is additionally part of the [vcpkg ](https://github.com/Microsoft/vcpkg/ ) collection of ports maintained by Microsoft and community contributors. If the version is out of date, please [create an issue or pull request ](https://github.com/Microsoft/vcpkg ) on the vcpkg repository.
Add vcpkg installation instructions (#970)
Summary:
Yoga is available as a port in VCPKG , documenting the install process here will help users get started by providing a single set of commands to build yoga, ready to be included in their projects.
VCPKG is a C++ library manager that simplifies installation for yoga and other project dependencies, we also test whether our library ports build in various configurations (dynamic, static) on various platforms (OSX, Linux, Windows: x86, x64, UWP, ARM) to keep a wide coverage for users.
I'm a maintainer for vcpkg, and here is what the port script looks like. We try to keep the library maintained as close as possible to the original library.
Pull Request resolved: https://github.com/facebook/yoga/pull/970
Reviewed By: yungsters
Differential Revision: D40027569
Pulled By: yungsters
fbshipit-source-id: ca9a6aa481c7b46e96c5937fe3cc7b716e464e4d
2022-10-03 21:10:17 -07:00
2016-12-24 02:39:35 -08:00
2023-01-16 07:56:11 -08:00
## Adding Tests
2016-08-12 08:47:17 -07:00
2023-01-16 07:56:11 -08:00
Many of Yoga's tests are automatically generated, using HTML fixtures describing node structure. These are rendered in Chrome to generate an expected layout result for the tree. New fixtures can be added to `gentest/fixtures` .
2016-08-12 08:47:17 -07:00
```html
2016-12-07 16:18:13 +00:00
< div id = "my_test" style = "width: 100px; height: 100px; align-items: center;" >
2016-08-12 08:47:17 -07:00
< div style = "width: 50px; height: 50px;" > < / div >
< / div >
```
2016-07-25 09:41:00 -07:00
2023-01-16 07:56:11 -08:00
To generate new tests from added fixtures:
1. Run `bundle install` in the `gentest` directory to install dependencies of the test generator.
2. Run `ruby gentest.rb` in the `gentest` directory.
2021-05-21 11:40:17 -07:00
2023-01-16 07:56:11 -08:00
## Debugging
2021-05-21 11:40:17 -07:00
2023-01-16 07:56:11 -08:00
Yoga provides a VSCode "launch.json" configuration which allows debugging unit tests. Simply add your breakpoints, and run "Debug C++ Unit tests (lldb)" (or "Debug C++ Unit tests (vsdbg)" on Windows).