|
| 1 | +Building libxml++ with Visual Studio 2017 or later |
| 2 | +- |
| 3 | + |
| 4 | +* You will need Visual Studio 2017 (MSVC 15.7.x) or later, as `C++-17` is |
| 5 | +required and only 15.7.x or later had adequate `C++-17` support. |
| 6 | + |
| 7 | +### Notes on dependencies |
| 8 | +* Install libxml2 from https://xmlsoft.org/, either via Windows binaries or |
| 9 | +building from source, using NMake or CMake. It is strongly recommended, if |
| 10 | +building libxml2 from source, that Visual Studio 2015 or later is used. |
| 11 | +* Install the latest Win32 GTK+ Development files from ftp://ftp.gnome.org/pub/GNOME/binaries/win32/gtk+/, or build GLib from source |
| 12 | +or obtain GLib with vcpkg. |
| 13 | +* You will need the `C++-17` versions of glibmm and libsigc++, which are |
| 14 | +glibmm-2.68.x or later and libsigc++-3.x. |
| 15 | +* Add GLib's/glibmm's, libsigc++'s and libxml2's include path to `%INCLUDE%` |
| 16 | +and its library path to `%LIB%`, or placing the dependencies like the following, |
| 17 | +note that for libsigc++ and glibmm the library naming conventions will be like |
| 18 | +the one used for libxml++, listed in the next sections: |
| 19 | +``` |
| 20 | +$(some_dir_1)\include |
| 21 | + | |
| 22 | + --giomm-2.68\* |
| 23 | + | |
| 24 | + --glibmm-2.68\* |
| 25 | + | |
| 26 | + --glib-2.0\* |
| 27 | + | |
| 28 | + --libsigc++-3.0\* |
| 29 | + | |
| 30 | + --libxml2\libxml\*.h |
| 31 | + | |
| 32 | + --(headers of libraries libxml2/GLib depends on, such as ZLib, liblzma...) |
| 33 | +
|
| 34 | +$(some_dir_2)\lib |
| 35 | + | |
| 36 | + # glib's .pc files, and glibmm/libsigc++'s .pc files if applicable |
| 37 | + --pkgconfig\*.pc |
| 38 | + | |
| 39 | + --[gio|glib]mm-2.68\include\[gio|glib]mmconfig.h |
| 40 | + | |
| 41 | + --sigc++-3.0\include\sigc++config.h |
| 42 | + | |
| 43 | + --[gio|glib]mm-vc14x-[2_68|2.68].lib |
| 44 | + | |
| 45 | + --sigc++-[vc14x-3_0|3.0].lib |
| 46 | + | |
| 47 | + --[gio|gobject|gmodule|glib]-2.0.lib |
| 48 | + | |
| 49 | + --libxml2.lib |
| 50 | + | |
| 51 | + --(.lib's of libraries that libxml2/GLib depends on, such as ZLib, liblzma) |
| 52 | +``` |
| 53 | +* You need libxml2's DLL and all of its dependent DLLs in `%PATH%` if linking |
| 54 | +against a DLL build of libxml2, and the glibmm DLLs and their dependent DLLs |
| 55 | +in `%PATH%` in order to run the tests. |
| 56 | + |
| 57 | +* Notice that for the built DLL and .lib the Visual Studio version is no |
| 58 | +longer `vc$(VSVER)0`, but is named like the following (Visual Studio version), |
| 59 | +to follow what is done in other C++ libraries such as Boost (use |
| 60 | +`-Dmsvc14x-parallel-installable=false` to the Meson options or pass |
| 61 | +`USE_COMPAT_LIBS=1` in the NMake commandline to override, recommended only if |
| 62 | +rebuilding items using libxml++ is inconvenient): |
| 63 | + * NMake: |
| 64 | + * 2017: `VSVER=15`, `xml++-vc141-4_0.[dll|pdb|lib]` |
| 65 | + * 2019: `VSVER=16`, `xml++-vc142-4_0.[dll|pdb|lib]` |
| 66 | + * 2022: `VSVER=17`, `xml++-vc143-4_0.[dll|pdb|lib]` |
| 67 | + * Meson: |
| 68 | + * 2017: `VSVER=15`, `xml++-vc141-4.0-1[dll|pdb]`, `xml++-vc141-4.0.lib` |
| 69 | + * 2019: `VSVER=16`, `xml++-vc142-4.0-1[dll|pdb]`, `xml++-vc142-4.0.lib` |
| 70 | + * 2022: `VSVER=17`, `xml++-vc143-4.0-1[dll|pdb]`, `xml++-vc143-4.0.lib` |
| 71 | + |
| 72 | + |
| 73 | +### NMake Builds |
| 74 | +* Note that `$(Platform)` refers to the following: |
| 75 | + * `$(Platform)` |
| 76 | + * AMD64/x86_64/x64: `x64` |
| 77 | + * ARM64/aarch64: `arm64` |
| 78 | + * x86/i686: `Win32` |
| 79 | + |
| 80 | +* Run the following: |
| 81 | +``` |
| 82 | +cd $(srcroot)\MSVC_NMake |
| 83 | +# Run "nmake /f Makefile.vc" to see to see what options are supported by |
| 84 | +# the NMake Makefiles |
| 85 | +# INCLUDEDIR is by default $(PREFIX)\include, and LIBDIR is by default |
| 86 | +# $(PREFIX)\lib. PREFIX is by default $(srcroot)\..\vs$(VSVER\$(Platform). |
| 87 | +# $(some_dir_1) and $(some_dir_2) refer to the sample layout listed above. |
| 88 | +
|
| 89 | +nmake /f Makefile.vc CFG=[debug|release] [PREFIX=...] [INCLUDEDIR=$(some_dir_1)\include] [LIBDIR=$(some_dir_2)\lib] |
| 90 | +``` |
| 91 | +* The following targets are supported (only DLL builds are supported out of the |
| 92 | +box with the NMake Makefiles): |
| 93 | + * `all`, `libxmlxx_examples` (or nothing passed in): The libxml++ library as |
| 94 | +a DLL with the example programs |
| 95 | + * `tests`: The libxml++ library as a DLL with the test programs |
| 96 | + |
| 97 | +### Meson builds |
| 98 | +Please also see [README.md](../README.md) for further details. |
| 99 | + |
| 100 | +* For Visual Studio builds, it is also recommended that CMake is installed and |
| 101 | +can be found in `%PATH%`, so that it can help with finding an installed libxml2 |
| 102 | +or build libxml2 alongside with libxml++ if it is not previously installed. |
| 103 | + |
| 104 | +* If libxml2 is installed, you will most probably need to add its include |
| 105 | +directory to `%INCLUDE%` and its library path to `%LIB%`, as described earlier. |
| 106 | + |
| 107 | +* glibmm and libsigc++ should also be built with Meson, so that the pkg-config |
| 108 | +files for them, which are required, are generated, and the locations of these |
| 109 | +pkg-config files should be set by `--pkg-config-path=...` if `pkg-config` (or |
| 110 | +compatible tool) cannot locate them automatically. |
| 111 | + |
| 112 | + |
| 113 | +Cedric Gustin |
| 114 | +01/26/2005 |
| 115 | + |
| 116 | +Armin Burgmeier |
| 117 | +10/03/2010 |
| 118 | + |
| 119 | +Chun-wei Fan |
| 120 | +06/12/2020, updated 07/05/2023 |
0 commit comments