From 896e8d8654694f6e6225fd9a9757652484775ada Mon Sep 17 00:00:00 2001
From: sethg
+Note that SWIG can also be built using Cygwin. +However, SWIG will then require the Cygwin DLL when executing. +Follow the Unix instructions in the README file in the SWIG root directory. +Note that the Cygwin environment will also allow one to regenerate the autotool generated files which are supplied with the release distribution. +These files are generated using the autogen.sh script and will only need regenerating in circumstances such as changing the build system. +
+ ++If you don't want to install Cygwin or MinGW, use a different compiler to build +SWIG. For example, all the source code files can be added to a Visual C++ project +file in order to build swig.exe from the Visual C++ IDE. +
+ ++SWIG can also 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. +
+ +C:\Tools\nuget install pcre -Verbosity quiet -Version 8.33.0.1 -OutputDirectory C:\pcre+
git clone https://github.com/swig/swig.git+ In this example we are assuming the source code is available at C:\swig +
+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. +
+ ++cd C:\swig +SET PATH=C:\Tools\cmake-3.19.4-win64-x64\bin;C:\Tools\Bison\bin;%PATH% +PCRE_ROOT=C:/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 -DBISON_EXECUTABLE=C:/Tools/Bison/bin/bison.exe . +cmake --build . --config Release ++
+ If all runs successfully a new swig.exe should be generated in a /Release folder. + In addition to Release builds you can create a Debug build using: +
+cmake --build . --config Debug+
+ A Visual Studio solution file should be generated - 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: +
+-python -py3 -shadow -o C:\Temp\doxygen_parsing.c C:\swig\Examples\test-suite\doxygen_parsing.i+