Browse Source

Linux: incremental build speedup (#10147)

* qgroundcontrol.pro: use gold linker if available (on linux)

Speeds up linking by ~4s on my machine.

* linux-fixup-rpaths.bash: use timestamp file to avoid unnecessary re-evaluation

Speeds up incremental builds, this step takes ~17s.
QGC4.4
Beat Küng 3 years ago committed by GitHub
parent
commit
fa55d98657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      QGCPostLinkCommon.pri
  2. 7
      deploy/linux-fixup-rpaths.bash
  3. 3
      qgroundcontrol.pro

8
QGCPostLinkCommon.pri

@ -130,9 +130,9 @@ LinuxBuild { @@ -130,9 +130,9 @@ LinuxBuild {
libicui18n.so \
libicuuc.so
}
# Copy only if non-existing to avoid file timestamp updates
for(QT_LIB, QT_LIB_LIST) {
QMAKE_POST_LINK += && $$QMAKE_COPY --dereference $$[QT_INSTALL_LIBS]/$$QT_LIB $$DESTDIR/Qt/libs/
QMAKE_POST_LINK += && $$QMAKE_COPY -n --dereference $$[QT_INSTALL_LIBS]/$$QT_LIB $$DESTDIR/Qt/libs/
}
# QT_INSTALL_PLUGINS
@ -152,11 +152,11 @@ LinuxBuild { @@ -152,11 +152,11 @@ LinuxBuild {
}
for(QT_PLUGIN, QT_PLUGIN_LIST) {
QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_PLUGINS]/$$QT_PLUGIN $$DESTDIR/Qt/plugins/
QMAKE_POST_LINK += && $$QMAKE_COPY -n --dereference --recursive $$[QT_INSTALL_PLUGINS]/$$QT_PLUGIN $$DESTDIR/Qt/plugins/
}
# QT_INSTALL_QML
QMAKE_POST_LINK += && $$QMAKE_COPY --dereference --recursive $$[QT_INSTALL_QML] $$DESTDIR/Qt/
QMAKE_POST_LINK += && $$QMAKE_COPY -n --dereference --recursive $$[QT_INSTALL_QML] $$DESTDIR/Qt/
# Airmap
contains (DEFINES, QGC_AIRMAP_ENABLED) {

7
deploy/linux-fixup-rpaths.bash

@ -47,6 +47,10 @@ find "${SEARCHDIR}" \ @@ -47,6 +47,10 @@ find "${SEARCHDIR}" \
-executable \
2>/dev/null |
while IFS='' read -r library; do
# readelf is expensive, so keep track of updates with a timestamp file
if [ ! -e "$library.stamp" -o "$library" -nt "$library.stamp" ]; then
# Get the library's current RPATH (RUNPATH)
# Example output of `readelf -d ./build/build-qgroundcontrol-Desktop_Qt_5_15_2_GCC_64bit-Debug/staging/QGroundControl`:
# 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/Qt/libs:/home/kbennett/storage/Qt/5.15.2/gcc_64/lib]
@ -83,4 +87,7 @@ while IFS='' read -r library; do @@ -83,4 +87,7 @@ while IFS='' read -r library; do
# patch the library's rpath
patchelf --set-rpath "${new_rpath}" "${library}"
touch "$library.stamp"
fi
done

3
qgroundcontrol.pro

@ -46,6 +46,9 @@ MacBuild { @@ -46,6 +46,9 @@ MacBuild {
LinuxBuild {
CONFIG += qesp_linux_udev
system("$$QMAKE_LINK -fuse-ld=gold -Wl,--version &>/dev/null") {
CONFIG += use_gold_linker
}
}
WindowsBuild {

Loading…
Cancel
Save