Debian Codegraph @

Installer/InstallerConfig.pri

raw
1 #To change the output file name, or adjust what files are included in the ouput, see the "pep9cpudefs.pri" file
2
3 #Clean path
4 defineReplace(cpl){
5 #Adjust the input path so that the correct slashes are used for the host shell & OS
6 return($$system_path($$1))
7 }
8 #Clean path with force quote
9 defineReplace(cpq){
10 return(\"$$cpl($$1)\")
11 }
12
13
14 #Prevent Windows from trying to parse the project three times per build.
15 #This interferes with the deployment script, and makes debugging hard since Qt attempts to debug the optimized program.
16 CONFIG -= debug_and_release \
17 debug_and_release_target
18 QMAKE_MAC_SDK = macosx10.13
19
20 QtDir = $$clean_path($$[QT_INSTALL_LIBS]/..)
21 QtInstallerBin=$$clean_path($$QtDir/../../tools/Qtinstallerframework/3.0/bin)
22
23 !CONFIG(debug,debug|release):macx{
24 #For some reason, the release flag is set in both debug and release.
25 #So, the above Config(...) makes it so a disk image is only built in release mode.
26
27 #Create necessary directory structure for disk image.
28 QMAKE_POST_LINK += $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer/);
29 #Copy over the executable and bundle it with its dependencies
30 QMAKE_POST_LINK += $${QMAKE_COPY_DIR} $$cpq($$OUT_PWD/$$TARGET".app") $$cpq($$OUT_PWD/Installer/);
31 QMAKE_POST_LINK += $$cpq($$QtDir/bin/macdeployqt) $$cpq($$OUT_PWD/Installer/$$TARGET".app");
32 #Use HDIUtil to make a folder into a read/write image
33 QMAKE_POST_LINK += hdiutil create -volname $$TARGET -srcfolder $$cpq($$OUT_PWD/Installer) -attach -ov -format UDRW $$TARGET"Temp.dmg";
34 #Link from the read/write image to the machine's Applications folder
35 QMAKE_POST_LINK += ln -s /Applications /Volumes/$$TARGET/Applications;
36 #Write all data files to image
37 for(name,UNIVERSAL_DATA){
38 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PATH_PREFIX/$$name) /Volumes/$$TARGET &
39 }
40 for(name,MAC_DATA){
41 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PATH_PREFIX/$$name) /Volumes/$$TARGET &
42 }
43 #Unmount the image, and create a new compressed, readonly image.
44 QMAKE_POST_LINK += hdiutil detach /Volumes/$$TARGET;
45 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$OUT_PWD/$$TARGET"Temp".dmg) $$cpq($$OUT_PWD/$$TARGET"Temp2".dmg);
46 QMAKE_POST_LINK += hdiutil convert -format UDBZ -o $$cpq($$OUT_PWD/$$OUTPUT_INSTALLER_NAME".dmg") $$cpq($$OUT_PWD/$$TARGET"Temp2".dmg);
47 #Remove the temporary read/write image.
48 QMAKE_POST_LINK += $${QMAKE_DEL_FILE} $$cpq($$OUT_PWD/$$TARGET"Temp".dmg);
49 QMAKE_POST_LINK += $${QMAKE_DEL_FILE} $$cpq($$OUT_PWD/$$TARGET"Temp2".dmg);
50 #If QMAKE_POST_LINK stops working in a future version, QMAKE provides another way to add custom targets.
51 #Use the method described in "Adding Custom Targets" on http://doc.qt.io/qt-5/qmake-advanced-usage.html.
52 #Our deployment tool will be called anytime the application is sucessfully linked in release mode.
53 }
54
55 #Otherwise if the target is windows, but no installer framework exists
56 else:!CONFIG(debug,debug|release):win32:!exists($$QtInstallerBin/repogen.exe){
57 warning("Aborting installer creations, since QT Installer Framework 3.0 is not installed.")
58 warning("Please run the QT maintence tool and install QT Installer Framework 3.0.")
59 }
60 #Otherwise build the installer for windows as normal.
61 else:!CONFIG(debug,debug|release):win32{
62 #Directory where the repogen tool will put its output
63 repoDir=$$cpq($$OUT_PWD/Repository/win32)
64 #Create installer directory structure
65 #These will be ignored if the target already exists
66 QMAKE_POST_LINK += $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer) & \
67 $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer/packages) & \
68 $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer/packages/$$TARGET) & \
69 $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer/packages/$$TARGET/meta) & \
70 $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer/packages/$$TARGET/data) & \
71 $${QMAKE_MKDIR} $$cpq($$OUT_PWD/Installer/config) &
72
73 #Create a directory for update information
74 !exists($$repoDir){
75 QMAKE_POST_LINK += $${QMAKE_MKDIR} $$cpq($$repoDir) &
76 }
77
78 #Copy over files needed to create installer
79 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PWD/config/configwin32.xml) $$cpq($$OUT_PWD/Installer/config/config.xml) & \ #Copy Platform dependant config file
80 $${QMAKE_COPY} $$cpq($$PWD/config/control.js) $$cpq($$OUT_PWD/Installer/config) & \ #Copy over installer control script
81 $${QMAKE_COPY_DIR} $$cpq($$PWD/packages/$$TARGET) $$cpq($$OUT_PWD/Installer/packages/$$TARGET/meta) & #Copy over all meta info files in the target packages directory
82
83 #Copy over needed icons as set in defs file
84 for(name,UNIVERSAL_ICONS){
85 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PATH_PREFIX/$$name) $$cpq($$OUT_PWD/Installer/config) &
86 }
87 for(name,WINDOWS_ICONS){
88 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PATH_PREFIX/$$name) $$cpq($$OUT_PWD/Installer/config) &
89 }
90 #Copy over additional data specified in defs file
91 for(name,UNIVERSAL_DATA){
92 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PATH_PREFIX/$$name) $$cpq($$OUT_PWD/Installer/packages/$$TARGET/data) &
93 }
94 for(name,WINDOWS_DATA){
95 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$PATH_PREFIX/$$name) $$cpq($$OUT_PWD/Installer/packages/$$TARGET/data) &
96 }
97
98
99 #Copy over executable to data directory
100 QMAKE_POST_LINK += $${QMAKE_COPY} $$cpq($$OUT_PWD/$$TARGET".exe") $$cpq($$OUT_PWD/Installer/packages/$$TARGET/data) &
101
102 #Execute windeployqt to copy needed binaries (dlls, etc).
103 #See documentation here:
104 #http://doc.qt.io/qt-5/windows-deployment.html
105 QMAKE_POST_LINK += $$cpq($$QtDir/bin/windeployqt) --no-translations --no-system-d3d-compiler $$cpq($$OUT_PWD/Installer/packages/$$TARGET/data/$$TARGET".exe") &
106
107
108 #The following two lines invoke QT Installer Framework executables. See the following link
109 #for documentation on what the different comman line flags do.
110 #http://doc.qt.io/qtinstallerframework/ifw-tools.html
111
112 #Execute repository creator
113 QMAKE_POST_LINK += $$cpq($$QtInstallerBin/repogen) --update-new-components -p $$cpq($$OUT_PWD/Installer/packages) $$repoDir &
114
115 #Create installer using the qt binary creator
116 QMAKE_POST_LINK += $$cpq($$QtInstallerBin/binarycreator) -c $$cpq($$OUT_PWD/Installer/config/config.xml) -p $$cpq($$OUT_PWD/Installer/packages) \
117 $$cpq($$OUT_PWD/Installer/$$OUTPUT_INSTALLER_NAME) &
118
119 }
120
121 #Since there is no native QT deploy tool for Linux, one must be added in the project configuration
122 #This condition is to make sure that a tool was provided as an argument to qmake
123 else:linux:isEmpty(LINUX_DEPLOY){
124 warning("Attempting a Linux build, but no path to the build tool was provided")
125 }
126
127 #Then linuxdeployqt is available, and it should be used to make a working installer for linux.
128 else:linux{
129 message("This is where the linux build code will go")
130 }