1defineTest(qtcAddDeployment) {
2for(deploymentfolder, DEPLOYMENTFOLDERS) {
3    item = item$${deploymentfolder}
4    greaterThan(QT_MAJOR_VERSION, 4) {
5        itemsources = $${item}.files
6    } else {
7        itemsources = $${item}.sources
8    }
9    $$itemsources = $$eval($${deploymentfolder}.source)
10    itempath = $${item}.path
11    $$itempath= $$eval($${deploymentfolder}.target)
12    export($$itemsources)
13    export($$itempath)
14    DEPLOYMENT += $$item
15}
16
17MAINPROFILEPWD = $$PWD
18
19android-no-sdk {
20    for(deploymentfolder, DEPLOYMENTFOLDERS) {
21        item = item$${deploymentfolder}
22        itemfiles = $${item}.files
23        $$itemfiles = $$eval($${deploymentfolder}.source)
24        itempath = $${item}.path
25        $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
26        export($$itemfiles)
27        export($$itempath)
28        INSTALLS += $$item
29    }
30
31    target.path = /data/user/qt
32
33    export(target.path)
34    INSTALLS += target
35} else:android {
36    for(deploymentfolder, DEPLOYMENTFOLDERS) {
37        item = item$${deploymentfolder}
38        itemfiles = $${item}.files
39        $$itemfiles = $$eval($${deploymentfolder}.source)
40        itempath = $${item}.path
41        $$itempath = /assets/$$eval($${deploymentfolder}.target)
42        export($$itemfiles)
43        export($$itempath)
44        INSTALLS += $$item
45    }
46
47    x86 {
48        target.path = /libs/x86
49    } else: armeabi-v7a {
50        target.path = /libs/armeabi-v7a
51    } else {
52        target.path = /libs/armeabi
53    }
54
55    export(target.path)
56    INSTALLS += target
57} else:win32 {
58    copyCommand =
59    for(deploymentfolder, DEPLOYMENTFOLDERS) {
60        source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
61        source = $$replace(source, /, \\)
62        sourcePathSegments = $$split(source, \\)
63        target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
64        target = $$replace(target, /, \\)
65        target ~= s,\\\\\\.?\\\\,\\,
66        !isEqual(source,$$target) {
67            !isEmpty(copyCommand):copyCommand += &&
68            isEqual(QMAKE_DIR_SEP, \\) {
69                copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
70            } else {
71                source = $$replace(source, \\\\, /)
72                target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
73                target = $$replace(target, \\\\, /)
74                copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
75            }
76        }
77    }
78    !isEmpty(copyCommand) {
79        copyCommand = @echo Copying application data... && $$copyCommand
80        copydeploymentfolders.commands = $$copyCommand
81        first.depends = $(first) copydeploymentfolders
82        export(first.depends)
83        export(copydeploymentfolders.commands)
84        QMAKE_EXTRA_TARGETS += first copydeploymentfolders
85    }
86} else:ios {
87    copyCommand =
88    for(deploymentfolder, DEPLOYMENTFOLDERS) {
89        source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
90        source = $$replace(source, \\\\, /)
91        target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target)
92        target = $$replace(target, \\\\, /)
93        sourcePathSegments = $$split(source, /)
94        targetFullPath = $$target/$$last(sourcePathSegments)
95        targetFullPath ~= s,/\\.?/,/,
96        !isEqual(source,$$targetFullPath) {
97            !isEmpty(copyCommand):copyCommand += &&
98            copyCommand += mkdir -p \"$$target\"
99            copyCommand += && cp -r \"$$source\" \"$$target\"
100        }
101    }
102    !isEmpty(copyCommand) {
103        copyCommand = echo Copying application data... && $$copyCommand
104        !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
105        QMAKE_POST_LINK += "$$copyCommand"
106        export(QMAKE_POST_LINK)
107    }
108} else:unix {
109    maemo5 {
110        desktopfile.files = $${TARGET}.desktop
111        desktopfile.path = /usr/share/applications/hildon
112        icon.files = $${TARGET}64.png
113        icon.path = /usr/share/icons/hicolor/64x64/apps
114    } else:!isEmpty(MEEGO_VERSION_MAJOR) {
115        desktopfile.files = $${TARGET}_harmattan.desktop
116        desktopfile.path = /usr/share/applications
117        icon.files = $${TARGET}80.png
118        icon.path = /usr/share/icons/hicolor/80x80/apps
119    } else { # Assumed to be a Desktop Unix
120        copyCommand =
121        for(deploymentfolder, DEPLOYMENTFOLDERS) {
122            source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
123            source = $$replace(source, \\\\, /)
124            macx {
125                target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
126            } else {
127                target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
128            }
129            target = $$replace(target, \\\\, /)
130            sourcePathSegments = $$split(source, /)
131            targetFullPath = $$target/$$last(sourcePathSegments)
132            targetFullPath ~= s,/\\.?/,/,
133            !isEqual(source,$$targetFullPath) {
134                !isEmpty(copyCommand):copyCommand += &&
135                copyCommand += $(MKDIR) \"$$target\"
136                copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
137            }
138        }
139        !isEmpty(copyCommand) {
140            copyCommand = @echo Copying application data... && $$copyCommand
141            copydeploymentfolders.commands = $$copyCommand
142            first.depends = $(first) copydeploymentfolders
143            export(first.depends)
144            export(copydeploymentfolders.commands)
145            QMAKE_EXTRA_TARGETS += first copydeploymentfolders
146        }
147    }
148    !isEmpty(target.path) {
149        installPrefix = $${target.path}
150    } else {
151        installPrefix = /opt/$${TARGET}
152    }
153    for(deploymentfolder, DEPLOYMENTFOLDERS) {
154        item = item$${deploymentfolder}
155        itemfiles = $${item}.files
156        $$itemfiles = $$eval($${deploymentfolder}.source)
157        itempath = $${item}.path
158        $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
159        export($$itemfiles)
160        export($$itempath)
161        INSTALLS += $$item
162    }
163
164    !isEmpty(desktopfile.path) {
165        export(icon.files)
166        export(icon.path)
167        export(desktopfile.files)
168        export(desktopfile.path)
169        INSTALLS += icon desktopfile
170    }
171
172    isEmpty(target.path) {
173        target.path = $${installPrefix}/bin
174        export(target.path)
175    }
176    INSTALLS += target
177}
178
179export (ICON)
180export (INSTALLS)
181export (DEPLOYMENT)
182export (LIBS)
183export (QMAKE_EXTRA_TARGETS)
184}
185