Commit 2a3e3427 authored by Eike Ziller's avatar Eike Ziller

Remove code duplication for copying resources.

qtcreatordata.pri was created for "conditional" copying of resources to the
build tree. Adapt it a bit and use it for the "unconditionally" copied
resources as well.
A side effect is, that the unconditionally copied resources now are
also installed file by file instead of the directory as a whole,
which doesn't make a difference in the end result though.

Change-Id: I6da3eeaadcb48c19987858bbb8c2d42ee149f6f3
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 3a7ce3f5
......@@ -4,24 +4,28 @@
#
# Usage: Define variables (details below) and include this pri file afterwards.
#
# STATIC_BASE - base directory for the files listed in STATIC_FILES
# STATIC_FILES - list of files to be deployed
include(qtcreator.pri)
# STATIC_BASE - base directory for the files listed in STATIC_FILES
# STATIC_FILES - list of files to be deployed
# STATIC_OUTPUT_BASE - base directory in the compile output
# STATIC_INSTALL_BASE - base directory in the install output
# used in custom compilers which just copy files
defineReplace(stripStaticBase) {
return($$relative_path($$1, $$STATIC_BASE))
}
# handle conditional copying; copydata will be set by qtcreator.pri
# handle conditional copying based on STATIC_BASE compared to STATIC_OUTPUT_BASE
!isEmpty(STATIC_FILES) {
isEmpty(STATIC_BASE): \
error("Using STATIC_FILES without having STATIC_BASE set")
isEmpty(STATIC_OUTPUT_BASE): \
error("Using STATIC_FILES without having STATIC_OUTPUT_BASE set")
!osx:isEmpty(STATIC_INSTALL_BASE): \
error("Using STATIC_FILES without having STATIC_INSTALL_BASE set")
!isEmpty(copydata) {
!isEqual(STATIC_BASE, $$STATIC_OUTPUT_BASE) {
copy2build.input += STATIC_FILES
copy2build.output = $$IDE_DATA_PATH/${QMAKE_FUNC_FILE_IN_stripStaticBase}
copy2build.output = $$STATIC_OUTPUT_BASE/${QMAKE_FUNC_FILE_IN_stripStaticBase}
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
win32:copy2build.commands = $$QMAKE_COPY \"${QMAKE_FILE_IN}\" \"${QMAKE_FILE_OUT}\"
unix:copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
......@@ -33,7 +37,7 @@ defineReplace(stripStaticBase) {
!osx {
static.files = $$STATIC_FILES
static.base = $$STATIC_BASE
static.path = $$INSTALL_DATA_PATH
static.path = $$STATIC_INSTALL_BASE
INSTALLS += static
}
}
TEMPLATE = aux
include(../../qtcreator.pri)
STATIC_BASE = $$PWD
STATIC_OUTPUT_BASE = $$IDE_DATA_PATH
STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH
# files/folders that are conditionally "deployed" to the build directory
DATA_DIRS = \
welcomescreen \
examplebrowser \
......@@ -32,49 +35,3 @@ for(data_dir, DATA_DIRS) {
}
include(../../qtcreatordata.pri)
SRCRESOURCEDIR = $$IDE_SOURCE_TREE/src/share/qtcreator/
defineReplace(stripSrcResourceDir) {
win32 {
!contains(1, ^.:.*):1 = $$OUT_PWD/$$1
} else {
!contains(1, ^/.*):1 = $$OUT_PWD/$$1
}
out = $$clean_path($$1)
out ~= s|^$$re_escape($$SRCRESOURCEDIR)||$$i_flag
return($$out)
}
# files that are to be unconditionally "deployed" to the build dir from src/share to share
DATA_DIRS = \
externaltools
DATA_FILES_SRC = \
externaltools/lrelease.xml \
externaltools/lupdate.xml \
externaltools/sort.xml \
externaltools/qmlviewer.xml \
externaltools/qmlscene.xml
unix {
macx:DATA_FILES_SRC += externaltools/vi_mac.xml
else:DATA_FILES_SRC += externaltools/vi.xml
} else {
DATA_FILES_SRC += externaltools/notepad_win.xml
}
for(file, DATA_FILES_SRC):DATA_FILES += $${SRCRESOURCEDIR}$$file
unconditionalCopy2build.input = DATA_FILES
unconditionalCopy2build.output = $$IDE_DATA_PATH/${QMAKE_FUNC_FILE_IN_stripSrcResourceDir}
isEmpty(vcproj):unconditionalCopy2build.variable_out = PRE_TARGETDEPS
win32:unconditionalCopy2build.commands = $$QMAKE_COPY \"${QMAKE_FILE_IN}\" \"${QMAKE_FILE_OUT}\"
unix:unconditionalCopy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
unconditionalCopy2build.name = COPY ${QMAKE_FILE_IN}
unconditionalCopy2build.CONFIG += no_link
QMAKE_EXTRA_COMPILERS += unconditionalCopy2build
!macx {
for(data_dir, DATA_DIRS) {
$${data_dir}.files = $$IDE_DATA_PATH/$$data_dir
$${data_dir}.path = $$INSTALL_DATA_PATH
$${data_dir}.CONFIG += no_check_exist
INSTALLS += $$data_dir
}
}
This directory contains *only* data files which are installed conditionally.
The installation code is in ../../share/qtcreator/static.pro
TEMPLATE = aux
include(../../../qtcreator.pri)
STATIC_BASE = $$PWD
STATIC_OUTPUT_BASE = $$IDE_DATA_PATH
STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH
STATIC_FILES = \
$$PWD/externaltools/lrelease.xml \
$$PWD/externaltools/lupdate.xml \
$$PWD/externaltools/sort.xml \
$$PWD/externaltools/qmlviewer.xml \
$$PWD/externaltools/qmlscene.xml
unix {
osx:STATIC_FILES += $$PWD/externaltools/vi_mac.xml
else:STATIC_FILES += $$PWD/externaltools/vi.xml
} else {
STATIC_FILES += $$PWD/externaltools/notepad_win.xml
}
include(../../../qtcreatordata.pri)
......@@ -31,4 +31,5 @@ SUBDIRS += \
libs \
app \
plugins \
tools
tools \
share/qtcreator/data.pro
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment