WindowsBuild30 » History » Version 29

Chris Cannam, 2018-07-11 10:03 AM

1 27 Chris Cannam
h1. Building SV v3.1 on Windows
2 1 Chris Cannam
3 27 Chris Cannam
Versions 3.0+ of Sonic Visualiser are primarily 64-bit for Windows, although the 32-bit version is still supported.
4 1 Chris Cannam
5 29 Chris Cannam
 * Both builds can be run from Qt Creator, or from a command prompt using batch build scripts provided. The release packages are built using the batch scripts.
6 1 Chris Cannam
7 27 Chris Cannam
 * The *64-bit version* is built using the *Microsoft Visual C++ compiler*. Install 64-bit Microsoft Visual Studio 2017 Community Edition and then Qt 5.11 (or latest 5.x).
8 1 Chris Cannam
9 27 Chris Cannam
 * The *32-bit version* is built using the *MinGW compiler*. Install Qt 5.11 (or latest 5.x) with Qt Creator and ensure that the 32-bit MinGW option is available.
10 27 Chris Cannam
11 24 Chris Cannam
 * The official 64-bit installer also includes some helper binaries from the 32-bit build, enabling it to use 32-bit Vamp plugins as well as 64-bit ones. So to make our official 64-bit installer, we actually have to complete both builds.
12 2 Chris Cannam
13 27 Chris Cannam
 * The installers are built using "WiX":http://wixtoolset.org/, so you must have that installed. The path to WiX is hardcoded in our script and at the time of writing it assumes WiX v3.11.
14 1 Chris Cannam
15 27 Chris Cannam
 * We use the "Repoint":https://github.com/cannam/repoint source dependency manager. Ensure the required SML runtime for this is available (either "SML/NJ":http://smlnj.org/ or "Poly/ML":http://www.polyml.org/), and then run @.\repoint install@ in a command prompt or Powershell window before opening a build project or starting a build.
16 1 Chris Cannam
17 27 Chris Cannam
In both cases (32 and 64 bit) the dependent libraries we use are found in the @sv-dependency-builds@ subrepo. Prior to the switch to using the Repoint dependency manager, this subrepo was checked out by Mercurial as a matter of course with the SV repo; after the switch to Repoint, it is one of the library modules that is installed by running @.\repoint install@. There should be no other external dependencies besides Qt and the runtime libraries it needs.
18 23 Chris Cannam
19 1 Chris Cannam
h2. Which SV branch to use
20 3 Chris Cannam
21 23 Chris Cannam
Use the @default@ branch of the SV Mercurial repo unless you have a particular reason to know otherwise.
22 3 Chris Cannam
23 2 Chris Cannam
h2. 32-bit build and installer
24 2 Chris Cannam
25 4 Chris Cannam
h4. Build
26 1 Chris Cannam
27 1 Chris Cannam
This process is similar to that introduced in v2.1 (see [[here|WindowsBuild21]]), except that we now *do* use a shadow build.
28 4 Chris Cannam
29 23 Chris Cannam
 * Check out the correct branch (probably @default@ as described above)
30 23 Chris Cannam
 * Run @./vext install@ to get the code dependencies
31 4 Chris Cannam
 * Open the main @sonic-visualiser.pro@ project in Qt Creator
32 5 Chris Cannam
 * Set up a *release build* using *Desktop Qt 5.7.0 MinGW 32-bit* as a *shadow build*
33 8 Chris Cannam
 * "Run qmake" and "Rebuild All"
34 4 Chris Cannam
35 10 Chris Cannam
There is still one unresolved manual step before you can run Sonic Visualiser:
36 10 Chris Cannam
37 1 Chris Cannam
 * Go to the build directory (e.g. @build-sonic-visualiser-Desktop_Qt_5_7_0_MinGW_32bit-Release@) and copy the file @checker\release\vamp-plugin-load-checker.exe@ to the top-level @release@ directory
38 10 Chris Cannam
39 16 Chris Cannam
If the build was successful, you should now be able to run Sonic Visualiser from within the IDE. (You can't yet run the binary from the Windows Explorer, as Qt and other dependencies won't be found.)
40 6 Chris Cannam
41 17 Chris Cannam
You can also run individual unit test suites by selecting them as target executable in Qt Creator.
42 17 Chris Cannam
43 17 Chris Cannam
44 12 Chris Cannam
h4. Installer
45 1 Chris Cannam
46 12 Chris Cannam
The principle here is:
47 11 Chris Cannam
48 14 Chris Cannam
 # Copy dependent libraries into the @release@ directory within the build dir, so that Sonic Visualiser can be run directly without IDE support
49 1 Chris Cannam
 # Package up the installer using the @build.cmd@ script that runs WiX
50 13 Chris Cannam
51 13 Chris Cannam
For the Qt 5.7 installation I'm currently using, this means:
52 13 Chris Cannam
53 13 Chris Cannam
 * From @C:\Qt57\5.7\mingw53_32\bin@, copy the following files into the @release@ directory: @Qt5Core.dll@ @Qt5Gui.dll@ @Qt5Network.dll@ @Qt5Svg.dll@ @Qt5Widgets.dll@ @Qt5Xml.dll@ @libgcc_s_dw2-1.dll@ @libstdc++-6.dll@ @libwinpthread-1.dll@
54 13 Chris Cannam
 * From @C:\Qt57\5.7\mingw53_32\plugins\platforms@, copy the following files: @qminimal.dll@ @qwindows.dll@
55 13 Chris Cannam
 * Check that the Sonic Visualiser executable in that directory starts up properly when double-clicked
56 13 Chris Cannam
 * In a command prompt window, cd to the @deploy\win32@ directory in the Sonic Visualiser source tree and run @.\build.cmd@
57 13 Chris Cannam
58 4 Chris Cannam
Note that the @build.cmd@ script has the path to the shadow build folder hardcoded, so you may need to tweak that.
59 4 Chris Cannam
60 1 Chris Cannam
h2. 64-bit build and installer
61 1 Chris Cannam
62 4 Chris Cannam
h4. Build
63 4 Chris Cannam
64 23 Chris Cannam
 * Check out the correct branch (probably @default@ as described above)
65 23 Chris Cannam
 * Run @./vext install@ to get the code dependencies
66 4 Chris Cannam
 * Open the main @sonic-visualiser.pro@ project in Qt Creator
67 5 Chris Cannam
 * Set up a *release build* using *Desktop Qt 5.7.0 MSVC 64-bit* as a *shadow build*
68 9 Chris Cannam
 * "Run qmake" and "Rebuild All"
69 6 Chris Cannam
70 19 Chris Cannam
If the code is already checked out for a 32-bit build, then it should be possible to add or select the 64-bit MSVC "kit" as a target in Qt Creator and then build that from the same directory as a separate shadow build, rather than having to check out the code again.
71 19 Chris Cannam
72 20 Chris Cannam
And we have the same unresolved manual step as for the 32-bit build:
73 20 Chris Cannam
74 20 Chris Cannam
 * Go to the build directory (e.g. @build-sonic-visualiser-Desktop_Qt_5_7_0_MSVC2015_64bit-Release@) and copy the file @checker\release\vamp-plugin-load-checker.exe@ to the top-level @release@ directory
75 20 Chris Cannam
76 4 Chris Cannam
If the build was successful, you should now be able to run Sonic Visualiser from within the IDE. (You can't yet run the binary from the Windows Explorer, as Qt and other dependencies won't be found.)
77 18 Chris Cannam
78 18 Chris Cannam
You can also run individual unit test suites by selecting them as target executable in Qt Creator.
79 18 Chris Cannam
80 4 Chris Cannam
h4. Installer
81 4 Chris Cannam
82 4 Chris Cannam
The 64-bit installer needs files from both the 64- and 32-bit builds.
83 21 Chris Cannam
84 21 Chris Cannam
The principle is:
85 21 Chris Cannam
86 21 Chris Cannam
 # Copy dependent 64-bit libraries into the @release@ directory within the build dir, so that Sonic Visualiser can be run directly without IDE support
87 21 Chris Cannam
 # Copy helper programs from the 32-bit build into the @release@ directory, renaming them to have @-32@ at the ends of their names
88 21 Chris Cannam
 # Copy (the smaller number of) dependent 32-bit libraries that the 32-bit helper programs need into the @release@ directory
89 21 Chris Cannam
 # Package up the installer using the @build.cmd@ script that runs WiX
90 21 Chris Cannam
91 21 Chris Cannam
For the Qt 5.7 installation I'm currently using, this means:
92 21 Chris Cannam
93 21 Chris Cannam
 * From @C:\Qt57\5.7\msvc2015_64\bin@, copy the following files into the @release@ directory: @Qt5Core.dll@ @Qt5Gui.dll@ @Qt5Network.dll@ @Qt5Svg.dll@ @Qt5Widgets.dll@ @Qt5Xml.dll@ 
94 21 Chris Cannam
 * From @C:\Qt57\5.7\msvc2015_64\plugins\platforms@, copy the following files: @qminimal.dll@ @qwindows.dll@
95 21 Chris Cannam
 * From the 32-bit build's @release@ directory, copy the files @vamp-plugin-load-checker.exe@ and @piper-vamp-simple-server.exe@, renaming them to @vamp-plugin-load-checker-32.exe@ and @piper-vamp-simple-server-32.exe@ respectively (so as not to overwrite the existing 64-bit versions of these files)
96 21 Chris Cannam
 * From @C:\Qt57\5.7\mingw53_32\bin@, copy: @libgcc_s_dw2-1.dll@ @libstdc++-6.dll@ @libwinpthread-1.dll@
97 22 Chris Cannam
 * (From the SV build directory's @sv-dependency-builds/win64/lib@ directory: copy @libsndfile-1.dll@ -- this is technically optional as the installer script will include it regardless, but it's necessary if you want to test SV by double-clicking)
98 21 Chris Cannam
 * Check that the Sonic Visualiser executable in that directory starts up properly when double-clicked
99 21 Chris Cannam
 * In a command prompt window, cd to the @deploy\win64@ directory in the Sonic Visualiser source tree and run @.\build.cmd@
100 21 Chris Cannam
101 21 Chris Cannam
Note that the @build.cmd@ script has the path to the shadow build folder hardcoded, so you may need to tweak that. The WiX installer config file (@sonic-visualiser.wxs@) also has some hardcoded paths, for the Microsoft Visual Studio runtime libraries in @C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT@, which may need to be updated.