File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -744,6 +744,27 @@ def __init__(
744744 self ._meson_cross_file .write_text (cross_file_data , encoding = 'utf-8' )
745745 self ._meson_args ['setup' ].extend (('--cross-file' , os .fspath (self ._meson_cross_file )))
746746
747+ # Android requires cross compilation: synthesize the appropriate cross file.
748+ elif sysconfig .get_platform ().startswith ('android-' ):
749+ cross_file_data = textwrap .dedent (f'''
750+ # Binaries are controlled by environment variables, so they don't need
751+ # to be repeated here.
752+ [host_machine]
753+ system = 'android'
754+ subsystem = 'android'
755+ kernel = 'linux'
756+ cpu = { platform .machine ()!r}
757+ cpu_family = { platform .machine ()!r}
758+ endian = { sys .byteorder !r}
759+
760+ [properties]
761+ # cibuildwheel's cross virtual environment will make Meson believe it's
762+ # running on Android when it's actually running on Linux or macOS.
763+ needs_exe_wrapper = true
764+ ''' )
765+ self ._meson_cross_file .write_text (cross_file_data , encoding = 'utf-8' )
766+ self ._meson_args ['setup' ].extend (('--cross-file' , os .fspath (self ._meson_cross_file )))
767+
747768 # Support iOS targets. iOS does not have native build tools and always
748769 # requires cross compilation: synthesize the appropriate cross file.
749770 elif sysconfig .get_platform ().startswith ('ios-' ):
You can’t perform that action at this time.
0 commit comments