summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-01-27 20:30:12 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-01-27 20:30:12 +0000
commitc886c96316355c36dfc50466bfb0db6e988c68e2 (patch)
tree5532e4a9cef7b37f9fbf963d381d219f22e8332f
parentcb1c60e3d89afeb976b0e03c0c5c8d2d78d1dd5c (diff)
parent720397baba58a81a82ee2fa36406346108217b57 (diff)
downloadswig-c886c96316355c36dfc50466bfb0db6e988c68e2.tar.gz
Merge branch 'cmake-docs'
* cmake-docs: Add CXX flag Updated and verified CMake build docs
-rw-r--r--Doc/Manual/Windows.html79
1 files changed, 38 insertions, 41 deletions
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index a6e0d7473..cba1db3dd 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -230,72 +230,69 @@ SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</
<p>
SWIG can be built using <a href="https://cmake.org/">CMake</a> and Visual Studio rather than autotools. As with the other approaches to
building SWIG the dependencies need to be installed. The steps below are one of a number of ways of installing the dependencies without requiring Cygwin or MinGW.
-For fully working build steps always check the Continuous Integration setups currently detailed in the <a href="https://github.com/swig/swig/blob/master/appveyor.yml">Appveyor YAML file</a>.
+For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the <a href="https://github.com/swig/swig/blob/master/appveyor.yml">Appveyor YAML file</a>.
</p>
<ol>
<li>
- Install Nuget from <a href="https://www.nuget.org/downloads">https://www.nuget.org/downloads</a> (v5.8.1 is used in this example, and installed to C:\Tools). Nuget is the package manager
+ Install Nuget from <a href="https://www.nuget.org/downloads">https://www.nuget.org/downloads</a> (v6.0.0 is used in this example, and installed to <tt>C:\Tools</tt>). Nuget is the package manager
for .NET, but allows us to easily install <a href="https://cmake.org/">CMake</a> and other dependencies required by SWIG.
</li>
<li>
- Install CMake using the following command: <pre>C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake</pre>
+ Install <a href="https://www.nuget.org/packages/CMake-win64/">CMake-win64 Nuget package</a> using the following command: <pre>C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake</pre>
Alternatively you can download CMake from <a href="https://cmake.org/download/">https://cmake.org/download/</a>.
</li>
<li>
- Install Bison using the following command: <pre>C:\Tools\nuget install bison-win32 -Version 2.4.1.1 -OutputDirectory C:\Tools\bison</pre>
+ Install the <a href="https://www.nuget.org/packages/bison-win32/">Bison Nuget package</a> using the following command: <pre>C:\Tools\nuget install bison-win32 -Version 2.4.1.1 -OutputDirectory C:\Tools\bison</pre>
Alternatively download Bison from <a href="https://sourceforge.net/projects/gnuwin32/files/bison/">https://sourceforge.net/projects/gnuwin32/files/bison/</a> (2.4.1 is used in this example)
- and save to a folder e.g. C:\Tools\Bison
+ and save to a folder e.g. <tt>C:\Tools\Bison</tt>
</li>
<li>
- Install PCRE2 using the following commands:
-<div class="shell"><pre>
-git clone https://github.com/PhilipHazel/pcre2.git
-cd pcre2
-cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=C:/pcre .
-cmake --build . --config Release --target install
-</pre></div>
-Alternatively, use <tt>WITH_PCRE</tt> option to disable PCRE2 support if you are sure not to need it.
+ Unfortunately, PCRE2 is not yet available on Nuget. Instead we will use CMake to build and install <a href="https://www.pcre.org/">PCRE2</a> to <tt>C:\Tools\pcre2</tt> using the following commands:
+ <div class="shell"><pre>
+ cd C:\
+ SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;%PATH%
+ git clone https://github.com/PhilipHazel/pcre2.git
+ cd pcre2
+ cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX=C:/Tools/pcre2 -S . -B build
+ cmake --build build --config Release --target install</pre></div>
+ Alternatively, set <tt>WITH_PCRE=OFF</tt> to disable PCRE2 support if you are sure you do not require it.
</li>
<li>
We will also need the SWIG source code. Either download a zipped archive from GitHub, or if git is installed clone the latest codebase
using <pre>git clone https://github.com/swig/swig.git</pre>
- In this example we are assuming the source code is available at C:\swig
+ In this example we are assuming the source code is available at <tt>C:\swig</tt>
+ </li>
+ <li>
+ <p>
+ Now we have all the required dependencies we can build SWIG using the commands below. We are assuming Visual Studio 2019 is installed. For other versions of Visual Studio change <tt>"Visual Studio 16 2019 -A x64"</tt> to the relevant
+ <a href="https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators">Visual Studio Generator</a> and
+ architecture. We add the required build tools to the system PATH, and then
+ build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in the <tt>C:/swig/install2/bin</tt> folder.
+ </p>
+ <div class="shell">
+ <pre>
+ cd C:\swig
+ SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\bison-win32.2.4.1.1\tools\native\bin;%PATH%
+ SET PCRE_ROOT=C:/Tools/pcre2
+ SET PCRE_PLATFORM=x64
+ cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^
+ -DCMAKE_CXX_FLAGS="/DPCRE2_STATIC" -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8-static.lib -S . -B build
+ cmake --build build --config Release --target install
+
+ REM to test the exe
+ cd install2/bin
+ swig.exe -help</pre></div>
</li>
</ol>
-
-<p>
- We are assuming Visual Studio 2017 is installed. For other versions of Visual Studio change <i>"Visual Studio 15 2017 Win64"</i> to the relevant
- <a href="https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html#visual-studio-generators">Visual Studio Generator</a>.
- Now we have all the required dependencies we can build SWIG using the commands below. We add the required build tools to the system PATH, and then
- build a Release version of SWIG. If all runs successfully a new swig.exe should be generated in a /Release folder.
-</p>
-
-<div class="shell">
- <pre>
-cd C:\swig
-SET PATH=C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\bison-win32.2.4.1.1\tools\native\bin;%PATH%
-SET PCRE_ROOT=C:/pcre
-SET PCRE_PLATFORM=x64
-cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE2_STATIC" ^
- -DPCRE2_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE2_LIBRARY=%PCRE_ROOT%/lib/pcre2-8.lib .
-cmake --build . --config Release
-
-REM to test the exe
-cd /Release
-swig.exe -help
-</pre>
-</div>
-
<p>
In addition to Release builds you can create a Debug build using:
</p>
<div class="shell">
- <pre>cmake --build . --config Debug</pre>
+ <pre>cmake --build build --config Debug</pre>
</div>
<p>
- A Visual Studio solution file should be generated named swig.sln. This can be opened and debugged by running the swig project and setting the
- Debugging Command Arguments. For example to debug one of the test-suite .i files included with the SWIG source use the following:
+ A Visual Studio solution file should be generated named swig.sln. This can be opened and debugged by running the swig project and setting <tt>Properties > Debugging > Command Arguments</tt>. For example to debug one of the test-suite .i files included with the SWIG source use the following:
</p>
<div class="shell">
<pre>-python -c++ -o C:\Temp\doxygen_parsing.cpp C:\swig\Examples\test-suite\doxygen_parsing.i</pre>