diff options
author | Raphaël Cotty <raphael.cotty@gmail.com> | 2020-12-07 13:57:40 +0100 |
---|---|---|
committer | Raphaël Cotty <raphael.cotty@gmail.com> | 2020-12-08 12:55:15 +0000 |
commit | 9025c2e130d9a662354b6722c6b34fd964c5bc2b (patch) | |
tree | f74888fd052484f05b6ce9c715b95a43f3c8c59e | |
parent | bcc64746008826e00b3ceaba761449f01a500b2d (diff) |
Android: Fix debugging support
Add archSuffix to generate the library with the architecture name for
Qt > 5.14 (before the lib was renamed which prevented debugging).
Remove rpaths as they are not used on android and generate warnings.
Update target and defines to comply with android's Build System
Maintainers Guide.
Remove stripping step in Qt.android_support as androiddeployqt
actually does the stripping.
Change-Id: I46a273c1cded753223c7b759670477815b625267
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r-- | share/qbs/imports/qbs/PathTools/path-tools.js | 2 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/android_support.qbs | 34 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/core.qbs | 3 | ||||
-rw-r--r-- | share/qbs/modules/Android/sdk/sdk.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/CppModule.qbs | 1 | ||||
-rw-r--r-- | share/qbs/modules/cpp/android-gcc.qbs | 14 |
6 files changed, 14 insertions, 41 deletions
diff --git a/share/qbs/imports/qbs/PathTools/path-tools.js b/share/qbs/imports/qbs/PathTools/path-tools.js index b2cb63e39..a857a7139 100644 --- a/share/qbs/imports/qbs/PathTools/path-tools.js +++ b/share/qbs/imports/qbs/PathTools/path-tools.js @@ -107,6 +107,8 @@ function dynamicLibraryFilePath(product, variantSuffix, version, maxParts) { version = undefined; } + fileName += product.moduleProperty("cpp", "archSuffix"); + // Append the suffix (i.e. libqbs.1.0.0.dylib, libqbs.so, qbs.dll) fileName += product.moduleProperty("cpp", "dynamicLibrarySuffix"); diff --git a/share/qbs/module-providers/Qt/templates/android_support.qbs b/share/qbs/module-providers/Qt/templates/android_support.qbs index bdbb0e43b..3790037f3 100644 --- a/share/qbs/module-providers/Qt/templates/android_support.qbs +++ b/share/qbs/module-providers/Qt/templates/android_support.qbs @@ -68,7 +68,6 @@ Module { } Properties { condition: _enableSdkSupport - Android.sdk._archInName: _multiAbi Android.sdk._bundledInAssets: _multiAbi } Properties { @@ -79,6 +78,7 @@ Module { condition: _enableSdkSupport && Utilities.versionCompare(version, "6.0") >= 0 Android.sdk.minimumVersion: "23" } + cpp.archSuffix: _multiAbi ? "_" + Android.ndk.abi : "" Rule { condition: _enableSdkSupport @@ -324,10 +324,8 @@ Module { var input = inputs["android.nativelibrary"][i]; File.copy(input.filePath, FileInfo.joinPaths(product.Qt.android_support._deployQtOutDir, - "libs", - input.Android.ndk.abi, - input.baseName + "_" + input.Android.ndk.abi + - ".so")); + "libs", input.Android.ndk.abi, + input.fileName)); } } }; @@ -396,31 +394,7 @@ Module { File.remove(oldLibs[i]); } }; - - // androiddeployqt doesn't strip the deployed libraries anymore so it has to done here - var stripLibsCmd = new JavaScriptCommand(); - stripLibsCmd.description = "Stripping unneeded symbols from deployed qt libraries"; - stripLibsCmd.sourceCode = function() { - var stripArgs = ["--strip-all"]; - var architectures = []; - for (var i in inputs["android.nativelibrary"]) - architectures.push(inputs["android.nativelibrary"][i].Android.ndk.abi); - for (var i in architectures) { - var abiDirPath = FileInfo.joinPaths(product.Android.sdk.packageContentsDir, - "lib", architectures[i]); - var files = File.directoryEntries(abiDirPath, File.Files); - for (var i = 0; i < files.length; ++i) { - var filePath = FileInfo.joinPaths(abiDirPath, files[i]); - if (FileInfo.suffix(filePath) == "so") { - stripArgs.push(filePath); - } - } - } - var process = new Process(); - process.exec(product.cpp.stripPath, stripArgs, false); - } - - return [copyCmd, androidDeployQtCmd, moveCmd, stripLibsCmd]; + return [copyCmd, androidDeployQtCmd, moveCmd]; } } diff --git a/share/qbs/module-providers/Qt/templates/core.qbs b/share/qbs/module-providers/Qt/templates/core.qbs index 691e4b50c..8f0b0e2df 100644 --- a/share/qbs/module-providers/Qt/templates/core.qbs +++ b/share/qbs/module-providers/Qt/templates/core.qbs @@ -190,7 +190,8 @@ Module { return undefined; return frameworks; } - cpp.rpaths: qbs.targetOS.contains('linux') ? [libPath] : undefined + cpp.rpaths: qbs.targetOS.contains('linux') && !qbs.targetOS.contains("android") ? [libPath] : + undefined cpp.runtimeLibrary: qbs.toolchain.contains("msvc") ? config.contains("static_runtime") ? "static" : "dynamic" : original diff --git a/share/qbs/modules/Android/sdk/sdk.qbs b/share/qbs/modules/Android/sdk/sdk.qbs index b3f977689..f0e727caf 100644 --- a/share/qbs/modules/Android/sdk/sdk.qbs +++ b/share/qbs/modules/Android/sdk/sdk.qbs @@ -96,7 +96,6 @@ Module { property bool _enableRules: !product.multiplexConfigurationId && !!packageName - property bool _archInName: false property bool _bundledInAssets: true Group { diff --git a/share/qbs/modules/cpp/CppModule.qbs b/share/qbs/modules/cpp/CppModule.qbs index ce672b8e7..9f4e6be99 100644 --- a/share/qbs/modules/cpp/CppModule.qbs +++ b/share/qbs/modules/cpp/CppModule.qbs @@ -173,6 +173,7 @@ Module { property string executablePrefix: "" property string staticLibrarySuffix: "" property string dynamicLibrarySuffix: "" + property string archSuffix: "" property string loadableModuleSuffix: "" property string executableSuffix: "" property string debugInfoSuffix: "" diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs index bd58cbcca..5759606aa 100644 --- a/share/qbs/modules/cpp/android-gcc.qbs +++ b/share/qbs/modules/cpp/android-gcc.qbs @@ -41,7 +41,7 @@ LinuxGCC { condition: qbs.targetOS.contains("android") && qbs.toolchain && qbs.toolchain.contains("llvm") priority: 2 - rpaths: [rpathOrigin] + rpaths: [] cxxLanguageVersion: "c++14" property string cxxStlBaseDir: FileInfo.joinPaths(Android.ndk.ndkDir, "sources", "cxx-stl") @@ -128,12 +128,7 @@ LinuxGCC { return includes; } - defines: { - var list = ["ANDROID"]; - // Might be superseded by an -mandroid-version or similar Clang compiler flag in future - list.push("__ANDROID_API__=" + Android.ndk.platformVersion); - return list; - } + defines: ["ANDROID", "__ANDROID__"] binutilsPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt", Android.ndk.hostArch, "bin"); @@ -158,9 +153,10 @@ LinuxGCC { } } - targetVendor: "none" + target: [targetArch, targetSystem, targetAbi].join("-") targetSystem: "linux" - targetAbi: "android" + (["armeabi", "armeabi-v7a"].contains(Android.ndk.abi) ? "eabi" : "") + targetAbi: "android" + (["armeabi", "armeabi-v7a"].contains(Android.ndk.abi) ? "eabi" : "") + + Android.ndk.platformVersion endianness: "little" |