On a 64-bit computer, install <externalLink><linkText>msys2-x86_64-20161025.exe</linkText><linkUri>https://github.com/MachineCognitis/Math.Gmp.Native/blob/master/Math.Gmp.Native/Dependencies/</linkUri><linkTarget>_self</linkTarget></externalLink>,
and on a 32-bit computer, install <externalLink><linkText>msys2-i686-20161025.exe</linkText><linkUri>https://github.com/MachineCognitis/Math.Gmp.Native/tree/master/Math.Gmp.Native/Dependencies/</linkUri><linkTarget>_self</linkTarget></externalLink>.
You can also check for a more recent version of MSYS2 <externalLink><linkText>here</linkText><linkUri>https://github.com/msys2/msys2/wiki/MSYS2-installation</linkUri></externalLink>.
Install MSYS2 to its default location.
</para>
<para>
After installation, you need to updates MSYS2 packages. From the Windows Start Menu, start <command>MSYS2 MSYS</command>. In the shell command window,
enter the command:
</para>
<list class="nobullet">
<listItem>
<para>
<userInput>pacman -Syuu</userInput>
</para>
</listItem>
</list>
<para>
and follow instructions.
You will have to close the command window, reopen a new one, and reenter the command <userInput>pacman -Syuu</userInput>.
</para>
<para>
Finally, in order to build software, you need to install a number of packages with the command:
On a 64-bit computer, copy <externalLink><linkText>yasm-1.3.0-win64.exe</linkText><linkUri>https://github.com/MachineCognitis/Math.Gmp.Native/blob/master/Math.Gmp.Native/Dependencies/</linkUri><linkTarget>_self</linkTarget></externalLink>
to <localUri>C:\msys64\usr\bin</localUri>, and rename it to <localUri>yasm.exe</localUri>.
</para>
<para>
Similarly on a 32-bit computer, copy <externalLink><linkText>yasm-1.3.0-win32.exe</linkText><linkUri>https://github.com/MachineCognitis/Math.Gmp.Native/blob/master/Math.Gmp.Native/Dependencies/</linkUri><linkTarget>_self</linkTarget></externalLink>
to <localUri>C:\msys32\usr\bin</localUri>, and rename it to <localUri>yasm.exe</localUri>.
The <userInput>--prefix</userInput> specifies the install folder.
Note that the Windows <localUri>C:\</localUri> drive is specified as the root <localUri>/C/</localUri> folder in the <command>MinGW</command> window.
Note also that the <userInput>configure</userInput> and <userInput>make</userInput> commands are to be run against a fresly uncompressed GNU MP source.
The <userInput>make install</userInput> command creates <localUri>libgmp-10.dll</localUri> in the <localUri>C:\Temp\x86</localUri> and <localUri>C:\Temp\x64</localUri> folders.
These two compiled versions of the GNU MP library are to be copied to the <localUri>x86</localUri> and <localUri>x64</localUri> folders of the <localUri>Math.Gmp.Native</localUri> Visual Studio projects.
They can also be copied directly into the <localUri>x86</localUri> and <localUri>x64</localUri> folders of the <localUri>bin/Debug</localUri> or <localUri>bin/Release</localUri> folders.
</para>
<para>
The 32-bit and 64-bit <userInput>make check</userInput> commands generate some warnings, but all tests passed successfully.
</para>
</listItem>
</list>
</content>
</section>
<section>
<title>Building the GNU MP Library for a Specific CPU Type on Windows</title>
<content>
<para>
The <userInput>--enable-fat</userInput> build option above creates a library where optimized low level subroutines are chosen at runtime according to the CPU detected.
By using instead the <userInput>--host</userInput> option, you can build a library for a specific CPU type.
You will end up with a library that runs only on that CPU type, but the library will be samller.
<title>Using the GNU MP Library in a Visual Studio C++ Project</title>
<content>
<para>
Although our main goal was to compile GNU MP in order to use it from .NET, the compiled 32-bit and 64-bit GNU MP libraries may be used directly in Visual Studio C++ projects.
For example, create a default Visual Studio C++ Console Application.
Set the <system>Platform</system> to <system>x64</system>.
Copy from the <localUri>C:\Temp\x64</localUri> folder the files <localUri>include\gmp.h</localUri>, <localUri>bin\libgmp-10.dll</localUri>, and <localUri>lib\libgmp.dll.a</localUri> to the Visual Studio C++ project folder.
Include <localUri>gmp.h</localUri> in your C++ source file.
In the <system>Linker</system>, <system>Input Property Page</system> of the project, add <localUri>libgmp.dll.a</localUri> to the <system>Additional Dependencies</system>.
Build your C++ project, and copy <localUri>libgmp-10.dll</localUri> to the output <localUri>bin</localUri> folder.
Run your application.
</para>
<para>
See <externalLink><linkText>ConsoleApplication12.zip</linkText><linkUri>https://github.com/MachineCognitis/Math.Gmp.Native/blob/master/Math.Gmp.Native/Dependencies/</linkUri><linkTarget>_self</linkTarget></externalLink>