mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 19:35:33 +08:00
Fixed the vcsubdirs workaround to support the .file modifier in nested subdirs.
This commit is contained in:
@@ -8,16 +8,25 @@ equals(TEMPLATE, "vcsubdirs") {
|
|||||||
# This function returns the absolute path of the .pro file referenced by subdir.
|
# This function returns the absolute path of the .pro file referenced by subdir.
|
||||||
# \param subdir Any value which is valid to appear in the SUBDIRS variable.
|
# \param subdir Any value which is valid to appear in the SUBDIRS variable.
|
||||||
# \param basedir The absolute directory of the .pro file containing the SUBDIRS variable.
|
# \param basedir The absolute directory of the .pro file containing the SUBDIRS variable.
|
||||||
# \note For now, it only supports .file and .subdir modifiers in the top-level project.
|
# \param profile The .pro file containing the SUBDIRS variable (empty if it is this very project).
|
||||||
defineReplace(subdirToProjectFile) {
|
defineReplace(subdirToProjectFile) {
|
||||||
SUBDIR = $$1
|
SUBDIR = $$1
|
||||||
BASEDIR = $$2
|
BASEDIR = $$2
|
||||||
|
PROFILE = $$3
|
||||||
BASENAME = $$basename(SUBDIR)
|
BASENAME = $$basename(SUBDIR)
|
||||||
SUFFIX = $$section(SUBDIR, ".", -1, -1)
|
SUFFIX = $$section(SUBDIR, ".", -1, -1)
|
||||||
!isEmpty($${SUBDIR}.file): return($$BASEDIR/$$eval($${SUBDIR}.file))
|
isEmpty(PROFILE) {
|
||||||
!isEmpty($${SUBDIR}.subdir): return($$BASEDIR/$$eval($${SUBDIR}.subdir)/$${BASENAME}.pro)
|
file = $$eval($${SUBDIR}.file)
|
||||||
equals(SUFFIX, "pro"): return($$BASEDIR/$$SUBDIR)
|
subdir = $$eval($${SUBDIR}.subdir)
|
||||||
else: return($$BASEDIR/$$SUBDIR/$${BASENAME}.pro)
|
}
|
||||||
|
else {
|
||||||
|
file = $$fromfile($$PROFILE, $${SUBDIR}.file)
|
||||||
|
subdir = $$fromfile($$PROFILE, $${SUBDIR}.subdir)
|
||||||
|
}
|
||||||
|
!isEmpty(file): return($$BASEDIR/$$file)
|
||||||
|
!isEmpty(subdir): return($$BASEDIR/$$subdir/$${BASENAME}.pro)
|
||||||
|
equals(SUFFIX, "pro"): return($$BASEDIR/$$SUBDIR)
|
||||||
|
else: return($$BASEDIR/$$SUBDIR/$${BASENAME}.pro)
|
||||||
}
|
}
|
||||||
|
|
||||||
# flattenSubdirs(subdirs, basedir)
|
# flattenSubdirs(subdirs, basedir)
|
||||||
@@ -26,11 +35,13 @@ equals(TEMPLATE, "vcsubdirs") {
|
|||||||
# project, recursively.
|
# project, recursively.
|
||||||
# \param subdirs The value of a SUBDIRS variable.
|
# \param subdirs The value of a SUBDIRS variable.
|
||||||
# \param basedir The absolute directory of the .pro file containing the SUBDIRS variable.
|
# \param basedir The absolute directory of the .pro file containing the SUBDIRS variable.
|
||||||
|
# \param profile The .pro file containing the SUBDIRS variable (empty if it is this very project).
|
||||||
defineReplace(flattenSubdirs) {
|
defineReplace(flattenSubdirs) {
|
||||||
SUBDIRS = $$1
|
SUBDIRS = $$1
|
||||||
BASEDIR = $$2
|
BASEDIR = $$2
|
||||||
|
PROFILE = $$3
|
||||||
for(subdir, SUBDIRS) {
|
for(subdir, SUBDIRS) {
|
||||||
SUBDIR_PROJECT = $$subdirToProjectFile($$subdir, $$BASEDIR)
|
SUBDIR_PROJECT = $$subdirToProjectFile($$subdir, $$BASEDIR, $$PROFILE)
|
||||||
INNER_REQUIRES = $$fromfile($$SUBDIR_PROJECT, REQUIRES)
|
INNER_REQUIRES = $$fromfile($$SUBDIR_PROJECT, REQUIRES)
|
||||||
REQUIRES_OK = 1
|
REQUIRES_OK = 1
|
||||||
for(req, INNER_REQUIRES): !if($${req}): REQUIRES_OK = 0
|
for(req, INNER_REQUIRES): !if($${req}): REQUIRES_OK = 0
|
||||||
@@ -38,7 +49,7 @@ equals(TEMPLATE, "vcsubdirs") {
|
|||||||
INNER_TEMPLATE = $$fromfile($$SUBDIR_PROJECT, TEMPLATE)
|
INNER_TEMPLATE = $$fromfile($$SUBDIR_PROJECT, TEMPLATE)
|
||||||
equals(INNER_TEMPLATE, "vcsubdirs") {
|
equals(INNER_TEMPLATE, "vcsubdirs") {
|
||||||
INNER_SUBDIRS = $$fromfile($$SUBDIR_PROJECT, SUBDIRS)
|
INNER_SUBDIRS = $$fromfile($$SUBDIR_PROJECT, SUBDIRS)
|
||||||
SUBDIRS_FLAT += $$flattenSubdirs($$INNER_SUBDIRS, $$dirname(SUBDIR_PROJECT))
|
SUBDIRS_FLAT += $$flattenSubdirs($$INNER_SUBDIRS, $$dirname(SUBDIR_PROJECT), $$SUBDIR_PROJECT)
|
||||||
}
|
}
|
||||||
else: SUBDIRS_FLAT += $$SUBDIR_PROJECT
|
else: SUBDIRS_FLAT += $$SUBDIR_PROJECT
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user