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