README.md
1# Microsoft Windows build scripts
2
3**Currently supported build systems:**
4
5* msbuild
6* nmake
7
8## msbuild
9
10msbuild or regular Microsoft Visual Studio solutions / projects are represented as
11\*.sln and \*.vcxproj files. The solution file is capable to build release or debug
12version of sasl2.dll. Sasl plugins are splitted into two sets. Some of them will be
13statically linked into sasl2.dll and others have separate solution files. This is
14done to simplify configuration and compilation with 3rdparty tools like Conan
15package manager. And there are some plugins which won't be compiled at all at the
16moment but may be support for them will be added later.
17
18There are 3 solution files:
19
20* **core** builds sasl2.dll with some static plugins included.
21* **sasldb** builds sasldb library and corresponding dynamic plugin
22* **gssapi** builds gssapi dynamic plugin
23
24**IMPORTANT:** Only x64 configuration was tested with current Visual Studio projects.
25
26#### Dependencies
27
28Pay attention to cyrus-sasl.props file and its SaslDependencyRoot property.
29It's where it's looking for dependencies. You can put your OpenSSL installation in there as well
30as any other dependency. Just make sure it's exacty in "lib" and "include" directories to make
31it compile
32
33**core** solution depends only on OpenSSL. You can change openssl.props file if putting
34OpenSSL into SaslDependencyRoot is not an option for you. In this case openssl.props may look
35something like this
36
37```xml
38<?xml version="1.0" encoding="utf-8"?>
39<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
40 <ImportGroup Label="PropertySheets" />
41 <PropertyGroup Label="UserMacros" />
42 <ItemDefinitionGroup>
43 <ClCompile>
44 <AdditionalIncludeDirectories>C:\path\to\openssl\install\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
45 </ClCompile>
46 <Link>
47 <AdditionalLibraryDirectories>C:\path\to\openssl\install\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
48 <AdditionalDependencies>libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies>
49 </Link>
50 </ItemDefinitionGroup>
51 <ItemGroup />
52</Project>
53```
54In any case it's required to point to the correct name of the OpenSSL library (see libeay32.lib).
55Also make sure previous values are preserved by including `%(something)` as in the example above.
56
57---
58
59**sasldb** solution depends on [LMDB](https://github.com/LMDB/lmdb) library. Again you can
60play with cyrus-sasl.props and its SaslDependencyRoot or just change paths and libs to
61whatever you want in [sasldb.props](sasldb.props). If the version from upstream repository doesn't build
62for you (even from stable branches), you can try next fork https://github.com/Ri0n/lmdb
63
64---
65
66**gssapiv2** plugin depends on one of Kerberos realization. But only MIT Kerberos was tested with msbuild.
67As always put dependencies to the location pointed by cyrus-sasl.props or change gssapiv2 project file.
68
69#### Compilation
70
71Basically there 3 ways to compile with msbuild.
72
731. Just open any of solution files in Visual Studio and build it (assuming the dependency are
74 already in correct locations)
752. Use msbuild command line util (pretty much the same as 1 but from command line)
763. Use [Conan package manager](https://conan.io) (will download dependencies from a cloud and build just cyrus-sasl.
77 Or after the sources will be built automatically on CI, so one can just download binaries)
78
79Regarding solution files there are to options:
80
811. cyrus-sasl-all-in-one.sln builds everything and depends on everything
822. cyrus-sasl-*.sln (other sln files) build something specific.
83 * cyrus-sasl-core.sln builds sasl2 library with some static plugins included
84 * cyrus-sasl-common.sln builds just common library useful for plugins development
85 * cyrus-sasl-sasldb.sln builds sasldb library and corresponding plugin
86 * cyrus-sasl-gssapiv2.sln builds gssapiv2 plugin
87
88Build with Conan is not that hard too. I need it installed and added to PATH,
89then from console in one of win32\conan subdirectory try something like
90
91```cmd
92> conan create . yourname/stable
93```
94For more information about Conan please read their
95[documentation](https://docs.conan.io/en/latest)
96
97#### Questions
98
99The Visual Studio solution, project files and property sheets were
100written by [Sergey Ilinykh](mailto:rion4ik@gmail.com).
101Feel free to mail and ask questions.
102
103## nmake
104
105TBD
106
107nmake makefiles weren't updated for awhile and most likely won't build.