summaryrefslogtreecommitdiffstats
path: root/util/cmake/pro2cmake.py
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-02-17 14:58:16 +0100
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-02-25 15:47:50 +0100
commit119ffd478134d793fb4414a65549acd19e919e0b (patch)
tree91f81998f26ec91771230b7def53d2e0ce5e4011 /util/cmake/pro2cmake.py
parentbbf46e38b1d0f70b5c830b3ae2fccf66cf7edb8d (diff)
CMake: Port the reduce-relocations feature
As reduce-relocations implies bsymbolic_functions, we also add the -Bsymbolic-functions linker flag. Also, handle the .dynlist files that are passed to the linker by bsymbolic_functions.prf in the qmake build. Change-Id: I535c33fba888596d2f8975b16864bbe9f0a7caa4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'util/cmake/pro2cmake.py')
-rwxr-xr-xutil/cmake/pro2cmake.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/util/cmake/pro2cmake.py b/util/cmake/pro2cmake.py
index fca5d4fceb..43d608e219 100755
--- a/util/cmake/pro2cmake.py
+++ b/util/cmake/pro2cmake.py
@@ -2519,6 +2519,19 @@ def write_simd_part(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0):
cm_fh.write(extend_scope)
+def write_reduce_relocations_part(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0):
+ ind = spaces(indent)
+ dynlist_file = scope.get_files("QMAKE_DYNAMIC_LIST_FILE")
+ if dynlist_file:
+ dynlist_path = "${CMAKE_CURRENT_LIST_DIR}/" + dynlist_file[0]
+ cm_fh.write(f'{ind}if(QT_FEATURE_reduce_relocations AND UNIX AND GCC)\n')
+ ind = spaces(indent + 1)
+ cm_fh.write(f'{ind}target_link_options({target} PRIVATE\n')
+ cm_fh.write(f'{ind} "LINKER:--dynamic-list={dynlist_path}")\n')
+ ind = spaces(indent)
+ cm_fh.write(f'{ind}endif()\n')
+
+
def write_android_part(cm_fh: IO[str], target: str, scope: Scope, indent: int = 0):
keys = [
"ANDROID_BUNDLED_JAR_DEPENDENCIES",
@@ -2825,6 +2838,8 @@ def write_main_part(
write_simd_part(cm_fh, name, scope, indent)
+ write_reduce_relocations_part(cm_fh, name, scope, indent)
+
write_android_part(cm_fh, name, scopes[0], indent)
write_wayland_part(cm_fh, name, scopes[0], indent)