Added build option to link using PKGCONFIG

This commit is contained in:
Martin Tůma 2025-01-05 12:18:55 +01:00
parent cc2b03423b
commit 4653525da8
2 changed files with 25 additions and 15 deletions

View File

@ -22,7 +22,7 @@ install:
build_script:
- cmd: |-
qmake PROTOBUF=%VCPKGDIR% ZLIB=%VCPKGDIR% ABSEIL=%VCPKGDIR% pbfplugin.pro
qmake USE_PKGCONFIG=true pbfplugin.pro
nmake release
artifacts:

View File

@ -39,20 +39,26 @@ RESOURCES += pbfplugin.qrc
DEFINES += QT_NO_DEPRECATED_WARNINGS
equals(USE_PKGCONFIG, "true") {
CONFIG += link_pkgconfig
PKGCONFIG += protobuf-lite zlib
}
unix:!macx:!android {
LIBS += -lprotobuf-lite \
-lz
!equals(USE_PKGCONFIG, "true") {
LIBS += -lprotobuf-lite \
-lz
}
target.path += $$[QT_INSTALL_PLUGINS]/imageformats
INSTALLS += target
}
win32 {
INCLUDEPATH += $$PROTOBUF/include \
$$ZLIB/include
LIBS += $$PROTOBUF/lib/libprotobuf-lite.lib \
$$ZLIB/lib/zlibstatic.lib
!isEmpty(ABSEIL) {
LIBS += $$ABSEIL/lib/libabsl.lib
!equals(USE_PKGCONFIG, "true") {
INCLUDEPATH += $$PROTOBUF/include \
$$ZLIB/include
LIBS += $$PROTOBUF/lib/libprotobuf-lite.lib \
$$ZLIB/lib/zlibstatic.lib
}
QMAKE_TARGET_PRODUCT = QtPBFImagePlugin
@ -60,14 +66,18 @@ win32 {
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2018-2025 Martin Tuma
}
macx {
INCLUDEPATH += $$PROTOBUF/include
LIBS += $$PROTOBUF/lib/libprotobuf-lite.a \
-lz
!equals(USE_PKGCONFIG, "true") {
INCLUDEPATH += $$PROTOBUF/include
LIBS += $$PROTOBUF/lib/libprotobuf-lite.a \
-lz
}
}
android {
INCLUDEPATH += $$PROTOBUF/include
LIBS += $$PROTOBUF/$$ANDROID_TARGET_ARCH/libprotobuf-lite.a \
-lz
!equals(USE_PKGCONFIG, "true") {
INCLUDEPATH += $$PROTOBUF/include
LIBS += $$PROTOBUF/$$ANDROID_TARGET_ARCH/libprotobuf-lite.a \
-lz
}
top_builddir=$$shadowed($$PWD)
DESTDIR = $$top_builddir/plugins