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: build_script:
- cmd: |- - cmd: |-
qmake PROTOBUF=%VCPKGDIR% ZLIB=%VCPKGDIR% ABSEIL=%VCPKGDIR% pbfplugin.pro qmake USE_PKGCONFIG=true pbfplugin.pro
nmake release nmake release
artifacts: artifacts:

View File

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