| 1 |
isEmpty(COPIES): return() |
| 2 |
contains(TEMPLATE, .*subdirs): error("COPIES does not work with TEMPLATE=subdirs") |
| 3 |
|
| 4 |
build_pass:build_all:!isEqual(BUILD_PASS, $$first(BUILDS)) { |
| 5 |
# Avoid that multiple build passes race with each other. |
| 6 |
# This will fail to copy anything if the user explicitly invokes |
| 7 |
# only the non-primary build. This is unfixable, as at qmake time |
| 8 |
# we cannot possibly know how make will be invoked, yet we must |
| 9 |
# predict it here. |
| 10 |
return() |
| 11 |
} |
| 12 |
|
| 13 |
defineReplace(qtStripProPwd) { |
| 14 |
return($$relative_path($$1, $$_PRO_FILE_PWD_)) |
| 15 |
} |
| 16 |
|
| 17 |
for (cp, COPIES) { |
| 18 |
isEmpty($${cp}.files): next() |
| 19 |
pfx = copy_$${cp} |
| 20 |
notdir = false |
| 21 |
dir = false |
| 22 |
for (f, $${cp}.files) { |
| 23 |
fil = $$absolute_path($$f, $$_PRO_FILE_PWD_) |
| 24 |
tfiles = $$files($$fil/*) |
| 25 |
isEmpty(tfiles): \ |
| 26 |
notdir = true |
| 27 |
else: \ |
| 28 |
dir = true |
| 29 |
$${pfx}.files += $$fil |
| 30 |
} |
| 31 |
$$dir:$$notdir: \ |
| 32 |
error("COPIES entry $$cp lists both files and directories.") |
| 33 |
path = $$eval($${cp}.path) |
| 34 |
isEmpty(path): error("COPIES entry $$cp defines no .path") |
| 35 |
base = $$eval($${cp}.base) |
| 36 |
isEmpty(base) { |
| 37 |
$${pfx}.output = $$path/${QMAKE_FILE_IN_NAME} |
| 38 |
} else: isEqual(base, $$_PRO_FILE_PWD_) { |
| 39 |
$${pfx}.output = $$path/${QMAKE_FUNC_FILE_IN_qtStripProPwd} |
| 40 |
} else { |
| 41 |
eval(defineReplace(qtStripSrcDir_$$cp) { \ |
| 42 |
return(\$\$relative_path(\$\$1, $$val_escape(base))) \ |
| 43 |
}) |
| 44 |
$${pfx}.output = $$path/${QMAKE_FUNC_FILE_IN_qtStripSrcDir_$$cp} |
| 45 |
} |
| 46 |
$${pfx}.input = $${pfx}.files |
| 47 |
!$$dir: \ |
| 48 |
$${pfx}.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT_PATH} |
| 49 |
else: !copy_dir_files: \ |
| 50 |
$${pfx}.commands = $$QMAKE_COPY_DIR ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT_PATH} |
| 51 |
else: \ |
| 52 |
$${pfx}.commands = $$QMAKE_COPY_DIR ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} |
| 53 |
$${pfx}.name = COPY ${QMAKE_FILE_IN} |
| 54 |
$${pfx}.CONFIG = no_link no_clean target_predeps |
| 55 |
QMAKE_EXTRA_COMPILERS += $${pfx} |
| 56 |
} |