|
| 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 | +* Install libxml2 from https://xmlsoft.org/, either via Windows binaries or |
| 7 | +building from source, using NMake or CMake. It is strongly recommended, if |
| 8 | +building libxml2 from source, that Visual Studio 2015 or later is used. |
| 9 | +* Add libxml2's include path to `%INCLUDE%` and its library path to `%LIB%`, or |
| 10 | +placing the dependencies like the following: |
| 11 | +``` |
| 12 | +$(some_dir_1)\include |
| 13 | + | |
| 14 | + --libxml2\libxml\*.h |
| 15 | + | |
| 16 | + --(headers of libraries libxml2 depends on, such as ZLib, liblzma...) |
| 17 | +
|
| 18 | +$(some_dir_2)\lib |
| 19 | + | |
| 20 | + --libxml2.lib |
| 21 | + | |
| 22 | + --(.lib's of libraries that libxml2 depends on, such as ZLib, liblzma) |
| 23 | +``` |
| 24 | +* You need libxml2's DLL and all of its dependent DLLs in `%PATH%` if linking |
| 25 | +against a DLL build of libxml2 in order to run the tests. |
| 26 | + |
| 27 | +* Notice that for the built DLL and .lib the Visual Studio version is no |
| 28 | +longer `vc$(VSVER)0`, but is named like the following (Visual Studio version), |
| 29 | +to follow what is done in other C++ libraries such as Boost (use |
| 30 | +`-Dmsvc14x-parallel-installable=false` to the Meson options or pass |
| 31 | +`USE_COMPAT_LIBS=1` in the NMake commandline to override, recommended only if |
| 32 | +rebuilding items using libxml++ is inconvenient): |
| 33 | + * NMake: |
| 34 | + * 2017: `VSVER=15`, `xml++-vc141-5_0.[dll|pdb|lib]` |
| 35 | + * 2019: `VSVER=16`, `xml++-vc142-5_0.[dll|pdb|lib]` |
| 36 | + * 2022: `VSVER=17`, `xml++-vc143-5_0.[dll|pdb|lib]` |
| 37 | + * Meson: |
| 38 | + * 2017: `VSVER=15`, `xml++-vc141-5.0-1[dll|pdb]`, `xml++-vc141-5.0.lib` |
| 39 | + * 2019: `VSVER=16`, `xml++-vc142-5.0-1[dll|pdb]`, `xml++-vc142-5.0.lib` |
| 40 | + * 2022: `VSVER=17`, `xml++-vc143-5.0-1[dll|pdb]`, `xml++-vc143-5.0.lib` |
| 41 | + |
| 42 | + |
| 43 | +### NMake Builds |
| 44 | +* Note that `$(Platform)` refers to the following: |
| 45 | + * `$(Platform)` |
| 46 | + * AMD64/x86_64/x64: `x64` |
| 47 | + * ARM64/aarch64: `arm64` |
| 48 | + * x86/i686: `Win32` |
| 49 | + |
| 50 | +* Run the following: |
| 51 | +``` |
| 52 | +cd $(srcroot)\MSVC_NMake |
| 53 | +# Run "nmake /f Makefile.vc" to see to see what options are supported by |
| 54 | +# the NMake Makefiles |
| 55 | +# INCLUDEDIR is by default $(PREFIX)\include, and LIBDIR is by default |
| 56 | +# $(PREFIX)\lib. PREFIX is by default $(srcroot)\..\vs$(VSVER\$(Platform). |
| 57 | +# $(some_dir_1) and $(some_dir_2) refer to the sample layout listed above. |
| 58 | +
|
| 59 | +nmake /f Makefile.vc CFG=[debug|release] [PREFIX=...] [INCLUDEDIR=$(some_dir_1)\include] [LIBDIR=$(some_dir_2)\lib] |
| 60 | +``` |
| 61 | +* The following targets are supported (only DLL builds are supported out of the |
| 62 | +box with the NMake Makefiles): |
| 63 | + * `all`, `libxmlxx_examples` (or nothing passed in): The libxml++ library as |
| 64 | +a DLL with the example programs |
| 65 | + * `tests`: The libxml++ library as a DLL with the test programs |
| 66 | + |
| 67 | +### Meson builds |
| 68 | +Please also see [README.md](../README.md) for further details. |
| 69 | + |
| 70 | +For Visual Studio builds, it is also recommended that CMake is installed and can |
| 71 | +be found in `%PATH%`, so that it can help with finding an installed libxml2, or |
| 72 | +build libxml2 alongside with libxml++ if it is not previously installed. If |
| 73 | +libxml2 is installed, you will most probably need to add its include directory |
| 74 | +to `%INCLUDE%` and its library path to `%LIB%`, as described earlier. |
| 75 | + |
| 76 | + |
| 77 | +Cedric Gustin |
| 78 | +01/26/2005 |
| 79 | + |
| 80 | +Armin Burgmeier |
| 81 | +10/03/2010 |
| 82 | + |
| 83 | +Chun-wei Fan |
| 84 | +06/12/2020, updated 07/05/2023 |
0 commit comments