From eba74cc82456f534489949a0c1d6efe60c8f1b3e Mon Sep 17 00:00:00 2001 From: jared Date: Fri, 19 Jun 2020 01:41:34 +0800 Subject: [PATCH] update prf --- mkspecs/features/taoBuildPath.prf | 16 +++++++++++ mkspecs/features/taoBundle.prf | 12 ++++++++ mkspecs/features/taoVersion.prf | 38 +++++++++++++++++++++++++ src/TaoEffectPlugin/TaoEffectPlugin.pro | 2 +- src/TaoQuick/TaoQuick.pro | 35 ++++++++++++----------- src/TaoQuickApp/TaoQuickApp.pro | 2 +- src/TaoQuickPlugin/TaoQuickPlugin.pro | 2 +- src/TaoVersion.pri | 2 +- 8 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 mkspecs/features/taoBuildPath.prf create mode 100644 mkspecs/features/taoBundle.prf create mode 100644 mkspecs/features/taoVersion.prf diff --git a/mkspecs/features/taoBuildPath.prf b/mkspecs/features/taoBuildPath.prf new file mode 100644 index 0000000..2014864 --- /dev/null +++ b/mkspecs/features/taoBuildPath.prf @@ -0,0 +1,16 @@ +defineReplace(setBuildPath) { + buildPath = $$1 + CONFIG(debug,debug|release){ + MOC_DIR = $${buildPath}/debug/moc + RCC_DIR = $${buildPath}/debug/rcc + UI_DIR = $${buildPath}/debug/ui + OBJECTS_DIR = $${buildPath}/debug/obj + QMLCACHE_DIR = $${buildPath}/debug/qmlcache + } else { + MOC_DIR = $${buildPath}/release/moc + RCC_DIR = $${buildPath}/release/rcc + UI_DIR = $${buildPath}/release/ui + OBJECTS_DIR = $${buildPath}/release/obj + QMLCACHE_DIR = $${buildPath}/release/qmlcache + } +} diff --git a/mkspecs/features/taoBundle.prf b/mkspecs/features/taoBundle.prf new file mode 100644 index 0000000..3ea6c69 --- /dev/null +++ b/mkspecs/features/taoBundle.prf @@ -0,0 +1,12 @@ +defineReplace(getBundlePath) { + appName = $$1 + BundlePath = + macos{ + CONFIG(debug, debug|release){ + CONFIG -=app_bundle + } else { + BundlePath=$${appName}.app/Contents/MacOS/ + } + } + return ($$BundlePath) +} diff --git a/mkspecs/features/taoVersion.prf b/mkspecs/features/taoVersion.prf new file mode 100644 index 0000000..3917c7c --- /dev/null +++ b/mkspecs/features/taoVersion.prf @@ -0,0 +1,38 @@ +!exists(TaoVersionDefined) { + TaoVersionDefined=1 + + TAO_VERSION_TAG = 1.0 + + # current commit hash + REVISION=$$system("git rev-parse HEAD") + REVISION=$$str_member($${REVISION}, 0, $$num_add(10, -1)) + isEmpty(REVISION) { + REVISION = 0000000000 + } + + # last tag + Ver=$$system("git describe --abbrev=0 --tags") + isEmpty(Ver) { + Ver=0.0.0 + } + VerList =$$split(Ver, .) + MAJ = $$take_first(VerList) + MIN = $$take_first(VerList) + PAT = $$take_first(VerList) + equals(TEMPLATE, lib) { + CONFIG += skip_target_version_ext + VER_MAJ = $${MAJ} + VER_MIN = $${MIN} + VER_PAT = $${PAT} + VERSION = $${Ver} + } + DEFINES += TaoREVISION=$${REVISION} + DEFINES += TaoREVISIONSTR=\"\\\"$${REVISION}\\\"\" + DEFINES += TaoVer=\"\\\"$${Ver}\\\"\" + DEFINES += TaoMAJ=$${MAJ} + DEFINES += TaoMIN=$${MIN} + DEFINES += TaoPAT=$${PAT} + DEFINES += TaoDATETIME=\"\\\"$${_DATE_}\\\"\" + DEFINES += TaoCompilerVendor=\"\\\"$${QT_VERSION} $${QMAKE_PLATFORM} $${QMAKE_COMPILER} $${QMAKE_TARGET.arch}\\\"\" + # message($${DEFINES}) +} diff --git a/src/TaoEffectPlugin/TaoEffectPlugin.pro b/src/TaoEffectPlugin/TaoEffectPlugin.pro index b4c30b9..ab4ae80 100644 --- a/src/TaoEffectPlugin/TaoEffectPlugin.pro +++ b/src/TaoEffectPlugin/TaoEffectPlugin.pro @@ -8,7 +8,7 @@ msvc { QMAKE_CFLAGS += -source-charset:utf-8 QMAKE_CXXFLAGS += -source-charset:utf-8 } - +load(taoVersion) include(../TaoPlugin.pri) include(../TaoBundle.pri) diff --git a/src/TaoQuick/TaoQuick.pro b/src/TaoQuick/TaoQuick.pro index 393be9a..8f3ac93 100644 --- a/src/TaoQuick/TaoQuick.pro +++ b/src/TaoQuick/TaoQuick.pro @@ -14,9 +14,11 @@ versionAtLeast(QT_VERSION, 5.15.0) { } uri = $$TARGET - -include(../TaoVersion.pri) -include(../TaoBundle.pri) +load(taoVersion) +load(taoBundle) +load(taoBuildPath) +BundlePath = getBundlePath(TaoQuickApp) +#include(../TaoBundle.pri) include(TaoQuick.pri) include(TaoQuick/TaoQuickDesigner.pri) @@ -25,19 +27,20 @@ CONFIG(debug, debug|release){ } else { DESTDIR = $${TaoQuick_RUN_TREE}/release/$${BundlePath}$${uri} } -CONFIG(debug,debug|release){ - MOC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/moc - RCC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/rcc - UI_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/ui - OBJECTS_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/obj - QMLCACHE_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/qmlcache -} else { - MOC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/moc - RCC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/rcc - UI_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/ui - OBJECTS_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/obj - QMLCACHE_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/qmlcache -} +setBuildPath($${TaoQuick_BUILD_TREE}/$${TARGET}) +#CONFIG(debug,debug|release){ +# MOC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/moc +# RCC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/rcc +# UI_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/ui +# OBJECTS_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/obj +# QMLCACHE_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/debug/qmlcache +#} else { +# MOC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/moc +# RCC_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/rcc +# UI_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/ui +# OBJECTS_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/obj +# QMLCACHE_DIR = $${TaoQuick_BUILD_TREE}/$${TARGET}/release/qmlcache +#} #copy_qmldir !android { diff --git a/src/TaoQuickApp/TaoQuickApp.pro b/src/TaoQuickApp/TaoQuickApp.pro index adcd1f9..449f11f 100644 --- a/src/TaoQuickApp/TaoQuickApp.pro +++ b/src/TaoQuickApp/TaoQuickApp.pro @@ -27,7 +27,7 @@ msvc { -include(../TaoVersion.pri) +load(taoVersion) #include(../TaoBundle.pri) diff --git a/src/TaoQuickPlugin/TaoQuickPlugin.pro b/src/TaoQuickPlugin/TaoQuickPlugin.pro index 6df85f7..ec56f36 100644 --- a/src/TaoQuickPlugin/TaoQuickPlugin.pro +++ b/src/TaoQuickPlugin/TaoQuickPlugin.pro @@ -8,7 +8,7 @@ msvc { QMAKE_CFLAGS += -source-charset:utf-8 QMAKE_CXXFLAGS += -source-charset:utf-8 } - +load(taoVersion) include(../TaoPlugin.pri) include(../TaoBundle.pri) diff --git a/src/TaoVersion.pri b/src/TaoVersion.pri index 3e1eee6..7478b59 100644 --- a/src/TaoVersion.pri +++ b/src/TaoVersion.pri @@ -1,4 +1,4 @@ -isEmpty(TaoVersionInclude) { +!exists(TaoVersionInclude) { TaoVersionInclude=1 TAO_VERSION_TAG = 1.0