From: zccrs Date: Tue, 16 Jan 2018 07:28:57 +0000 (+0800) Subject: feat: add the "version.pri" file X-Git-Tag: archive/raspbian/5.7.12-2+rpi1^2~130^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=07aab9fd6478c83c7bae1062f64b4bd20b21869c;p=dtkcore.git feat: add the "version.pri" file Change-Id: I78c4e6784e7a88991371d5c23bc2fd0049ef5a10 --- diff --git a/src/lib.pri b/src/lib.pri index 1827818..867e31d 100644 --- a/src/lib.pri +++ b/src/lib.pri @@ -1,32 +1,6 @@ TEMPLATE = lib -isEmpty(VERSION) { - VERSION = $$system(git describe --tags --abbrev=0) - isEmpty(VERSION):VERSION = $$DTK_VERSION - isEmpty(VERSION):error(VERSION is empty) - VERSION = $$replace(VERSION, [^0-9.],) -} - -ver_list = $$split(VERSION, .) - -isEmpty(VER_MAJ) { - VER_MAJ = $$first(ver_list) -} - -isEmpty(VER_MIN) { - VER_MIN = $$member(ver_list, 1, 1) - isEmpty(VER_MIN):VER_MIN = 0 -} - -isEmpty(VER_PAT) { - VER_PAT = $$member(ver_list, 2, 2) - isEmpty(VER_PAT):VER_PAT = 0 -} - -isEmpty(VER_BUI) { - VER_BUI = $$member(ver_list, 3, 3) - isEmpty(VER_BUI):VER_BUI = 0 -} +include($$PWD/version.pri) CONFIG += c++11 create_pc create_prl no_install_prl CONFIG += no_keywords @@ -53,3 +27,13 @@ win32* { DEFINES += STATIC_LIB CONFIG += staticlib } + +pri_dev.files += $$PWD/version.pri + +isEmpty(LIB_INSTALL_DIR) { + pri_dev.path = $$PREFIX/lib/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}/modules +} else { + pri_dev.path = $$LIB_INSTALL_DIR/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}/modules +} + +INSTALLS += pri_dev diff --git a/src/src.pro b/src/src.pro index c137b7b..f898c5b 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,5 +1,3 @@ -include($$PWD/lib.pri) - QT -= gui QT += dbus CONFIG += link_pkgconfig @@ -13,6 +11,7 @@ INCLUDEPATH += $$PWD $$PWD/base HEADERS += \ $$PWD/dtkcore_global.h +include($$PWD/lib.pri) include($$PWD/base/base.pri) include($$PWD/util/util.pri) include($$PWD/log/log.pri) diff --git a/src/version.pri b/src/version.pri new file mode 100644 index 0000000..f1f6d21 --- /dev/null +++ b/src/version.pri @@ -0,0 +1,32 @@ +isEmpty(VERSION) { + !isEqual(TARGET, dtkcore) { + PKG_CONFIG = $$pkgConfigExecutable() + !isEmpty(PKG_CONFIG): VERSION = $$system($$PKG_CONFIG --modversion dtkcore) + } + + isEmpty(VERSION): VERSION = $$system(git describe --tags --abbrev=0) + isEmpty(VERSION): VERSION = $$DTK_VERSION + isEmpty(VERSION): error(VERSION is empty) + VERSION = $$replace(VERSION, [^0-9.],) +} + +ver_list = $$split(VERSION, .) + +isEmpty(VER_MAJ) { + VER_MAJ = $$first(ver_list) +} + +isEmpty(VER_MIN) { + VER_MIN = $$member(ver_list, 1, 1) + isEmpty(VER_MIN):VER_MIN = 0 +} + +isEmpty(VER_PAT) { + VER_PAT = $$member(ver_list, 2, 2) + isEmpty(VER_PAT):VER_PAT = 0 +} + +isEmpty(VER_BUI) { + VER_BUI = $$member(ver_list, 3, 3) + isEmpty(VER_BUI):VER_BUI = 0 +}