Skip to content

Commit 5b280ab

Browse files
authored
Update __init__.py
#3188
1 parent 5330267 commit 5b280ab

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

pythonforandroid/recipes/pybind11/__init__.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,31 @@
33

44

55
class Pybind11Recipe(PythonRecipe):
6+
"""
7+
Recipe to build pybind11 for Android using cmake.
8+
"""
69

7-
version = '2.11.1'
8-
url = 'https://github.com/pybind/pybind11/archive/refs/tags/v{version}.zip'
9-
depends = ['setuptools']
10+
version = "2.11.1"
11+
url = "https://github.com/pybind/pybind11/archive/refs/tags/v{version}.zip"
12+
13+
# Make sure we depend on setuptools and cmake
14+
depends = ["setuptools", "cmake"]
15+
# Don’t let p4a try to run setup.py through targetpython
1016
call_hostpython_via_targetpython = False
17+
# Install into hostpython, because pybind11 is a header-only lib
1118
install_in_hostpython = True
1219

20+
def get_recipe_env(self, arch):
21+
env = super().get_recipe_env(arch)
22+
# Ensure cmake is found inside hostpython
23+
env["PATH"] = "/usr/bin:" + env.get("PATH", "")
24+
return env
25+
1326
def get_include_dir(self, arch):
14-
return join(self.get_build_dir(arch.arch), 'include')
27+
"""
28+
Return the directory where pybind11 headers will be located.
29+
"""
30+
return join(self.get_build_dir(arch.arch), "include")
1531

1632

1733
recipe = Pybind11Recipe()

0 commit comments

Comments
 (0)