diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-05-14 10:16:55 +0200 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-06-03 17:08:41 +0200 |
| commit | 217dcaed583a8df0db5edd43bafa3cf3bbaeda90 (patch) | |
| tree | ffd38a048a7bfbd956df54c646f66657f680b5f7 /sources/pyside6/cmake/Macros | |
| parent | eeb286ee7c943ff8ce612719cdbddf7b871d2442 (diff) | |
Android Deployment: Build wheels with macOS host
- Additionally, also move setting Python_SOABI manually for Android to
where FindPython CMake module is called. This also aids in naming the
wheel correctly.
Pick-to: 6.7
Task-number: PYSIDE-2766
Change-Id: I73c089d31e2ee629f3ed676965fca27d53882110
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/cmake/Macros')
| -rw-r--r-- | sources/pyside6/cmake/Macros/PySideModules.cmake | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sources/pyside6/cmake/Macros/PySideModules.cmake b/sources/pyside6/cmake/Macros/PySideModules.cmake index 1e434f9f6..33b844f95 100644 --- a/sources/pyside6/cmake/Macros/PySideModules.cmake +++ b/sources/pyside6/cmake/Macros/PySideModules.cmake @@ -194,6 +194,35 @@ macro(create_pyside_module) --lean-headers --api-version=${SUPPORTED_QT_VERSION}) + # check if building for Android with a macOS host + # This is not needed for Linux because OpenGLES2 development binaries in + # linux can be installed by installing 'libgles2-mesa-dev' package which + # comes as a default requirement for building PySide6. As such for + # cross-compiling in linux, we use the clang compiler from the installed + # libclang itself. + if(CMAKE_ANDROID_ARCH_LLVM_TRIPLE AND CMAKE_HOST_APPLE) + message(STATUS "Building for Android with arch ${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}") + list(APPEND shiboken_command "--clang-option=--target=${CMAKE_ANDROID_ARCH_LLVM_TRIPLE}") + + # CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX does not contain the ANDROID_PLATFORM i.e. it ends with + # the form 'aarch64-linux-android-'. Remove the last '-' and add the corresponding clang + # based on ANDROID_PLATFORM making it 'aarch64-linux-android26-clang++' + + # Get the length of the string + string(LENGTH "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}" _length) + + # Subtract 1 from the length to get the characters till '-' + math(EXPR _last_index "${_length} - 1") + + # Get the substring from the start to the character before the last one + string(SUBSTRING "${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}" 0 "${_last_index}" + SHIBOKEN_ANDROID_COMPILER_PREFIX) + + # use the compiler from the Android NDK + list(APPEND shiboken_command + "--compiler-path=${SHIBOKEN_ANDROID_COMPILER_PREFIX}${CMAKE_ANDROID_API}-clang++") + endif() + if(CMAKE_HOST_APPLE) set(shiboken_framework_include_dir_list ${QT_FRAMEWORK_INCLUDE_DIR}) make_path(shiboken_framework_include_dirs ${shiboken_framework_include_dir_list}) |
