Skip to content

Fix issue #2630 #2631

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

Merged
merged 3 commits into from
Jul 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions pythonforandroid/recipes/tflite-runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from pythonforandroid.recipe import PythonRecipe, current_directory,\
from pythonforandroid.recipe import PythonRecipe, current_directory, \
shprint, info_main, warning
from pythonforandroid.logger import error
from os.path import join
import sh


class TFLiteRuntimeRecipe(PythonRecipe):

###############################################################
#
# tflite-runtime README:
Expand All @@ -31,6 +30,15 @@ class TFLiteRuntimeRecipe(PythonRecipe):
site_packages_name = 'tflite-runtime'
call_hostpython_via_targetpython = False

def should_build(self, arch):
name = self.folder_name.replace('-', '_')

if self.ctx.has_package(name, arch):
info_main('Python package already exists in site-packages')
return False
info_main('{} apparently isn\'t already in site-packages'.format(name))
return True

def build_arch(self, arch):
if arch.arch == 'x86_64':
warning("******** tflite-runtime x86_64 will not be built *******")
Expand All @@ -54,9 +62,9 @@ def build_arch(self, arch):
pybind11_include_dir = pybind11_recipe.get_include_dir(arch)
numpy_include_dir = join(self.ctx.get_site_packages_dir(arch),
'numpy', 'core', 'include')
includes = ' -I' + python_include_dir +\
' -I' + numpy_include_dir +\
' -I' + pybind11_include_dir
includes = ' -I' + python_include_dir + \
' -I' + numpy_include_dir + \
' -I' + pybind11_include_dir

# Scripts
build_script = join(script_dir, 'build_pip_package_with_cmake.sh')
Expand Down