HippyLayout is a lightweight flex layout engine implemented in C++ and used as layout component for Hippy framework in android and ios platform.
Based on W3C Flex Layout algorithms, it has some referrence from chromium and yoga, such as flex line in chromium and test cases & benchmark in yoga.
please run ./android/build_flexbox_so.sh to build libflexbox.so it rely on following conditions:
-
use bash shell as build platform. if at win32 enviroment, you can use git for windows
-
make sure android sdk & ndk installed, It's would be better, if ndk version >= r17b. the result so size will be smaller because of this.
-
install cmake tools for android sdk (you can install it in android studio)
-
modify build_flexbox_so.sh set "ANDROID_SDK_CMAKE_BIN, ANDROID_NDK, ANDROID_SO_STRIP" variable depend on your installed path
-
in bash enviroment, run build_flexbox_so.sh in directory
out/android/
, libflexboxso.sh has symbols libflexbox_strip.so is stripped that can be used for product.
java interfaces is at java directory.
import these files and libflexbox.so in your project,
then use com.tencent.smtt.flexbox.FlexNode
(FlexNode.java) to layout.
import files in engine directory to your project directly, Hippy.h has all methods that needed to layout
test in linux/mac enviroment which have gcc and cmake tools.
run ./gtest/build_run_gtest_for_hippy_layout.sh
before commit code. make sure all test cases passed
test in linux/mac enviroment which have gcc and cmake ,unzip tools.
hippy-layout benchmark refers yoga's beanchmark test. so we can compare layout performances between them.
run ./benchmark/hippy/build_run_hippy_layout_benchmark.sh
to do hippy layout performace test, it will
clean and recompile code every time, then execute hippy benchmark test.
run ./benchmark/yoga/build_run_yoga_layout_benchmark.sh
to do yoga layout performace test, it will do
the following steps for test:
- clean compile enviroment(such as delete out/yogabenchmark dir etc.)
- download the lastest yoga code, if failed, should set a https proxy.
- compile and run yoga benchmark test
apart from these, we add a new benchmark test case which named "Huge nested layout, no style width & height
in benchmark/hippy/HPBenchmark.cpp
and /benchmark/yoga/YGBenchmark.cpp
. this test case will cost more time
than the previous test case. it's the only different place from yoga original benchmark.