Skip to content

support android ndk #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

support android ndk #102

wants to merge 1 commit into from

Conversation

twfx1996
Copy link

@twfx1996 twfx1996 commented Apr 2, 2022

支持使用Android NDK工具链编译modelbox。编译所得到的so文件,可被安卓/鸿蒙平台上的APP调用。

支持使用Android NDK工具链编译modelbox。编译所得到的so文件,可被安卓/鸿蒙平台上的APP调用。
@@ -4,7 +4,7 @@ mark_as_advanced(MINDSPORE_INCLUDE)

# Look for the library (sorted from most current/relevant entry to least).
find_library(MINDSPORE_LIBRARY NAMES
mindspore
NAMES mindspore mindspore-lite
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mindspore和lite版本能混用吗?
是否应该要分开?

@@ -22,6 +22,14 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Do not build in source directory!")
endif()

if (DEFINED ENV{USER_ROOT} AND ANDROID_ABI)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个可以放到CMake/options里面。

#ifdef ANDROID
/* When they come from different so files, they may have different hash
* codes even if they have the same names. */
if (strcmp(typeid(T).name(), entrys_[key].type().name()) == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strncmp

inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if
<
!std::is_array<_Tp>::value && !std::is_array<_Up>::value,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vscode里面格式化代码

@@ -0,0 +1,139 @@
/* Android does not provide execinfo.h. We implement backtrace and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

版权头文件
vscode里面格式化代码。

Copy link
Contributor

@pymumu pymumu Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件感觉可以放到src/libmodelbox/base/arch/android中。避免andriod宏

object, then these functions return 0. */
if (!dladdr(addr, &info) || info.dli_fname == NULL)
{
pos += snprintf(symbols + pos, len - pos, "Unknown(+0) [%p]", addr) + 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snprintf_s

return NULL;
}

memset(symbols, 0, sizeof(void *));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

memset_s

#include <execinfo.h>
#else
#include "../../../libmodelbox/base/utils/backtrace.cc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里包含了cc文件,是不是不合理。

find_package(PythonInterp ${PYTHON_VER})
if(NOT ${PYTHONINTERP_FOUND})
if (DEFINED ENV{USER_ROOT} AND ANDROID_ABI AND PYTHON_VERSION_STRING)
if(EXISTS "$ENV{USER_ROOT}/${ANDROID_ABI}/usr/lib/libpython${PYTHON_VERSION_STRING}.so")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个可以写个cmake函数。

@pymumu pymumu force-pushed the main branch 13 times, most recently from 8931842 to 1d25ee9 Compare April 26, 2022 07:32
@@ -58,7 +58,16 @@ Status FfmpegVideoMuxer::Mux(const AVRational &time_base,
av_packet_rescale_ts(av_packet.get(), time_base, stream_->time_base);
av_packet->stream_index = stream_->index;
if (!is_header_wrote_) {
#ifndef ANDROID

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么 Android和其它有区别?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants