Patrick Schurig 5db002f53b build: add QMAKE_RPATHDIR for the sysroot cross-build
Building against a local sysroot rather than an installed
libnymea-sunspec-dev left the resulting binaries unable to find
libnymea-sunspec1 at run time: the sysroot is not in the dynamic
linker's cache, so -L alone is not enough and every test had to be
launched through LD_LIBRARY_PATH.

Only the NYMEA_SUNSPEC_PATH branch is touched. The package build resolves
the library through pkg-config and gets no rpath, as before.

Verified both ways: with NYMEA_SUNSPEC_PATH the binary carries a RUNPATH
to the sysroot, resolves libnymea-sunspec1 there and runs its 44 tests
with LD_LIBRARY_PATH unset; without it, no sunspec rpath is generated at
all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 11:01:19 +02:00

35 lines
1.6 KiB
Plaintext

QT *= network serialbus
# libnymea-sunspec n'est PAS vendoree : on lie contre le paquet
# libnymea-sunspec-dev. Deux resolutions possibles, meme convention que
# modbus.pri / NYMEA_MODBUS_PATH :
#
# 1) paquet installe systeme -> pkg-config nymea-sunspec (defaut)
# 2) sysroot local -> qmake6 NYMEA_SUNSPEC_PATH=/chemin/vers/sysroot
# ou <sysroot> contient usr/include/nymea-sunspec et usr/lib/<triplet>.
#
# Le paquet 1.15.2 installe les en-tetes des modeles sous
# <includedir>/home/jenkins/nymea-plugins-modbus/libnymea-sunspec/models/
# (le chemin de build Jenkins a fuite dans le .deb). Le plugin fait
# #include <models/sunspecmodelfactory.h>
# qui ne resout donc pas avec le seul -I<includedir>. On ajoute le prefixe
# manquant quand il existe, sans casser une installation correcte.
isEmpty(NYMEA_SUNSPEC_PATH) {
CONFIG += link_pkgconfig
PKGCONFIG += nymea-sunspec
SUNSPEC_INCLUDEDIR = $$[QT_INSTALL_PREFIX]/include/nymea-sunspec
} else {
SUNSPEC_INCLUDEDIR = $$NYMEA_SUNSPEC_PATH/usr/include/nymea-sunspec
SUNSPEC_LIBDIR = $$NYMEA_SUNSPEC_PATH/usr/lib/$$QMAKE_HOST.arch-linux-gnu
INCLUDEPATH += $$SUNSPEC_INCLUDEDIR
LIBS += -L$$SUNSPEC_LIBDIR -lnymea-sunspec1
# Build de developpement contre un sysroot : la bibliotheque n'est pas dans
# le cache de l'editeur de liens dynamique, il faut donc l'embarquer. Ce
# rpath n'existe pas dans le build paquet, qui passe par pkg-config.
QMAKE_RPATHDIR += $$SUNSPEC_LIBDIR
}
SUNSPEC_MODELS_WORKAROUND = $$SUNSPEC_INCLUDEDIR/home/jenkins/nymea-plugins-modbus/libnymea-sunspec
exists($$SUNSPEC_MODELS_WORKAROUND/models): INCLUDEPATH += $$SUNSPEC_MODELS_WORKAROUND