From: Taehyub Kim Date: Fri, 5 Feb 2021 06:53:46 +0000 (+0900) Subject: Implements the skeletone codes for rive-cpp submodule build X-Git-Tag: submit/tizen/20210406.060732~16^2~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80e1aa645e7671be9440adc1eb9a5c210392d105;p=platform%2Fcore%2Fuifw%2Frive-tizen.git Implements the skeletone codes for rive-cpp submodule build This patch implemented the skeletone codes of rive-cpp submodule build and the simple example to check the rive-tizen API call. --- diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..9bcccd8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "submodule"] + path = submodule + url = https://github.com/taehyub/rive-cpp.git diff --git a/example/meson.build b/example/meson.build new file mode 100644 index 0000000..109e81a --- /dev/null +++ b/example/meson.build @@ -0,0 +1,8 @@ +source_file = [ + 'rive_viewer.cpp' +] + +executable('rive_viewer', + source_file, + dependencies : [rive_tizen_lib_dep], + install : true) diff --git a/example/rive_viewer.cpp b/example/rive_viewer.cpp new file mode 100644 index 0000000..c1b5d82 --- /dev/null +++ b/example/rive_viewer.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char **argv) +{ + rive_tizen_print(); + return 0; +} diff --git a/inc/rive_tizen.hpp b/inc/rive_tizen.hpp new file mode 100644 index 0000000..be92d0e --- /dev/null +++ b/inc/rive_tizen.hpp @@ -0,0 +1,5 @@ +#include + +#define RIVE_EXPORT __attribute__ ((visibility ("default"))) + +RIVE_EXPORT void rive_tizen_print(); diff --git a/meson.build b/meson.build index 0428ef3..62ff629 100644 --- a/meson.build +++ b/meson.build @@ -1,36 +1,57 @@ -project('rive-tizen', +project('rive_tizen', 'cpp', version : '0.1.0', license : 'MIT') -subdir('lib') +#thorvg_dep = dependency('thorvg', required : true) -thorvg_dep = dependency('thorvg', required : true) +headers = [include_directories('inc')] -rive-tizen_lib = library( - 'rive-tizen', - include_directories : [headers, math_headers, thorvg_headers], +rive_tizen_src = [ + 'src/rive_tizen.cpp', +] + +install_headers([ + 'inc/rive_tizen.hpp', + ]) + +rive_tizen_dep = declare_dependency( + include_directories : include_directories('.'), + sources : rive_tizen_src +) + +rive_src = [ + 'submodule/src/math/aabb.cpp', + 'submodule/src/math/vec2d.cpp', +] + +rive_dep = declare_dependency( + include_directories : include_directories(['submodule/include']), + sources : rive_src +) + +rive_tizen_lib = library( + 'rive_tizen', + include_directories : [headers], version : meson.project_version(), - dependencies : [math_dep, rive-tizen_dep, rive-tizen_render_dep, thorvg_dep], + dependencies : [rive_tizen_dep, rive_dep], install : true, - gnu_symbol_visibility : 'hidden', + gnu_symbol_visibility : 'hidden', ) -rive-tizen_lib_dep = declare_dependency( - include_directories : [headers, math_headers, thorvg_headers], - link_with : rive-tizen_lib +rive_tizen_lib_dep = declare_dependency( + include_directories : [headers], + link_with : rive_tizen_lib ) pkg_mod = import('pkgconfig') pkg_mod.generate( - libraries : rive-tizen_lib, + libraries : rive_tizen_lib, version : meson.project_version(), - name : 'librive-tizen', - filebase : 'rive-tizen', + name : 'librive_tizen', + filebase : 'rive_tizen', description : 'A Rive Animation Tizen Runtime Engine' ) subdir('example') -subdir('assets') - diff --git a/script/tizen_build.diff b/script/tizen_build.diff new file mode 100644 index 0000000..baa71bb --- /dev/null +++ b/script/tizen_build.diff @@ -0,0 +1,38 @@ +diff --git include/math/aabb.hpp include/math/aabb.hpp +index 6e5114e..1824756 100644 +--- include/math/aabb.hpp ++++ include/math/aabb.hpp +@@ -15,10 +15,6 @@ namespace rive + float buffer[4]; + struct + { +- Vec2D min, max; +- }; +- struct +- { + float minX, minY, maxX, maxY; + }; + }; +@@ -48,4 +44,4 @@ namespace rive + float perimeter() const; + }; + } // namespace rive +-#endif +\ No newline at end of file ++#endif +diff --git src/math/aabb.cpp src/math/aabb.cpp +index 94de5d0..a7ea1db 100644 +--- src/math/aabb.cpp ++++ src/math/aabb.cpp +@@ -77,9 +77,9 @@ bool AABB::areIdentical(const AABB& a, const AABB& b) + return a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3]; + } + +-float AABB::width() const { return max[0] - min[0]; } ++float AABB::width() const { return buffer[2] - buffer[0]; } + +-float AABB::height() const { return max[1] - min[1]; } ++float AABB::height() const { return buffer[3] - buffer[1]; } + + float AABB::perimeter() const + { diff --git a/src/rive_tizen.cpp b/src/rive_tizen.cpp new file mode 100644 index 0000000..1c4f3ed --- /dev/null +++ b/src/rive_tizen.cpp @@ -0,0 +1,10 @@ +#include "rive_tizen.hpp" +#include "math/aabb.hpp" + +void rive_tizen_print() +{ + // This line to check calling Rive APIs + rive::AABB aabb(0, 0, 100, 100); + // This line to check rive_tizen API calls + std::cout << "hello rive-tizen" << std::endl; +} diff --git a/submodule b/submodule new file mode 160000 index 0000000..feac2ae --- /dev/null +++ b/submodule @@ -0,0 +1 @@ +Subproject commit feac2aee679f1cbf69393a62d5e774337e980d75