aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/PySide6/QtGui/CMakeLists.txt9
-rw-r--r--sources/pyside6/cmake/Macros/PySideModules.cmake29
-rw-r--r--sources/pyside6/cmake/PySideHelpers.cmake19
3 files changed, 50 insertions, 7 deletions
diff --git a/sources/pyside6/PySide6/QtGui/CMakeLists.txt b/sources/pyside6/PySide6/QtGui/CMakeLists.txt
index 99e0789d1..c868b6c88 100644
--- a/sources/pyside6/PySide6/QtGui/CMakeLists.txt
+++ b/sources/pyside6/PySide6/QtGui/CMakeLists.txt
@@ -313,6 +313,15 @@ set(QtGui_private_include_dirs
${Qt${QT_MAJOR_VERSION}Core_PRIVATE_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+ if (QT_FEATURE_opengles2)
+ # add openGL ES 2.0
+ find_package(GLESv2 REQUIRED)
+ else()
+ message(FATAL_ERROR "QtGui requires OpenGL ES 2.0 on Android")
+ endif()
+endif()
+
configure_file("${QtGui_SOURCE_DIR}/QtGui_global.post.h.in"
"${QtGui_BINARY_DIR}/QtGui_global.post.h" @ONLY)
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})
diff --git a/sources/pyside6/cmake/PySideHelpers.cmake b/sources/pyside6/cmake/PySideHelpers.cmake
index 23ceda6bd..01c438107 100644
--- a/sources/pyside6/cmake/PySideHelpers.cmake
+++ b/sources/pyside6/cmake/PySideHelpers.cmake
@@ -138,13 +138,18 @@ macro(check_os)
set(ENABLE_MAC "0")
set(ENABLE_WIN "0")
- if(CMAKE_HOST_APPLE)
- set(ENABLE_MAC "1")
- elseif(CMAKE_HOST_WIN32)
- set(ENABLE_WIN "1")
- set(ENABLE_UNIX "0")
- elseif(NOT CMAKE_HOST_UNIX)
- message(FATAL_ERROR "OS not supported")
+ # check if Android, if so, set ENABLE_UNIX=1
+ # this is needed to avoid including the wrapper specific to macOS when building for Android
+ # from a macOS host
+ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
+ if(CMAKE_HOST_APPLE)
+ set(ENABLE_MAC "1")
+ elseif(CMAKE_HOST_WIN32)
+ set(ENABLE_WIN "1")
+ set(ENABLE_UNIX "0")
+ elseif(NOT CMAKE_HOST_UNIX)
+ message(FATAL_ERROR "OS not supported")
+ endif()
endif()
endmacro()