diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index a6e0d7473..b225911bd 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -230,72 +230,69 @@ SWIG can also be compiled and run using MSYS2 SWIG can be built using CMake 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 Appveyor YAML file. +For fully working build steps always check the Continuous Integration (CI) setups currently detailed in the Appveyor YAML file.

  1. - Install Nuget from https://www.nuget.org/downloads (v5.8.1 is used in this example, and installed to C:\Tools). Nuget is the package manager + Install Nuget from https://www.nuget.org/downloads (v6.0.0 is used in this example, and installed to C:\Tools). Nuget is the package manager for .NET, but allows us to easily install CMake and other dependencies required by SWIG.
  2. - Install CMake using the following command:
    C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
    + Install CMake-win64 Nuget package using the following command:
    C:\Tools\nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
    Alternatively you can download CMake from https://cmake.org/download/.
  3. - Install Bison using the following command:
    C:\Tools\nuget install bison-win32 -Version 2.4.1.1 -OutputDirectory C:\Tools\bison
    + Install the Bison Nuget package using the following command:
    C:\Tools\nuget install bison-win32 -Version 2.4.1.1 -OutputDirectory C:\Tools\bison
    Alternatively download Bison from https://sourceforge.net/projects/gnuwin32/files/bison/ (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. C:\Tools\Bison
  4. - Install PCRE2 using the following commands: -
    -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
    -
    -Alternatively, use WITH_PCRE 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 PCRE2 to C:\Tools\pcre2 using the following commands: +
    +        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
    + Alternatively, set WITH_PCRE=OFF to disable PCRE2 support if you are sure you do not require it.
  5. 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
    git clone https://github.com/swig/swig.git
    - 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 C:\swig +
  6. +
  7. +

    + 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 "Visual Studio 16 2019 -A x64" to the relevant + Visual Studio Generator 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 C:/swig/install2/bin folder. +

    +
    +
    +    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" ^
    +    -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
- -

- We are assuming Visual Studio 2017 is installed. For other versions of Visual Studio change "Visual Studio 15 2017 Win64" to the relevant - Visual Studio Generator. - 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. -

- -
-
-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
-
-
-

In addition to Release builds you can create a Debug build using:

-
cmake --build . --config Debug
+
cmake --build build --config Debug

- 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 Properties > Debugging > Command Arguments. For example to debug one of the test-suite .i files included with the SWIG source use the following:

-python -c++ -o C:\Temp\doxygen_parsing.cpp C:\swig\Examples\test-suite\doxygen_parsing.i