building SWIG on Windows with CMake (and Visual Studio)
<[email protected]> Mon, 19 Jul 2021 15:35:58 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <[email protected]> |
Dear all
I've just successfully build current SWIG master via CMake on Windows 10,
using Visual Studio 2019. I thought others might be interested in this so
post it here.
This instructions are a bit more complicated as hoped by still simpler than
Getting started on Windows (swig.org)
<http://swig.org/Doc4.0/Windows.html#Windows_swig_exe> .
- install sed and bison. I used Gnuwin32 set-up utilities from
http://gnuwin32.sourceforge.net/packages/m4.htm (which actually installs
sed+m4) and http://gnuwin32.sourceforge.net/packages/bison.htm. Install into
a directory without spaces (e.g. c:\users\yourname\Gnuwin32)
- build PCRE
- get latest pcre-* source from https://ftp.pcre.org/pub/pcre/ (I used
8.45). (Do not use pcre2*).
- Use CMake to configure:
- set BUILD_SHARED_LIBS=ON or you will get linking errors (missing
symbol imp_pcre...)
- best to set CMAKE_INSTALL_PREFIX to a directory where you have write
permission
- build Release version and INSTALL
- For old SWIG versions, do "pip install 2to3"
- add both c:\users\yourname\Gnuwin32\bin and the "bin" sub-directory where
you set CMAKE_INSTALL_PREFIX to your (user) path via the System Properties
control panel
- build SWIG
- run CMake
- best to set CMAKE_INSTALL_PREFIX to same directory as used for PCRE
- probably will have to set PCRE_INCLUDE_DIR and PCRE_LIBRARY (point
the latter to .../pcre.lib)
- set BISON_EXECUTABLE if not found
- build and INSTALL (probably you want to use Release as well)
(note: adding the PCRE CMAKE_INSTALL_PREFIX/bin to your path is necessary as
you will need directory where pcre.dll is in your path for SWIG to run).
Kris
_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user