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