1 | load(default_pre)
|
---|
2 |
|
---|
3 | !isEmpty(QMAKE_EXEPACK):CONFIG *= exepack
|
---|
4 |
|
---|
5 | #
|
---|
6 | # splitDllBegin(part_list [, config [, exclusive_config_list]])
|
---|
7 | #
|
---|
8 | # Splits the DLL target to several separate parts according to part_list where
|
---|
9 | # each part is a suffix appended to the original DLL name and the number of
|
---|
10 | # parts determines the number of resulting DLLs.
|
---|
11 | #
|
---|
12 | # An optional config argument specifies the CONFIG scope in which the split
|
---|
13 | # should occur. In this case, exclusive_config_list may be used to specify
|
---|
14 | # a |-separated list of mutually exclusive scopes so that the last one added
|
---|
15 | # will be actually in effect.
|
---|
16 | #
|
---|
17 | # This function only begins the split process. In order to make it work,
|
---|
18 | # the splitDllPart function must be used to define the sources for each part
|
---|
19 | # and then splitDllEnd is called to finalize the split process. See individual
|
---|
20 | # function descriptions for more details.
|
---|
21 | #
|
---|
22 | defineTest(splitDllBegin) {
|
---|
23 |
|
---|
24 | !dll:error("splitDllBegin may only be used for DLLs!")
|
---|
25 |
|
---|
26 | 1 = $$unique(1)
|
---|
27 | !count(1, 2, >=):error("splitDllBegin: argument 1 must contain 2 or more unique words!")
|
---|
28 |
|
---|
29 | SPLIT_PARTS = $$1
|
---|
30 | export(SPLIT_PARTS)
|
---|
31 |
|
---|
32 | isEmpty(2):2 = true
|
---|
33 | SPLIT_CONFIG = $$2
|
---|
34 | count(ARGS, 3, >=) {
|
---|
35 | !CONFIG($$2, $$3):SPLIT_CONFIG = false
|
---|
36 | }
|
---|
37 | export(SPLIT_CONFIG)
|
---|
38 |
|
---|
39 | # add part label to CONFIG when needed
|
---|
40 | debug_and_release {
|
---|
41 | for(a, 1) {
|
---|
42 | equals(a, "."):a =
|
---|
43 | eval($${a}.CONFIG = Part$${a})
|
---|
44 | export($${a}.CONFIG)
|
---|
45 | }
|
---|
46 | }
|
---|
47 |
|
---|
48 | debug_and_release {
|
---|
49 | BUILDS = $$replace(1, "\.", "Build")
|
---|
50 | } else {
|
---|
51 | BUILDS = $$join(1, " Part", "Part")
|
---|
52 | BUILDS = $$replace(BUILDS, "Part\.", "Part")
|
---|
53 | }
|
---|
54 | export(BUILDS)
|
---|
55 |
|
---|
56 | !build_pass:!isEmpty(BUILDS):return(true)
|
---|
57 |
|
---|
58 | # define _VERSION_OVERRIDE statements if needed
|
---|
59 | for(a, 1) {
|
---|
60 | !equals(a, ".") {
|
---|
61 | eval(tmp = $$eval(QMAKE_$${upper($$TARGET)}_VERSION_OVERRIDE))
|
---|
62 | !isEmpty(tmp) {
|
---|
63 | eval(QMAKE_$${upper($$TARGET)}$${a}_VERSION_OVERRIDE = $$tmp)
|
---|
64 | export(QMAKE_$${upper($$TARGET)}$${a}_VERSION_OVERRIDE)
|
---|
65 | }
|
---|
66 | }
|
---|
67 | }
|
---|
68 |
|
---|
69 | export(CONFIG)
|
---|
70 |
|
---|
71 | rest = $$1
|
---|
72 |
|
---|
73 | for(a, 1) {
|
---|
74 | rest -= $$a
|
---|
75 |
|
---|
76 | equals(a, "."):scope = Part
|
---|
77 | else:scope = Part$${a}
|
---|
78 |
|
---|
79 | CONFIG($$SPLIT_CONFIG):CONFIG($$scope) {
|
---|
80 | # add the other parts to LIBS of this part and to PRL_EXPORT_LIBS
|
---|
81 | for(b, 1) {
|
---|
82 | !equals(b, $${a}) {
|
---|
83 | equals(b, "."):b =
|
---|
84 | eval(LIBS += -l$${TARGET}$${b})
|
---|
85 | eval(PRL_EXPORT_LIBS += -l$${TARGET}$${b})
|
---|
86 | }
|
---|
87 | }
|
---|
88 | !isEmpty(LIBS):export(LIBS)
|
---|
89 | !isEmpty(PRL_EXPORT_LIBS):export(PRL_EXPORT_LIBS)
|
---|
90 |
|
---|
91 | QMAKE_LIBDIR *= $(DESTDIR)
|
---|
92 | export(QMAKE_LIBDIR)
|
---|
93 |
|
---|
94 | # add the pre-link step for all but the last part
|
---|
95 | next = $$member(rest)
|
---|
96 | !isEmpty(next) {
|
---|
97 | debug_and_release {
|
---|
98 | equals(next, "."):next =
|
---|
99 | else:next = "-"$${lower($$next)}
|
---|
100 | CONFIG(release, debug|release):bld = release
|
---|
101 | else:bld = debug
|
---|
102 | eval(QMAKE_PRE_LINK = $(MAKE) $${bld}$${next})
|
---|
103 | } else {
|
---|
104 | equals(next, "."):next = Part
|
---|
105 | else:next = Part$${next}
|
---|
106 | eval(QMAKE_PRE_LINK = $(MAKE) $${next})
|
---|
107 | }
|
---|
108 | export(QMAKE_PRE_LINK)
|
---|
109 | }
|
---|
110 |
|
---|
111 | # override the target
|
---|
112 | !equals(a, ".") {
|
---|
113 | TARGET = $${TARGET}$${a}
|
---|
114 | export(TARGET)
|
---|
115 | }
|
---|
116 | }
|
---|
117 | }
|
---|
118 | }
|
---|
119 |
|
---|
120 | #
|
---|
121 | # splitDllPart(part)
|
---|
122 | #
|
---|
123 | # Gathers the sources for the specified DLL part by taking the current
|
---|
124 | # HEADERS and SOURCES values and then resets these variables. Must be called
|
---|
125 | # once for each part defined in splitDllBegin.
|
---|
126 | #
|
---|
127 | defineTest(splitDllPart) {
|
---|
128 |
|
---|
129 | !dll:error("splitDllPart may only be used for DLLs!")
|
---|
130 | !contains(SPLIT_PARTS, $$1):error("splitDllPart: part '$$1' is not defined by splitDllBegin!")
|
---|
131 |
|
---|
132 | !build_pass:!isEmpty(BUILDS):return(true)
|
---|
133 |
|
---|
134 | equals(1, "."):scope = Part
|
---|
135 | else:scope = Part$${1}
|
---|
136 |
|
---|
137 | CONFIG($$SPLIT_CONFIG) {
|
---|
138 | CONFIG($$scope): {
|
---|
139 | eval($${scope}_HEADERS = $$HEADERS)
|
---|
140 | export($${scope}_HEADERS)
|
---|
141 | eval($${scope}_SOURCES = $$SOURCES)
|
---|
142 | export($${scope}_SOURCES)
|
---|
143 | }
|
---|
144 |
|
---|
145 | unset(HEADERS)
|
---|
146 | export(HEADERS)
|
---|
147 | unset(SOURCES)
|
---|
148 | export(SOURCES)
|
---|
149 | }
|
---|
150 | }
|
---|
151 |
|
---|
152 | #
|
---|
153 | # splitDllEnd()
|
---|
154 | #
|
---|
155 | # Finalizes the split process started by splitDllBegin. Must be called
|
---|
156 | # after splitDllPart calls for each part are made.
|
---|
157 | #
|
---|
158 | defineTest(splitDllEnd) {
|
---|
159 |
|
---|
160 | !dll:error("splitDllEnd may only be used for DLLs!")
|
---|
161 |
|
---|
162 | !build_pass:!isEmpty(BUILDS):return(true)
|
---|
163 |
|
---|
164 | for(a, SPLIT_PARTS) {
|
---|
165 | equals(a, "."):scope = Part
|
---|
166 | else:scope = Part$${a}
|
---|
167 |
|
---|
168 | CONFIG($$SPLIT_CONFIG):CONFIG($$scope) {
|
---|
169 | eval(HEADERS = $$eval($${scope}_HEADERS))
|
---|
170 | eval(SOURCES = $$eval($${scope}_SOURCES))
|
---|
171 | export(HEADERS)
|
---|
172 | export(SOURCES)
|
---|
173 | }
|
---|
174 | }
|
---|
175 | }
|
---|