|
1 # fixExclusiveOutputDirs(1config, 2config) |
|
2 # Change all output paths that references 2config to have the string 1config in them |
|
3 defineTest(fixExclusiveOutputDirs) { |
|
4 unset(firstBuild) |
|
5 unset(secondBuild) |
|
6 unset(appendFirstBuild) |
|
7 firstBuild = $$1 |
|
8 secondBuild = $$2 |
|
9 count(ARGS, 2, greaterThan):isEqual($$list($$lower($$3)), false):appendFirstBuild = false |
|
10 else:appendFirstBuild = true |
|
11 |
|
12 isEmpty(QMAKE_DIR_REPLACE):QMAKE_DIR_REPLACE += OBJECTS_DIR MOC_DIR RCC_DIR |
|
13 lessThan(firstBuild, $$secondBuild):eval($${firstBuild}_and_$${secondBuild}_target:QMAKE_DIR_REPLACE += DESTDIR) |
|
14 else:eval($${secondBuild}_and_$${firstBuild}_target:QMAKE_DIR_REPLACE += DESTDIR) |
|
15 for(fix, QMAKE_DIR_REPLACE) { |
|
16 isEmpty($$fix)|isEqual($$fix, .) { |
|
17 eval($$fix = $${firstBuild}) |
|
18 } else:contains($$list($$first($$fix)), .*$${secondBuild}.*) { |
|
19 eval($$fix ~= s/$${secondBuild}/$${firstBuild}/gi) |
|
20 } else:isEqual(appendFirstBuild, true):!contains($$list($$first($$fix)), .*$${firstBuild}.*) { |
|
21 contains($$list($${first($$fix)}), .*/$):eval($$fix = $${first($$fix)}$${firstBuild}) |
|
22 else:eval($$fix = $${first($$fix)}-$${firstBuild}) |
|
23 } |
|
24 export($$fix) |
|
25 } |
|
26 return(true) |
|
27 } |
|
28 |
|
29 # addExclusiveBuilds(1config, 1name, 2config, 2name) |
|
30 # Adds two BUILDS which are exclusive to each other. |
|
31 defineTest(addExclusiveBuilds) { |
|
32 unset(firstBuild) |
|
33 unset(firstBuildName) |
|
34 unset(secondBuild) |
|
35 unset(secondBuildName) |
|
36 |
|
37 firstBuild = $$1 |
|
38 firstBuildName = $$2 |
|
39 secondBuild = $$3 |
|
40 secondBuildName = $$4 |
|
41 |
|
42 contains(TEMPLATE, subdirs) { |
|
43 eval(sub_$${firstBuildName}.target = $$firstBuild) |
|
44 export(sub_$${firstBuildName}.target) |
|
45 eval(sub_$${firstBuildName}.CONFIG = recursive) |
|
46 export(sub_$${firstBuildName}.CONFIG) |
|
47 eval(sub_$${secondBuildName}.target = $$secondBuild) |
|
48 export(sub_$${secondBuildName}.target) |
|
49 eval(sub_$${secondBuildName}.CONFIG = recursive) |
|
50 export(sub_$${secondBuildName}.CONFIG) |
|
51 QMAKE_EXTRA_TARGETS += sub_$${firstBuildName} sub_$${secondBuildName} |
|
52 export(QMAKE_EXTRA_TARGETS) |
|
53 } else:!build_pass { |
|
54 first_BUILDS = |
|
55 second_BUILDS = |
|
56 suffix_BUILDS = Build |
|
57 |
|
58 isEmpty(BUILDS): BUILDPERMUTATIONS = $$suffix_BUILDS |
|
59 else: BUILDPERMUTATIONS = $$BUILDS |
|
60 |
|
61 for(permutation, BUILDPERMUTATIONS) { |
|
62 permutation ~= s/$${suffix_BUILDS}$// |
|
63 isEmpty(permutation): permutationName = |
|
64 else: permutationName = -$$permutation |
|
65 # Makefile target rule |
|
66 eval($${firstBuildName}$${permutation}.target = $${firstBuild}$$lower($${permutationName})) |
|
67 export($${firstBuildName}$${permutation}.target) |
|
68 # IDE name |
|
69 eval($${firstBuildName}$${permutation}.name = $${firstBuildName}$${permutationName}) |
|
70 export($${firstBuildName}$${permutation}.name) |
|
71 # prl import CONFIG option |
|
72 eval($${firstBuildName}$${permutation}.PRL_CONFIG = $${firstBuild}$${permutation}) |
|
73 export($${firstBuildName}$${permutation}.PRL_CONFIG) |
|
74 # Individual CONFIG option |
|
75 eval($${firstBuildName}$${permutation}.CONFIG = $${firstBuild} $${firstBuildName}Build $$eval($${permutation}.CONFIG)) |
|
76 export($${firstBuildName}$${permutation}.CONFIG) |
|
77 |
|
78 eval($${secondBuildName}$${permutation}.target = $${secondBuild}$$lower($${permutationName})) |
|
79 export($${secondBuildName}$${permutation}.target) |
|
80 eval($${secondBuildName}$${permutation}.name = $${secondBuildName}$${permutationName}) |
|
81 export($${secondBuildName}$${permutation}.name) |
|
82 eval($${secondBuildName}$${permutation}.PRL_CONFIG = $${secondBuild}$${permutation}) |
|
83 export($${secondBuildName}$${permutation}.PRL_CONFIG) |
|
84 eval($${secondBuildName}$${permutation}.CONFIG = $${secondBuild} $${secondBuildName}Build $$eval($${permutation}.CONFIG)) |
|
85 export($${secondBuildName}$${permutation}.CONFIG) |
|
86 |
|
87 first_BUILDS += $${firstBuildName}$${permutation} |
|
88 second_BUILDS += $${secondBuildName}$${permutation} |
|
89 } |
|
90 |
|
91 # A mutual exclusive block. |
|
92 CONFIG($${firstBuild}, $${firstBuild}|$${secondBuild}): BUILDS = $$first_BUILDS $$second_BUILDS |
|
93 else: BUILDS = $$second_BUILDS $$first_BUILDS |
|
94 export(BUILDS) |
|
95 } else { |
|
96 eval($${firstBuildName}Build:fixExclusiveOutputDirs($$firstBuild, $$secondBuild, false)) |
|
97 eval($${secondBuildName}Build:fixExclusiveOutputDirs($$secondBuild, $$firstBuild, false)) |
|
98 } |
|
99 return(true) |
|
100 } |