diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2021-03-01 23:52:25 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2021-03-01 23:52:25 +0000 |
commit | 3231dd361992715ca728253fd35f2bbfb3ee9f4b (patch) | |
tree | 4bc8441aa61848d9e5b3657afa4692b497b5b734 /Doc | |
parent | 5329fdf7a19e77ebf3c5f3dad2a36876451ff30a (diff) | |
parent | f0bf789db098f3730e859a778be3ec29fb4b7f7e (diff) | |
download | swig-3231dd361992715ca728253fd35f2bbfb3ee9f4b.tar.gz |
Merge branch 'windows-cmake-doc'
* windows-cmake-doc:
Remove duplicate and update to nuget installs
Remove duplicate section
Add link on main Contents page
Add CMake build steps on Windows
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/Manual/Contents.html | 3 | ||||
-rw-r--r-- | Doc/Manual/Windows.html | 71 |
2 files changed, 72 insertions, 2 deletions
diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 79ffdd50e..59378c50b 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -1,4 +1,4 @@ - + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> <HEAD> @@ -98,6 +98,7 @@ <li><a href="Windows.html#Windows_mingw_msys">Building swig.exe using MinGW and MSYS</a> <li><a href="Windows.html#Windows_cygwin">Building swig.exe using Cygwin</a> <li><a href="Windows.html#Windows_building_alternatives">Building swig.exe alternatives</a> +<li><a href="Windows.html#Windows_cmake">Building swig.exe using CMake</a> </ul> <li><a href="Windows.html#Windows_examples_cygwin">Running the examples on Windows using Cygwin</a> </ul> diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index f6f0d16df..065da215d 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -1,4 +1,4 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Getting started on Windows</title> @@ -36,6 +36,7 @@ <li><a href="#Windows_mingw_msys">Building swig.exe using MinGW and MSYS</a> <li><a href="#Windows_cygwin">Building swig.exe using Cygwin</a> <li><a href="#Windows_building_alternatives">Building swig.exe alternatives</a> +<li><a href="#Windows_cmake">Building swig.exe using CMake</a> </ul> <li><a href="#Windows_examples_cygwin">Running the examples on Windows using Cygwin</a> </ul> @@ -364,6 +365,74 @@ SWIG. For example, all the source code files can be added to a Visual C++ projec file in order to build swig.exe from the Visual C++ IDE. </p> +<H4><a name="Windows_cmake">3.3.1.4 Building swig.exe using CMake</a></H4> + + +<p> +SWIG can also 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>. +</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 + for .NET, but allows us to easily install <a href="https://www.pcre.org/">PCRE</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> + 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> + 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 + </li> + <li> + Install PCRE using Nuget using the following command: <pre>C:\Tools\nuget install pcre -Version 8.33.0.1 -OutputDirectory C:\Tools\pcre</pre> + </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 + </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:\Tools\pcre\pcre.8.33.0.1\build\native +SET PCRE_PLATFORM=x64 +cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX="%CD:\=/%/install2" -DCMAKE_C_FLAGS="/DPCRE_STATIC" -DPCRE_INCLUDE_DIR=%PCRE_ROOT%/include -DPCRE_LIBRARY=%PCRE_ROOT%/lib/v110/%PCRE_PLATFORM%/Release/static/utf8/pcre8.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> +</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 step through one of the sample .i files included with the SWIG source use the following: +</p> +<div class="shell"> + <pre>-python -py3 -shadow -o C:\Temp\doxygen_parsing.c C:\swig\Examples\test-suite\doxygen_parsing.i</pre> +</div> <H3><a name="Windows_examples_cygwin">3.3.2 Running the examples on Windows using Cygwin</a></H3> |