1Building GtkSourceView for Windows with Meson using Visual Studio
2=========
3
4Meson is now the supported method of building GtkSourceView with Visual Studio, where the process
5of doing so is described in the following section:
6
7Prior to building, you will need the following:
8-Python 3.5.x or later
9-Meson 0.49.0 (or later) at this time of writing
10-A version of Visual Studio 2008 to 2019.
11-Ninja build tool (unless --backend=vs is
12 specified in the Meson configure command line for
13 Visual Studio 2010, 2015, 2017, 2019)
14-The pkg-config utility (or a compatible one), either in
15 your PATH or found by setting PKG_CONFIG to point to
16 such a tool.
17
18-GLib 2.48.0 (or later) at this time of writing
19-GTK 3.20.0 (or later) at this time of writing
20-LibXML2 2.6 (or later) at this time of writing
21-libgladeui 3.9 (or later) at this time of writing [optional]
22-GObject-Introspection 1.42.0 (or later) at this time of writing [optional]
23
24For the depedent packages, you will need to ensure that their pkg-config (.pc) files
25could be found by the pkg-config utility, either directly or by setting PKG_CONFIG_PATH
26to point to the path(s) where the .pc files could be found.  For libxml2, if .pc files
27are not available, ensure that its headers and import library can be found by ensuring
28your INCLUDE and LIB environment variables include these repective paths.  For the
29introspection to complete successfully, you will also need to ensure that the DLLs can be
30found in the bindir entries of your .pc files or in your PATH.
31
32To build GtkSourceView, do the following:
33
34-Open a Visual Studio command prompt.
35-In the command prompt, create an empty build directory that is on the same drive
36 as the GtkSourceView sources.
37-Run the command in the command prompt in your build directory:
38   meson <path_to_GtkSourceView_sources> --buildtype=... --prefix=... -Dvapi=false
39
40 Where:
41  -buildtype can be debug, release,plain or debugoptmized (default),
42   please see the Meson documentation for more details
43  -prefix is where the built files are copied to upon 'install'
44  -Dvapi=false is the build to not check for Vala, which is normally not present
45   on Visual Studio builds.
46
47 You may want to specify the following as well:
48  --backend=vs: Generate Visual Studio projects for building on Visual Studio 2010, 2015
49                2017, 2019.  This will remove the need for Ninja.  Please note that the
50                generated project files are only valid on the machine they are generated.
51  -Dgir=false: Disable introspection builds.
52
53-If the previous command completed successfully, carry out the build by running 'ninja' or
54 by opening and building the projects with the generated Visual Studio projects, if using
55 --backend=vs.  If desired, run the test using 'ninja test' or building the 'test' project
56 in the Visual Studio projects.
57
58-Install the build results using 'ninja install' or building the 'install' project in the
59 Visual Studio projects.
60
61Some additional notes on building with Visual Studio 2008:
62===
63The builds generate the SxS manifest files that need to be manually embedded into the built
64DLL and EXE files, which can be done by after running 'ninja install' using the Visual Studio
65command prompt from within the build directory:
66
67 for /r %f in (*.dll.manifest) do if exist <install_prefix>\bin\%~nf mt /manifest %f /outputresource:<install_prefix>\bin\%~nf;2
68 for /r %f in (*.exe.manifest) do if exist <install_prefix>\bin\%~nf mt /manifest %f /outputresource:<install_prefix>\bin\%~nf;1
69
70This is to ensure that the built binaries can be run.
71