Fix Android build from multi-arch qmake changes

Add condition replacements for the android ABIs.

Add a replacement for QT_ARCH to ANDROID_ABI, since QT_ARCH is only used
with the android build for now.

Change-Id: I553d7910546de32236f723ec2e9a05a18da76130
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Leander Beernaert 2019-10-14 15:18:50 +02:00
parent 665f75f1f1
commit 6694689a26
6 changed files with 19 additions and 10 deletions

View File

@ -1317,7 +1317,7 @@ function(add_qt_module target)
add_library("${target}" STATIC)
endif()
if (android)
if (ANDROID)
qt_android_apply_arch_suffix("${target}")
endif()
qt_internal_add_target_aliases("${target}")
@ -2548,7 +2548,7 @@ function(add_cmake_library target)
set(arg_ARCHIVE_INSTALL_DIRECTORY "${arg_INSTALL_DIRECTORY}")
endif()
if (android)
if (ANDROID)
qt_android_apply_arch_suffix("${target}")
endif()

View File

@ -315,7 +315,7 @@ extend_target(Core CONDITION ANDROID
kernel/qsharedmemory_android.cpp
kernel/qsystemsemaphore_android.cpp
DEFINES
LIBS_SUFFIX='\\"_.so\\"'
LIBS_SUFFIX='\\"_${ANDROID_ABI}.so\\"'
)
extend_target(Core CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")

View File

@ -399,7 +399,7 @@ extend_target(Core CONDITION ANDROID
kernel/qsharedmemory_android.cpp
kernel/qsystemsemaphore_android.cpp
DEFINES
LIBS_SUFFIX='\\"_.so\\"'
LIBS_SUFFIX="\\\\"_${ANDROID_ABI}.so\\\\"" # special case
)
extend_target(Core CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")

View File

@ -471,14 +471,14 @@ if(NOT ANDROID)
)
endif()
extend_target(Gui CONDITION ANDROID AND arm64-v8a
extend_target(Gui CONDITION ANDROID AND TEST_architecture_arch STREQUAL arm64
SOURCES
image/qimage_neon.cpp
painting/qdrawhelper_neon.cpp painting/qdrawhelper_neon_p.h
painting/qimagescale_neon.cpp
)
extend_target(Gui CONDITION ANDROID AND (x86 OR x86_64)
extend_target(Gui CONDITION ANDROID AND (TEST_architecture_arch STREQUAL x86 OR TEST_architecture_arch STREQUAL x86_64)
SOURCES
image/qimage_ssse3.cpp
painting/qdrawhelper_sse2.cpp
@ -545,7 +545,7 @@ if(UNIX AND NOT ANDROID AND NOT APPLE_UIKIT AND NOT INTEGRITY AND NOT (TEST_arch
)
endif()
extend_target(Gui CONDITION ANDROID AND x86_64
extend_target(Gui CONDITION ANDROID AND TEST_architecture_arch STREQUAL x86_64
SOURCES
painting/qdrawhelper_sse4.cpp
painting/qimagescale_sse4.cpp

View File

@ -553,14 +553,14 @@ if(NOT ANDROID)
)
endif()
extend_target(Gui CONDITION ANDROID AND arm64-v8a
extend_target(Gui CONDITION ANDROID AND TEST_architecture_arch STREQUAL arm64
SOURCES
image/qimage_neon.cpp
painting/qdrawhelper_neon.cpp painting/qdrawhelper_neon_p.h
painting/qimagescale_neon.cpp
)
extend_target(Gui CONDITION ANDROID AND (x86 OR x86_64)
extend_target(Gui CONDITION ANDROID AND (TEST_architecture_arch STREQUAL x86 OR TEST_architecture_arch STREQUAL x86_64)
SOURCES
image/qimage_ssse3.cpp
painting/qdrawhelper_sse2.cpp
@ -636,7 +636,7 @@ if(UNIX AND NOT ANDROID AND NOT APPLE_UIKIT AND NOT INTEGRITY AND NOT (TEST_arch
)
endif()
extend_target(Gui CONDITION ANDROID AND x86_64
extend_target(Gui CONDITION ANDROID AND TEST_architecture_arch STREQUAL x86_64
SOURCES
painting/qdrawhelper_sse4.cpp
painting/qimagescale_sse4.cpp

View File

@ -1012,6 +1012,9 @@ class Scope(object):
project_relative_path = os.path.relpath(qmake_conf_dir_path, self.currentdir)
return ["${CMAKE_CURRENT_SOURCE_DIR}/" + project_relative_path]
if key == "QT_ARCH":
return ["${ANDROID_ABI}"]
if key == "_PRO_FILE_PWD_":
return ["${CMAKE_CURRENT_SOURCE_DIR}"]
if key == "PWD":
@ -1245,6 +1248,12 @@ def map_condition(condition: str) -> str:
condition = condition.replace("*-llvm", "CLANG")
condition = condition.replace("win32-*", "WIN32")
# new conditions added by the android multi arch qmake build
condition = re.sub(r'x86[^\_]', "TEST_architecture_arch STREQUAL x86", condition)
condition = condition.replace('x86_64', "TEST_architecture_arch STREQUAL x86_64")
condition = condition.replace('arm64-v8a', "TEST_architecture_arch STREQUAL arm64")
condition = condition.replace('armeabi-v7a', "TEST_architecture_arch STREQUAL arm")
pattern = r"CONFIG\((debug|release),debug\|release\)"
match_result = re.match(pattern, condition)
if match_result: