mirror of https://github.com/swig/swig
Merge branch 'master' into C
This commit is contained in:
commit
5dcb37310e
|
@ -1,4 +1,4 @@
|
|||
name: CI
|
||||
name: linux
|
||||
|
||||
on:
|
||||
push:
|
||||
|
@ -199,7 +199,9 @@ jobs:
|
|||
- SWIGLANG: scilab
|
||||
os: ubuntu-22.04 # scilab 6.1.1
|
||||
- SWIGLANG: scilab
|
||||
VER: '2023.0.0'
|
||||
VER: '2023.1.0'
|
||||
- SWIGLANG: scilab
|
||||
VER: '2024.1.0'
|
||||
- SWIGLANG: tcl
|
||||
# c++11 testing
|
||||
- SWIGLANG: csharp
|
|
@ -1,63 +0,0 @@
|
|||
name: Windows Nuget Build
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'CHANGES*'
|
||||
- 'Doc/**'
|
||||
- 'appveyor.yml'
|
||||
pull_request:
|
||||
branches: master
|
||||
paths-ignore:
|
||||
- 'CHANGES*'
|
||||
- 'Doc/**'
|
||||
- 'appveyor.yml'
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-2019
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: false
|
||||
submodules: recursive
|
||||
|
||||
- name: Install Dependencies
|
||||
shell: powershell
|
||||
run: |
|
||||
nuget install CMake-win64 -Version 3.15.5 -OutputDirectory C:\Tools\CMake
|
||||
nuget install Bison -Version 3.7.4 -OutputDirectory C:\Tools\bison
|
||||
nuget install PCRE2 -Version 10.39 -OutputDirectory C:\Tools\pcre2
|
||||
|
||||
- name: Build
|
||||
shell: powershell
|
||||
run: |
|
||||
$env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
|
||||
$PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
|
||||
$PCRE_PLATFORM="x64"
|
||||
$WORKING_DIR=(Get-Location).ToString() -replace "\\","/"
|
||||
cmake -G "Visual Studio 16 2019" -A "x64" `
|
||||
-DCMAKE_INSTALL_PREFIX="$WORKING_DIR/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
|
||||
|
||||
- name: Install
|
||||
shell: powershell
|
||||
run: |
|
||||
cmake --install build --config Release
|
||||
|
||||
- name: Test
|
||||
shell: powershell
|
||||
working-directory: install2/bin
|
||||
run: |
|
||||
swig.exe -version
|
|
@ -0,0 +1,94 @@
|
|||
name: windows-cmake
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'CHANGES*'
|
||||
- 'Doc/**'
|
||||
- 'appveyor.yml'
|
||||
pull_request:
|
||||
branches: master
|
||||
paths-ignore:
|
||||
- 'CHANGES*'
|
||||
- 'Doc/**'
|
||||
- 'appveyor.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
cmake:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
name: CMake VS ${{ matrix.VER }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- VER: '17 2022'
|
||||
os: 'windows-2022'
|
||||
- VER: '16 2019'
|
||||
os: 'windows-2019'
|
||||
|
||||
env:
|
||||
BUILD_SYS: Visual Studio ${{ matrix.VER }}
|
||||
|
||||
steps:
|
||||
- name: Machine Info
|
||||
shell: powershell
|
||||
run: |
|
||||
systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: true
|
||||
|
||||
- name: Install CCache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ matrix.os }}
|
||||
|
||||
- name: Install NuGet Packages
|
||||
shell: powershell
|
||||
run: |
|
||||
nuget install PCRE2 -OutputDirectory C:\Tools
|
||||
nuget install Bison -OutputDirectory C:\Tools
|
||||
|
||||
# https://cygwin.com/cygwin-ug-net/cygpath.html
|
||||
- name: Prepare Environment
|
||||
shell: bash
|
||||
run: |
|
||||
cat << EOF >> $GITHUB_ENV
|
||||
PCRE2_PATH=$(cygpath -w "$(ls -d /C/Tools/PCRE2*)")
|
||||
EOF
|
||||
BISON_PATH=$(cygpath -w "$(ls -d /C/Tools/Bison*)/bin")
|
||||
echo "$BISON_PATH" >> $GITHUB_PATH
|
||||
|
||||
- name: Configure
|
||||
shell: powershell
|
||||
run: |
|
||||
cmake --version
|
||||
cmake -G "$env:BUILD_SYS" -A x64 `
|
||||
-DCMAKE_INSTALL_PREFIX="C:\Tools\swig" `
|
||||
-DCMAKE_C_FLAGS="/W3 /EHsc /DPCRE2_STATIC" `
|
||||
-DCMAKE_CXX_FLAGS="/W3 /EHsc /DPCRE2_STATIC" `
|
||||
-DPCRE2_INCLUDE_DIR="$env:PCRE2_PATH\include" `
|
||||
-DPCRE2_LIBRARY="$env:PCRE2_PATH\lib\pcre2-8-static.lib" `
|
||||
-DLINK_FLAGS="/NODEFAULTLIB:MSVCRT" -S . -B .
|
||||
|
||||
- name: Build
|
||||
shell: powershell
|
||||
run: |
|
||||
cmake --build . --config Release
|
||||
|
||||
- name: Test
|
||||
shell: powershell
|
||||
run: |
|
||||
ctest --output-on-failure -V -C Release
|
||||
|
||||
- name: Install
|
||||
shell: powershell
|
||||
run: |
|
||||
cmake --install .
|
||||
C:\Tools\swig\bin\swig.exe -version
|
|
@ -0,0 +1,321 @@
|
|||
name: windows
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'CHANGES*'
|
||||
- 'Doc/**'
|
||||
- 'appveyor.yml'
|
||||
pull_request:
|
||||
branches: master
|
||||
paths-ignore:
|
||||
- 'CHANGES*'
|
||||
- 'Doc/**'
|
||||
- 'appveyor.yml'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
win_ci:
|
||||
# When continue-on-error is true for an individual build,
|
||||
# that build can fail (it'll show red),
|
||||
# but it won't fail the overall tests
|
||||
continue-on-error: ${{ matrix.continue-on-error || false }}
|
||||
|
||||
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md
|
||||
runs-on: ${{ matrix.os || 'windows-2022' }}
|
||||
|
||||
# The name of the test follow the tested language
|
||||
name: >
|
||||
${{ matrix.SWIGLANG }} ${{ matrix.VER }}
|
||||
${{ matrix.COMPILER || 'msvc' }} ${{ matrix.os }} ${{ matrix.NOTEST }}
|
||||
${{ matrix.continue-on-error && '(can fail)' }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- SWIGLANG: csharp
|
||||
INSTALL: 'true'
|
||||
- SWIGLANG: csharp
|
||||
os: 'windows-2019'
|
||||
- SWIGLANG: csharp
|
||||
COMPILER: gcc
|
||||
- SWIGLANG: csharp
|
||||
INSTALL: 'true'
|
||||
COMPILER: gcc
|
||||
os: 'windows-2019'
|
||||
- SWIGLANG: java
|
||||
VER: 8
|
||||
- SWIGLANG: java
|
||||
VER: 17
|
||||
- SWIGLANG: java
|
||||
COMPILER: gcc
|
||||
VER: 8
|
||||
- SWIGLANG: java
|
||||
COMPILER: gcc
|
||||
VER: 11
|
||||
- SWIGLANG: python
|
||||
VER: '3.7'
|
||||
- SWIGLANG: python
|
||||
VER: '3.12'
|
||||
# TODO require fixing of probing in configure.ac
|
||||
#- SWIGLANG: python
|
||||
# INSTALL: 'true'
|
||||
# COMPILER: gcc
|
||||
# NOTEST: 'no-test'
|
||||
- SWIGLANG: ruby
|
||||
# VER: '3.0.7'
|
||||
NOTEST: 'no-test'
|
||||
- SWIGLANG: ruby
|
||||
VER: '3.1.6'
|
||||
NOTEST: 'no-test'
|
||||
- SWIGLANG: ruby
|
||||
INSTALL: 'true'
|
||||
COMPILER: gcc
|
||||
NOTEST: 'no-test'
|
||||
# Run all of them, as opposed to aborting when one fails
|
||||
fail-fast: false
|
||||
|
||||
env:
|
||||
CFLAGS: '-O2'
|
||||
CXXFLAGS: '-O2'
|
||||
CCCL_OPTIONS: '--cccl-muffle /W3 /EHsc'
|
||||
PCRE2_CCCL_LD: '-lpcre2-8-static --cccl-link /NODEFAULTLIB:MSVCRT'
|
||||
CHECK_OPTIONS: 'CSHARPOPTIONS=-platform:x64'
|
||||
SWIGLANG: ${{ matrix.SWIGLANG }}
|
||||
COMPILER: ${{ matrix.COMPILER }}
|
||||
INSTALL: ${{ matrix.INSTALL }}
|
||||
NOTEST: ${{ matrix.NOTEST }}
|
||||
VER: ${{ matrix.VER }}
|
||||
OS: ${{ matrix.os }}
|
||||
|
||||
# cl.exe:
|
||||
# https://learn.microsoft.com//cpp/build/reference/compiler-options
|
||||
# /EHc extern "C" defaults to nothrow.
|
||||
# /EHs Enable C++ exception handling (no SEH exceptions).
|
||||
# /W3 Warning level.
|
||||
# /WX Treat warnings as errors.
|
||||
# https://learn.microsoft.com//cpp/build/reference/linker-options
|
||||
# cl.exe pass linker:
|
||||
# /VERBOSE:LIB Outputs progress messages during the link process.
|
||||
# /NODEFAULTLIB:lib Ignore library 'lib'
|
||||
|
||||
steps:
|
||||
- name: Machine Info
|
||||
shell: powershell
|
||||
run: |
|
||||
systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
show-progress: true
|
||||
|
||||
- name: Install CCache
|
||||
uses: hendrikmuhs/ccache-action@v1
|
||||
with:
|
||||
key: ${{ matrix.os || 'windows-2022' }}-${{ matrix.COMPILER || 'msvc' }}
|
||||
|
||||
- name: Install NuGet Packages
|
||||
if: ${{ env.COMPILER == '' }}
|
||||
shell: powershell
|
||||
run: |
|
||||
# 'nuget build for .NET: https://www.nuget.org/packages'
|
||||
nuget install PCRE2 -OutputDirectory C:\Tools
|
||||
nuget install boost -OutputDirectory C:\Tools
|
||||
|
||||
# Set MSVC compilers path and environment variables.
|
||||
- name: Setup MSVC
|
||||
if: ${{ env.COMPILER == '' || env.SWIGLANG == 'csharp' }}
|
||||
uses: TheMrMilchmann/setup-msvc-dev@v3
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Prepare Environment
|
||||
shell: bash
|
||||
run: |
|
||||
uname --all
|
||||
|
||||
if [[ "$COMPILER" = "gcc" ]]; then
|
||||
# MinGW-w64 packages to install with MSYS2
|
||||
for n in binutils make autotools pcre2 boost; do
|
||||
MORE_MSYS_PKGS+=" mingw-w64-x86_64-$n"
|
||||
done
|
||||
|
||||
case "$SWIGLANG" in
|
||||
python)
|
||||
MORE_MSYS_PKGS+=" mingw-w64-x86_64-python"
|
||||
;;
|
||||
ruby)
|
||||
MORE_MSYS_PKGS+=" mingw-w64-x86_64-ruby"
|
||||
;;
|
||||
perl)
|
||||
MORE_MSYS_PKGS+=" mingw-w64-x86_64-perl"
|
||||
;;
|
||||
esac
|
||||
|
||||
# MinGW-w64 pcre2
|
||||
echo "PCRE2_CFLAGS=-I/mingw64/include -DPCRE2_STATIC" >> $GITHUB_ENV
|
||||
echo "PCRE2_LIBS=-L/mingw64/lib -lpcre2-8" >> $GITHUB_ENV
|
||||
|
||||
echo "MORE_MSYS_PKGS=base-devel $MORE_MSYS_PKGS" >> $GITHUB_ENV
|
||||
echo "BOOST_PATH=/c/msys64/mingw64" >> $GITHUB_ENV
|
||||
else
|
||||
# COMPILER: cccl wrapping MSVC
|
||||
curl --retry 15 -s -L https://github.com/swig/cccl/raw/master/cccl > /usr/bin/cccl
|
||||
chmod +x /usr/bin/cccl
|
||||
cp -p /usr/bin/cccl /c/msys64/usr/bin/cccl
|
||||
|
||||
# Using pcre2 installed with NuGet
|
||||
PCRE2_PATH=$(ls -d /c/tools/PCRE2*)
|
||||
echo "PCRE2_CFLAGS=-I$PCRE2_PATH/include -DPCRE2_STATIC" >> $GITHUB_ENV
|
||||
echo "PCRE2_LIBS=-L$PCRE2_PATH/lib $PCRE2_CCCL_LD" >> $GITHUB_ENV
|
||||
|
||||
echo "CXX=/usr/bin/cccl" >> $GITHUB_ENV
|
||||
echo "CC=/usr/bin/cccl" >> $GITHUB_ENV
|
||||
echo "BOOST_PATH=$(ls -d /c/tools/boost*)/lib/native" >> $GITHUB_ENV
|
||||
|
||||
if [[ -n "$VER" ]]; then
|
||||
case "$SWIGLANG" in
|
||||
python)
|
||||
PY3VER=$(cygpath -w $(ls -d /c/hostedtoolcache/windows/Python/$VER*)/x64)
|
||||
echo "$PY3VER\\Script" >> $GITHUB_PATH
|
||||
echo "$PY3VER" >> $GITHUB_PATH
|
||||
;;
|
||||
ruby)
|
||||
RUBYDIR=$(cygpath -w $(ls -d /c/hostedtoolcache/windows/Ruby/$VER*)/x64)
|
||||
echo "$RUBYDIR\\bin" >> $GITHUB_PATH
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi # COMPILER
|
||||
|
||||
# Java must use VER!
|
||||
if [[ "$SWIGLANG" = "java" ]]; then
|
||||
declare -n java_path="JAVA_HOME_${VER}_X64"
|
||||
echo "JAVA_HOME=$java_path" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
echo "SWIGJOBS=-j$NUMBER_OF_PROCESSORS" >> $GITHUB_ENV
|
||||
|
||||
echo 'C:\msys64\usr\bin' >> $GITHUB_PATH
|
||||
|
||||
- name: Install MSYS2 Packages
|
||||
shell: cmd
|
||||
run: |
|
||||
rem 'MSYS2 uses MinGW-w64 https://packages.msys2.org/'
|
||||
pacman -Syu --noconfirm --needed
|
||||
if %ErrorLevel% NEQ 0 (exit 1)
|
||||
pacman -Syu --noconfirm --needed autoconf automake bison %MORE_MSYS_PKGS%
|
||||
if %ErrorLevel% NEQ 0 (exit 1)
|
||||
|
||||
- name: Autoconf
|
||||
shell: bash
|
||||
run: |
|
||||
uname --all
|
||||
|
||||
if [[ -z "$COMPILER" ]]; then
|
||||
which cl.exe
|
||||
cl.exe /? 2>&1 | head -n1
|
||||
else
|
||||
# Use MinGW-w64 compiler
|
||||
# We can not use GITHUB_PATH, as bash insert /usr/bin
|
||||
export PATH="/mingw64/bin:$PATH"
|
||||
|
||||
which gcc
|
||||
gcc --version | head -n1
|
||||
which g++
|
||||
g++ --version | head -n1
|
||||
fi
|
||||
|
||||
case "$SWIGLANG" in
|
||||
csharp)
|
||||
which csc.exe
|
||||
csc.exe /? | head -n1
|
||||
;;
|
||||
python)
|
||||
which python.exe
|
||||
python -V
|
||||
;;
|
||||
ruby)
|
||||
which ruby.exe
|
||||
ruby -v
|
||||
;;
|
||||
perl)
|
||||
which perl.exe
|
||||
perl -v | head -n3
|
||||
;;
|
||||
esac
|
||||
|
||||
make --version | head -n2
|
||||
|
||||
./autogen.sh
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$COMPILER" = "gcc" ]]; then
|
||||
# Use MinGW-w64 compiler
|
||||
export PATH="/mingw64/bin:$PATH"
|
||||
./configure --disable-dependency-tracking --with-boost="$BOOST_PATH" --with-csharp-compiler="csc.exe"
|
||||
else
|
||||
# cccl wrapping MSVC
|
||||
./configure --disable-dependency-tracking --with-boost="$BOOST_PATH" --with-csharp-compiler="csc.exe" --disable-ccache
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$COMPILER" = "gcc" ]]; then
|
||||
# Use MinGW-w64 compiler
|
||||
export PATH="/mingw64/bin:$PATH"
|
||||
fi
|
||||
|
||||
make -s $SWIGJOBS
|
||||
|
||||
# Test the Windows swig have a proper SWIG library path
|
||||
- name: Test swiglib
|
||||
shell: bash
|
||||
run: |
|
||||
# path is based on executable location
|
||||
if ! [[ "$(./swig.exe -swiglib)" = "$(cygpath -w "$PWD")\\Lib" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Test
|
||||
if: ${{ matrix.NOTEST == '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$COMPILER" = "gcc" ]]; then
|
||||
# Use MinGW-w64 compiler
|
||||
export PATH="/mingw64/bin:$PATH"
|
||||
fi
|
||||
./swig.exe -version
|
||||
make check-$SWIGLANG-version
|
||||
make check-$SWIGLANG-enabled
|
||||
make -k check-$SWIGLANG-examples $SWIGJOBS $CHECK_OPTIONS
|
||||
make -k check-$SWIGLANG-test-suite $SWIGJOBS $CHECK_OPTIONS
|
||||
|
||||
- name: Install
|
||||
if: ${{ env.INSTALL == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
make -s install > /dev/null
|
||||
|
||||
which swig.exe
|
||||
swig.exe -version
|
||||
|
||||
# TODO: Make install of ccache-swig do not work on Windows
|
||||
#if [[ "$COMPILER" = "gcc" ]]; then
|
||||
# which ccache-swig.exe
|
||||
# ccache-swig.exe -V
|
||||
#fi
|
||||
|
||||
# The test by itself is not related to the installation.
|
||||
# We just want to save testing time :-)
|
||||
- name: Clean
|
||||
if: ${{ env.INSTALL == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
make check-maintainer-clean
|
|
@ -46,6 +46,7 @@ pcre
|
|||
CCache/autom4te.cache/
|
||||
CCache/config.h.in
|
||||
CCache/configure
|
||||
CCache/configure~
|
||||
Source/Include/swigconfig.h.in
|
||||
Source/Include/swigconfig.h.in~
|
||||
Source/Makefile.in
|
||||
|
@ -59,6 +60,7 @@ Tools/config/ylwrap
|
|||
aclocal.m4
|
||||
autom4te.cache/
|
||||
configure
|
||||
configure~
|
||||
|
||||
# Generated by ./configure
|
||||
CCache/Makefile
|
||||
|
@ -121,7 +123,6 @@ Examples/test-suite/errors/*.py
|
|||
# C#
|
||||
Examples/test-suite/csharp/*/
|
||||
*runme.exe.mdb
|
||||
*runme.exe
|
||||
Examples/csharp/*/*.cs
|
||||
!Examples/csharp/*/runme.cs
|
||||
|
||||
|
|
|
@ -7,6 +7,30 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.3.0 (in progress)
|
||||
===========================
|
||||
|
||||
2024-07-15: vadz
|
||||
#2941 Suppress warning WARN_PARSE_USING_UNDEF for ignored using declarations.
|
||||
|
||||
2024-07-03: wsfulton
|
||||
#2860 Enhance Windows.html documentation for the popular Visual C++ compiler
|
||||
recommending users to correctly set the __cplusplus macro in order to benefit
|
||||
from modern standards based features that SWIG provides.
|
||||
|
||||
2024-07-02: erezgeva
|
||||
[Python, Ruby] #2870 Change the thread safety options for the director code
|
||||
that manages C++ director pointer ownership. Please define SWIG_THREADS to
|
||||
turn on thread safety. For Python, this can also be done via the threads
|
||||
module option or -threads. Implementation now includes a C++11 std::mutex option
|
||||
as priority over WIN32 and pthread mutexes. See director_guard.swg for further
|
||||
implementation details.
|
||||
|
||||
2024-06-28: vadz
|
||||
#2935 Fix instantiation of specialized template where the primary template
|
||||
is a forward class template declaration.
|
||||
|
||||
2024-06-16: wsfulton
|
||||
#2927 Don't ignore overloaded friend functions that are also declared
|
||||
constexpr.
|
||||
|
||||
2024-06-15: wsfulton
|
||||
[Python] Removed deprecated pytuplehlp.swg file and t_output_helper.
|
||||
Use SWIG_Python_AppendOutput instead of t_output_helper.
|
||||
|
|
|
@ -605,7 +605,7 @@ the examples will be run, by either running <tt>runme.exe</tt> or by running
|
|||
<tt>mono runme.exe</tt> (Mono C# compiler).
|
||||
Windows users can also get the examples working using a
|
||||
<a href="http://www.cygwin.com">Cygwin</a> or <a href="https://osdn.net/projects/mingw/">MinGW</a> environment for automatic configuration of the example makefiles.
|
||||
Any one of the C# compilers (Mono or Microsoft) can be detected from within a Cygwin or Mingw environment if installed in your path.
|
||||
Any one of the C# compilers (Mono or Microsoft) can be detected from within a Cygwin or MinGW environment if installed in your path.
|
||||
|
||||
<H2><a name="CSharp_type_mapping">23.3 Type mapping</a></H2>
|
||||
|
||||
|
|
|
@ -102,6 +102,10 @@
|
|||
</ul>
|
||||
</ul>
|
||||
<li><a href="Windows.html#Windows_interface_file">Microsoft extensions and other Windows quirks</a>
|
||||
<ul>
|
||||
<li><a href="Windows.html#Windows_msvc_cpp_standards">Visual C++ standards compliance</a>
|
||||
<li><a href="Windows.html#Windows_calling_conventions">Calling conventions</a>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- INDEX -->
|
||||
|
@ -558,7 +562,7 @@
|
|||
<li><a href="Typemaps.html#Typemaps_special_variables">Special variables</a>
|
||||
<ul>
|
||||
<li><a href="Typemaps.html#Typemaps_type_special_variables">Type related special variables</a>
|
||||
<li><a href="Typemaps.html#Typemaps_additional_special_variables">Non-type related special variables</a>
|
||||
<li><a href="Typemaps.html#Typemaps_non_type_special_variables">Non-type related special variables</a>
|
||||
</ul>
|
||||
<li><a href="Typemaps.html#Typemaps_special_variable_macros">Special variable macros</a>
|
||||
<ul>
|
||||
|
@ -1470,6 +1474,7 @@
|
|||
<li><a href="Python.html#Python_nn36">Exception unrolling</a>
|
||||
<li><a href="Python.html#Python_nn37">Overhead and code bloat</a>
|
||||
<li><a href="Python.html#Python_nn38">Typemaps</a>
|
||||
<li><a href="Python.html#Python_director_thread_safety">Thread safety</a>
|
||||
<li><a href="Python.html#Python_nn39">Miscellaneous</a>
|
||||
</ul>
|
||||
<li><a href="Python.html#Python_nn40">Common customization features</a>
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
<li><a href="#Python_nn36">Exception unrolling</a>
|
||||
<li><a href="#Python_nn37">Overhead and code bloat</a>
|
||||
<li><a href="#Python_nn38">Typemaps</a>
|
||||
<li><a href="#Python_director_thread_safety">Thread safety</a>
|
||||
<li><a href="#Python_nn39">Miscellaneous</a>
|
||||
</ul>
|
||||
<li><a href="#Python_nn40">Common customization features</a>
|
||||
|
@ -3274,7 +3275,22 @@ need to be supported.
|
|||
</p>
|
||||
|
||||
|
||||
<H3><a name="Python_nn39">33.5.7 Miscellaneous</a></H3>
|
||||
<H3><a name="Python_director_thread_safety">33.5.7 Thread safety</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
The director implementation uses a <tt>std::map</tt> to manage C++ pointer ownership.
|
||||
This code is not thread-safe by default.
|
||||
See <a href="Python.hthml#Python_multithreaded">Thread safety</a> for turning on thread-safety.
|
||||
This defines a macro called <tt>SWIG_THREADS</tt> which forces the C++ code to then use a mutex
|
||||
for managing the pointer ownership, which in turn makes the directors implementation thread-safe.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Please see the <tt>director_guard.swg</tt> Library file for details of the implementation.
|
||||
</p>
|
||||
|
||||
<H3><a name="Python_nn39">33.5.8 Miscellaneous</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
@ -3283,7 +3299,7 @@ be able to use std::vector, std::string, etc., as you would any other type.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b>Note:</b> The director typemaps for return types based in const
|
||||
<b>Note:</b> The director typemaps for return types based on const
|
||||
references, such as
|
||||
|
||||
<div class="code">
|
||||
|
@ -3298,10 +3314,9 @@ class Foo {
|
|||
|
||||
<p>
|
||||
will work only for simple call scenarios. Usually the resulting code
|
||||
is neither thread or reentrant safe. Hence, the user is advised to
|
||||
is neither thread nor reentrant safe. Hence, the user is advised to
|
||||
avoid returning const references in director methods. For example,
|
||||
the user could modify the method interface to use lvalue return
|
||||
types, wherever possible, for example
|
||||
the user could modify the method interface to use return by value semantics instead.
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
|
@ -7414,7 +7429,7 @@ will not be able to run any other threads, even if the wrapped C/C++ code is wai
|
|||
<p>
|
||||
The <tt>threads</tt> module option in the *.i template file:
|
||||
</p>
|
||||
<div class="code"><pre>%module("threads"=1)</pre></div>
|
||||
<div class="code"><pre>%module(threads="1")</pre></div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -188,6 +188,20 @@ Although this approach might not provide the most seamless integration
|
|||
with C++, it is safe, simple, portable, and debuggable.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This approach results in generated code that uses just the most basic of C and C++ features,
|
||||
no matter how complex the input C++ is.
|
||||
SWIG will not force a newer standard of C++ to be required as the generated code complies
|
||||
with ISO standard C++98.
|
||||
However, there are a few features in later C++ standards that can be advantageous to use.
|
||||
For example, C++11 move semantics are available to provide performance improvements.
|
||||
So in some instances, SWIG will use features from newer C++ standards provided they are available.
|
||||
This is made possible via the <tt>__cplusplus</tt> macro,
|
||||
which is set by the C++ compiler to an appropriate standards defined value.
|
||||
This means that if your compiler is configured to support say the C++11 standard, then there
|
||||
may be some C++11 benefits available in the generated code, such as C++11 move semantics.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Some of this chapter focuses on the low-level procedural interface to
|
||||
C++ that is used as the foundation for all language modules. Keep in
|
||||
|
|
|
@ -415,6 +415,7 @@ example.i(4) : Syntax error in input(1).
|
|||
<li>327. Extern template ignored.
|
||||
<li>328. Value assigned to <em>name</em> not used due to limited parsing implementation.
|
||||
<li>329. Using declaration '<em>name</em>' for inheriting constructors uses base '<em>name</em>' which is not an immediate base of '<em>name</em>'.
|
||||
<li>330. Template forward class instantiation '<em>templ</em>' with name '<em>name</em>' is ineffective.
|
||||
<li>340. Lambda expressions and closures are not fully supported yet.
|
||||
<li>344. Unable to deduce decltype for '<em>expr</em>'.
|
||||
<li>345. Unable to deduce auto return type for '<em>name</em>' (ignored).
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<li><a href="#Windows_swig_exe">Building swig.exe on Windows</a>
|
||||
<ul>
|
||||
<li><a href="#Windows_cmake">Building swig.exe using CMake</a>
|
||||
<li><a href="#Windows_msys2">Building swig.exe using MSYS2</a>
|
||||
<li><a href="#Windows_msys2">Building swig.exe using MSYS2 and MinGW-w64</a>
|
||||
<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>
|
||||
<ul>
|
||||
|
@ -40,6 +40,10 @@
|
|||
</ul>
|
||||
</ul>
|
||||
<li><a href="#Windows_interface_file">Microsoft extensions and other Windows quirks</a>
|
||||
<ul>
|
||||
<li><a href="#Windows_msvc_cpp_standards">Visual C++ standards compliance</a>
|
||||
<li><a href="#Windows_calling_conventions">Calling conventions</a>
|
||||
</ul>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- INDEX -->
|
||||
|
@ -80,7 +84,7 @@ If you want to build your own swig.exe have a look at <a href="#Windows_swig_exe
|
|||
Microsoft Visual C++ is the most commonly used compiler for compiling and linking SWIG's output on Windows.
|
||||
The Examples directory has a few Visual C++ project files (.dsp files).
|
||||
These were produced by Visual C++ 6.
|
||||
Newer versions of Visual Studio are able to open and convert these project files.
|
||||
Newer versions of Visual Studio, such as Visual Studio 2022, are able to open and convert these project files.
|
||||
Each C# example comes with a Visual Studio 2005 solution and associated project files instead of Visual C++ 6 project files.
|
||||
The project files have been set up to execute SWIG in a custom build rule for the SWIG interface (.i) file.
|
||||
Alternatively run the <a href="#Windows_examples_cygwin">examples using Cygwin</a>.
|
||||
|
@ -219,8 +223,9 @@ Normally this is not needed, so most people will want to ignore this section.
|
|||
</p>
|
||||
|
||||
<p>
|
||||
There are various ways to build the SWIG executable including <a href="https://cmake.org/">CMake</a> which is able to generate project files for building with Visual Studio.
|
||||
SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</a>, <a href="https://www.cygwin.com">Cygwin</a> or <a href="https://osdn.net/projects/mingw/">MinGW</a>, all of which provide a Unix like front end to Windows and comes free with the gcc C/C++ compiler.
|
||||
There are various ways to build the SWIG executable including <a href="https://cmake.org/">CMake</a> which is able to generate project files for building with <a href="https://visualstudio.microsoft.com/">Visual Studio</a> <a href="https://docs.microsoft.com//cpp/">MSVC</a>.<br>
|
||||
SWIG can also be compiled and run using <a href="https://www.msys2.org/">MSYS2</a> with <a href="https://www.mingw-w64.org/">MinGW-w64</a>, <a href="https://www.cygwin.com">Cygwin</a> or <a href="https://osdn.net/projects/mingw/">MinGW</a>, all of which provide a Unix like front end to Windows and comes free with the <a href="https://gcc.gnu.org/">GCC</a> C/C++ compiler.<br>
|
||||
SWIG can also be compiled with MSYS2 using MSVC and SWIG <a href="https://github.com/swig/cccl">MSVC wrapper</a>.<br>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -272,7 +277,6 @@ cd C:\swig
|
|||
|
||||
$env:PATH="C:\Tools\CMake\CMake-win64.3.15.5\bin;C:\Tools\bison\Bison.3.7.4\bin;" + $env:PATH
|
||||
$PCRE_ROOT="C:\Tools\pcre2\PCRE2.10.39.0"
|
||||
$PCRE_PLATFORM="x64"
|
||||
|
||||
cmake -G "Visual Studio 16 2019" -A "x64" `
|
||||
-DCMAKE_INSTALL_PREFIX="C:/swig/install2" `
|
||||
|
@ -304,7 +308,7 @@ cd install2/bin
|
|||
<pre>-python -c++ -o C:\Temp\doxygen_parsing.cpp C:\swig\Examples\test-suite\doxygen_parsing.i</pre>
|
||||
</div>
|
||||
|
||||
<H3><a name="Windows_msys2">3.3.2 Building swig.exe using MSYS2</a></H3>
|
||||
<H3><a name="Windows_msys2">3.3.2 Building swig.exe using MSYS2 and MinGW-w64</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
|
@ -500,6 +504,26 @@ Follow the Unix instructions in the README file in the SWIG root directory to bu
|
|||
<H2><a name="Windows_interface_file">3.4 Microsoft extensions and other Windows quirks</a></H2>
|
||||
|
||||
|
||||
<H3><a name="Windows_msvc_cpp_standards">3.4.1 Visual C++ standards compliance</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
The Visual C++ compiler (MSVC) has a long history of not being standards compliant, but this has been getting better
|
||||
over the years.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
SWIG's <a href="SWIGPlus.html#SWIGPlus_nn3">approach for C++</a> is to generate standards compliant C++98 code along with
|
||||
enhancements for later standards if the C++ compiler supports a later standard.
|
||||
Unfortunately by default, in 2024, Visual C++ still does not set the <tt>__cplusplus</tt> macro correctly to pick up these later C++ standard features.
|
||||
MSVC users are urged to ensure this macro is defined correctly by consulting the latest Microsoft Visual C++ documentation, in particular,
|
||||
<a href="https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version">/std</a> and
|
||||
<a href="https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus">/Zc:__cplusplus</a>.
|
||||
</p>
|
||||
|
||||
<H3><a name="Windows_calling_conventions">3.4.2 Calling conventions</a></H3>
|
||||
|
||||
|
||||
<p>
|
||||
A common problem when using SWIG on Windows are the Microsoft function calling conventions which are not in the C++ standard.
|
||||
SWIG parses ISO C/C++ so cannot deal with proprietary conventions such as <tt>__declspec(dllimport)</tt>, <tt>__stdcall</tt> etc.
|
||||
|
|
|
@ -1390,12 +1390,12 @@ PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS)
|
|||
python_static: $(SRCDIR_SRCS)
|
||||
$(SWIG) -python -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \
|
||||
$(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
|
||||
$(PYTHON_INCLUDE) $(LIBS) $(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
|
||||
|
||||
python_static_cpp: $(SRCDIR_SRCS)
|
||||
$(SWIG) -python -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \
|
||||
$(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
|
||||
$(PYTHON_INCLUDE) $(LIBS) $(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Running a Python example
|
||||
|
|
|
@ -71,6 +71,12 @@ INTERFACEDIR = ../
|
|||
SRCDIR = $(srcdir)/
|
||||
SCRIPTDIR = $(srcdir)
|
||||
|
||||
# This can be set to ":" on make command line to suppress progress messages.
|
||||
ECHO_PROGRESS := echo
|
||||
|
||||
# Portable dos2unix / fromdos for stripping CR
|
||||
FROMDOS = tr -d '\r'
|
||||
|
||||
# Regenerate Makefile if Makefile.in or config.status have changed.
|
||||
Makefile: $(srcdir)/Makefile.in ../../../config.status
|
||||
cd ../../../ && $(SHELL) ./config.status $(EXAMPLES)/$(TEST_SUITE)/$(LANGUAGE)/Makefile
|
||||
|
@ -615,6 +621,7 @@ CPP11_TEST_CASES += \
|
|||
cpp11_auto_variable \
|
||||
cpp11_brackets_expression \
|
||||
cpp11_constexpr \
|
||||
cpp11_constexpr_friend \
|
||||
cpp11_copyctor_delete \
|
||||
cpp11_decltype \
|
||||
cpp11_default_delete \
|
||||
|
@ -965,7 +972,7 @@ swig_and_compile_c = \
|
|||
$(LANGUAGE)$(VARIANT)
|
||||
|
||||
swig_and_compile_multi_cpp = \
|
||||
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \
|
||||
for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list | $(FROMDOS)` ; do \
|
||||
$(call swig_and_compile_cpp_helper,$${f},'$(SWIGOPT)'); \
|
||||
done
|
||||
|
||||
|
@ -984,9 +991,9 @@ swig_and_compile_runtime = \
|
|||
|
||||
setup = \
|
||||
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi
|
||||
|
||||
#######################################################################
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
%module cpp11_constexpr_friend
|
||||
|
||||
%rename("isEqual") operator==(FriendA const& lhs, FriendA const& rhs) noexcept;
|
||||
%rename("isEqual") operator==(FriendB const& lhs, FriendB const& rhs) noexcept;
|
||||
|
||||
%inline %{
|
||||
class FriendA final
|
||||
{
|
||||
public:
|
||||
FriendA(int const v) noexcept : _v(v)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr friend bool operator==(FriendA const& lhs, FriendA const& rhs) noexcept
|
||||
{
|
||||
return lhs._v == rhs._v;
|
||||
}
|
||||
private:
|
||||
int _v{};
|
||||
};
|
||||
class FriendB final
|
||||
{
|
||||
public:
|
||||
FriendB(int const v) noexcept : _v(v)
|
||||
{
|
||||
}
|
||||
|
||||
constexpr friend bool operator==(FriendB const& lhs, FriendB const& rhs) noexcept
|
||||
{
|
||||
return lhs._v == rhs._v;
|
||||
}
|
||||
private:
|
||||
int _v{};
|
||||
};
|
||||
%}
|
|
@ -84,9 +84,9 @@ csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP
|
|||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi; \
|
||||
if [ ! -d $* ]; then \
|
||||
mkdir $*; \
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
using System;
|
||||
using cpp11_constexpr_friendNamespace;
|
||||
|
||||
public class cpp11_constexpr_friend_runme {
|
||||
public static void Main() {
|
||||
FriendA fa10 = new FriendA(10);
|
||||
FriendA fa20 = new FriendA(20);
|
||||
if (!cpp11_constexpr_friend.isEqual(fa10, fa10))
|
||||
throw new Exception("Friend fa10 fa10 fail");
|
||||
if (cpp11_constexpr_friend.isEqual(fa10, fa20))
|
||||
throw new Exception("Friend fa10 fa20 fail");
|
||||
|
||||
FriendB fb10 = new FriendB(10);
|
||||
FriendB fb20 = new FriendB(20);
|
||||
if (!cpp11_constexpr_friend.isEqual(fb10, fb10))
|
||||
throw new Exception("Friend fb10 fb10 fail");
|
||||
if (cpp11_constexpr_friend.isEqual(fb10, fb20))
|
||||
throw new Exception("Friend fb10 fb20 fail");
|
||||
}
|
||||
}
|
|
@ -75,9 +75,9 @@ SWIGOPT+=-splitproxy -package $*
|
|||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*_runme.2.d ]; then \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi; \
|
||||
if [ ! -d $*.2 ]; then \
|
||||
mkdir $*.2; \
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
// This test is for testing director_guard.swg and director thread safety
|
||||
// Note: other languages should define SWIG_THREADS instead of the threads="1" module Python option
|
||||
%module(directors="1", threads="1") director_guard;
|
||||
|
||||
%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) Callback::run;
|
||||
|
||||
%feature("director") Callback;
|
||||
|
||||
%inline %{
|
||||
|
||||
class Callback {
|
||||
public:
|
||||
virtual const char *run() const { return "tst1"; }
|
||||
virtual ~Callback() {}
|
||||
|
||||
};
|
||||
|
||||
class Caller {
|
||||
private:
|
||||
Callback *_callback;
|
||||
public:
|
||||
Caller(Callback *cb): _callback(cb) { }
|
||||
const char *call() { return _callback->run(); }
|
||||
};
|
||||
|
||||
%}
|
|
@ -54,9 +54,8 @@ $(DOXYGEN_ERROR_TEST_CASES): SWIGOPT += -doxygen
|
|||
MODULE_OPTION=-module $*
|
||||
nomodule.ctest: MODULE_OPTION =
|
||||
|
||||
# Portable dos2unix / todos for stripping CR
|
||||
TODOS = tr -d '\r'
|
||||
#TODOS = sed -e 's/\r$$//' # On Mac OS X behaves as if written 's/r$$//'
|
||||
# Portable dos2unix / fromdos for stripping CR
|
||||
FROMDOS = tr -d '\r'
|
||||
|
||||
# strip source directory from output, so that diffs compare
|
||||
STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
|
||||
|
@ -64,12 +63,12 @@ STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||'
|
|||
# Rules for the different types of tests
|
||||
%.cpptest:
|
||||
echo "$(ACTION)ing errors testcase $*"
|
||||
-$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
|
||||
-$(SWIGINVOKE) -c++ -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(FROMDOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
|
||||
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
|
||||
|
||||
%.ctest:
|
||||
echo "$(ACTION)ing errors testcase $*"
|
||||
-$(SWIGINVOKE) -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
|
||||
-$(SWIGINVOKE) -python -Wall -Fstandard $(MODULE_OPTION) $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(FROMDOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT)
|
||||
$(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT)
|
||||
|
||||
%.clean:
|
||||
|
|
|
@ -7,3 +7,8 @@ namespace UUU {
|
|||
}
|
||||
|
||||
%template(xxx) UUU::JJJ<int>;
|
||||
|
||||
%template(TTT_int) VVV::TTT<int>; // needs to be after template is parsed
|
||||
namespace VVV {
|
||||
template<typename T> struct TTT {};
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
cpp_invalid_template.i:3: Error: Template 'SSS::AAA' undefined.
|
||||
cpp_invalid_template.i:9: Error: 'JJJ' is not defined as a template. (classforward)
|
||||
cpp_invalid_template.i:11: Error: Template 'VVV::TTT' undefined.
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
%module xxx
|
||||
|
||||
|
||||
namespace Space {
|
||||
template <typename T> struct ForwardDeclaredTemplate;
|
||||
%template(ForwardDeclaredTemplate_double) ForwardDeclaredTemplate<double>;
|
||||
|
||||
template <typename T> struct ForwardDeclaredSpecialized;
|
||||
%template(ForwardDeclaredTemplate_int) ForwardDeclaredSpecialized<int>; // no primary defined
|
||||
%template(ForwardDeclaredTemplate_double) ForwardDeclaredSpecialized<double>; // needs to be after the specialized template definition.
|
||||
template <> struct ForwardDeclaredSpecialized<double> {
|
||||
void specialized(const ForwardDeclaredSpecialized& other) { }
|
||||
};
|
||||
|
||||
template <typename T> struct ForwardDeclaredMisplacedPrimary;
|
||||
%template(ForwardDeclaredTemplate_double) ForwardDeclaredMisplacedPrimary<double>; // needs to be after the primary template definition.
|
||||
template <typename T> struct ForwardDeclaredMisplacedPrimary {
|
||||
void primary(const ForwardDeclaredMisplacedPrimary& other) { }
|
||||
};
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
cpp_template_forward.i:6: Warning 330: Template forward class instantiation 'Space::ForwardDeclaredTemplate< double >' with name 'ForwardDeclaredTemplate_double' is ineffective.
|
||||
cpp_template_forward.i:9: Warning 330: Template forward class instantiation 'Space::ForwardDeclaredSpecialized< int >' with name 'ForwardDeclaredTemplate_int' is ineffective.
|
||||
cpp_template_forward.i:10: Warning 330: Template forward class instantiation 'Space::ForwardDeclaredSpecialized< double >' with name 'ForwardDeclaredTemplate_double' is ineffective.
|
||||
cpp_template_forward.i:16: Warning 330: Template forward class instantiation 'Space::ForwardDeclaredMisplacedPrimary< double >' with name 'ForwardDeclaredTemplate_double' is ineffective.
|
|
@ -3,12 +3,12 @@
|
|||
template<typename T> T template_friend1(T);
|
||||
template<typename T> T template_friend1(T);
|
||||
struct MyTemplate1 {
|
||||
template<typename T> friend T template_friend1(T);
|
||||
template<typename T> constexpr friend T template_friend1(T);
|
||||
};
|
||||
|
||||
template<typename T> T template_friend2(T);
|
||||
struct MyTemplate2 {
|
||||
template<typename T> friend T template_friend2(T);
|
||||
template<typename T> constexpr friend T template_friend2(T);
|
||||
};
|
||||
template<typename T> T template_friend2(T);
|
||||
|
||||
|
@ -16,11 +16,11 @@ template<typename T> T template_friend2(T);
|
|||
int normal_friend1(int);
|
||||
int normal_friend1(int);
|
||||
struct MyClass1 {
|
||||
friend int normal_friend1(int);
|
||||
constexpr friend int normal_friend1(int);
|
||||
};
|
||||
|
||||
int normal_friend2(int);
|
||||
struct MyClass2 {
|
||||
friend int normal_friend2(int);
|
||||
constexpr friend int normal_friend2(int);
|
||||
};
|
||||
int normal_friend2(int);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
%module xxx
|
||||
|
||||
%feature("flatnested");
|
||||
|
||||
%ignore B::unknown1;
|
||||
|
||||
%{
|
||||
struct B {
|
||||
void unknown1() { }
|
||||
void unknown2() { }
|
||||
};
|
||||
%}
|
||||
|
||||
%inline {
|
||||
class C {
|
||||
protected:
|
||||
struct D : B {
|
||||
using B::unknown1;
|
||||
using B::unknown2;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
cpp_using_ignore.i:19: Warning 315: Nothing known about 'B::unknown2'.
|
|
@ -110,9 +110,9 @@ nspacemove_stl.%: JAVA_PACKAGE = $*Package
|
|||
# Makes a directory for the testcase if it does not exist
|
||||
setup = \
|
||||
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi; \
|
||||
if [ ! -d $(JAVA_PACKAGE) ]; then \
|
||||
mkdir $(JAVA_PACKAGE); \
|
||||
|
|
|
@ -21,6 +21,7 @@ public class director_thread_runme {
|
|||
if (d.getVal() >= 0) {
|
||||
throw new RuntimeException("Failed. Val: " + d.getVal());
|
||||
}
|
||||
d.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
import template_specialization.*;
|
||||
|
||||
public class template_specialization_runme {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("template_specialization");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String argv[]) {
|
||||
UnaryFunction_double ufd = new UnaryFunction_double();
|
||||
ufd.negate();
|
||||
|
||||
UnaryFunction_bool ufb = new UnaryFunction_bool();
|
||||
ufb.foo(ufb);
|
||||
ufb.not1();
|
||||
|
||||
OnlySpecialized_int osi = new OnlySpecialized_int();
|
||||
osi.bar(osi);
|
||||
|
||||
// Type wrapper class not proxy class is returned as primary template definition is not seen by SWIG
|
||||
SWIGTYPE_p_vfncs__OnlySpecializedT_double_t osd = template_specialization.factory(null);
|
||||
}
|
||||
}
|
|
@ -65,9 +65,9 @@ SWIGOPT += -DV8_VERSION=$(JSV8_VERSION)
|
|||
|
||||
_setup = \
|
||||
if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
|
||||
echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ; \
|
||||
fi;
|
||||
|
||||
SWIGOPT += -$(JSENGINE)
|
||||
|
|
|
@ -14,10 +14,3 @@ if (preproc_include.multiply40(10) != 400)
|
|||
|
||||
if (preproc_include.multiply50(10) != 500)
|
||||
throw "RuntimeError";
|
||||
|
||||
if (preproc_include.multiply60(10) != 600)
|
||||
throw "RuntimeError";
|
||||
|
||||
if (preproc_include.multiply70(10) != 700)
|
||||
throw "RuntimeError";
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ int multiply50(int a) { return a*50; }
|
|||
|
||||
%include INCLUDE_E
|
||||
|
||||
// node-gyp tool doesn't handle spaces in the dependencies correctly (see #2930), so skip this part when using it.
|
||||
#ifndef BUILDING_NODE_EXTENSION
|
||||
%inline %{
|
||||
#define INCLUDE_F /*comments*/ "preproc_include_f withspace.h"/*testing*/
|
||||
#include INCLUDE_F
|
||||
|
@ -34,6 +36,7 @@ int multiply50(int a) { return a*50; }
|
|||
int multiply60(int a) { return a*60; }
|
||||
int multiply70(int a) { return a*70; }
|
||||
%}
|
||||
#endif // !BUILDING_NODE_EXTENSION
|
||||
|
||||
%define nested_include_1(HEADER)
|
||||
%include <HEADER>
|
||||
|
|
|
@ -36,6 +36,7 @@ endif
|
|||
CPP_TEST_CASES += \
|
||||
callback \
|
||||
complextest \
|
||||
director_guard \
|
||||
director_stl \
|
||||
director_wstring \
|
||||
file_test \
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
import director_guard
|
||||
import threading
|
||||
import time
|
||||
|
||||
str2 = "tst2"
|
||||
|
||||
class MinCallback(director_guard.Callback):
|
||||
def run(self):
|
||||
return str2
|
||||
|
||||
class CallThread(threading.Thread):
|
||||
def __init__(self, caller):
|
||||
super(CallThread, self).__init__()
|
||||
self.caller = caller
|
||||
|
||||
def run(self):
|
||||
for x in range(100):
|
||||
if self.caller.call() != "tst2":
|
||||
raise RuntimeError("Should return true")
|
||||
time.sleep(0.001) # 1 millisecond
|
||||
|
||||
callback = MinCallback()
|
||||
caller = director_guard.Caller(callback)
|
||||
threads = [ ]
|
||||
for x in range(10):
|
||||
threads.append(CallThread(caller))
|
||||
|
||||
for t in threads:
|
||||
t.start()
|
||||
|
||||
for t in threads:
|
||||
t.join()
|
|
@ -66,7 +66,7 @@ setup = \
|
|||
mkdir $(TEST_DIR); \
|
||||
fi; \
|
||||
if [ -f $(SRC_RUNME_SCRIPT) ]; then \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \
|
||||
if [ ! -f $(TEST_DIR) ]; then \
|
||||
cp $(SRC_RUNME_SCRIPT) $(TEST_DIR); \
|
||||
fi; \
|
||||
|
@ -77,7 +77,7 @@ setup = \
|
|||
cp $(srcdir)/swigtest.quit $(TEST_DIR); \
|
||||
fi; \
|
||||
else \
|
||||
echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
$(ECHO_PROGRESS) "$(ACTION)ing $(LANGUAGE) testcase $*" ; \
|
||||
fi; \
|
||||
|
||||
# Runs the testcase. A testcase is only run if
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
%rename(not1) *::operator!() const;
|
||||
%rename(negate) *::operator-() const;
|
||||
|
||||
%warnfilter(SWIGWARN_PARSE_TEMPLATE_FORWARD) vfncs::OnlySpecialized<double>;
|
||||
|
||||
%inline %{
|
||||
|
||||
namespace vfncs {
|
||||
|
@ -27,11 +29,42 @@
|
|||
|
||||
};
|
||||
|
||||
// Also test specialization with only primary template forward declaration
|
||||
template <typename T> struct OnlySpecialized;
|
||||
|
||||
template <> struct OnlySpecialized<int>
|
||||
{
|
||||
void bar(const OnlySpecialized& other) { }
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
namespace vfncs {
|
||||
|
||||
namespace vfncs {
|
||||
%template(UnaryFunction_double) UnaryFunction<double>;
|
||||
%template(UnaryFunction_bool) UnaryFunction<bool>;
|
||||
|
||||
// Specialized instantiation with only primary template forward declaration
|
||||
%template(OnlySpecialized_int) OnlySpecialized<int>;
|
||||
|
||||
// Primary instantiation with only primary template forward declaration
|
||||
%template(OnlySpecialized_double) OnlySpecialized<double>; // ignored with a warning
|
||||
}
|
||||
|
||||
%{
|
||||
namespace vfncs {
|
||||
template <typename T> struct OnlySpecialized {
|
||||
int primary() const { return 0; }
|
||||
};
|
||||
}
|
||||
%}
|
||||
|
||||
%inline %{
|
||||
namespace vfncs {
|
||||
// Use primary template with only primary template forward declaration (for SWIG, but full declaration seen by compiler)
|
||||
OnlySpecialized<double> factory(OnlySpecialized<double>* os) {
|
||||
OnlySpecialized<double> ret = os ? *os : OnlySpecialized<double>();
|
||||
ret.primary();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
|
|
@ -92,18 +92,6 @@ static SWIG_CSharpWStringExceptionHelperCallback SWIG_csharp_ApplicationExceptio
|
|||
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="SWIGRegisterWStringExceptionCallback_$module")]
|
||||
public static extern void SWIGRegisterWStringExceptionCallback_$module(SWIGWStringExceptionDelegate applicationExceptionUTF16Delegate, SWIGWStringExceptionDelegate applicationExceptionUTF32Delegate);
|
||||
|
||||
static string CreateWStringFromUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
|
||||
return global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cString, length);
|
||||
}
|
||||
|
||||
public static string CreateWStringFromUTF32([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
|
||||
if (length == 0)
|
||||
return string.Empty;
|
||||
|
||||
byte[] buffer = new byte[length * 4];
|
||||
return global::System.Text.Encoding.UTF32.GetString(buffer);
|
||||
}
|
||||
|
||||
static void SetPendingApplicationExceptionUTF16([global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPWStr)]global::System.IntPtr cString, int length) {
|
||||
string message = SWIGWStringHelper.CreateWStringFromUTF16(cString, length);
|
||||
SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve()));
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director_guard.swg
|
||||
*
|
||||
* Generic Mutex implementation for directors
|
||||
*
|
||||
* Before including this file, there are two macros to define for choosing
|
||||
* an implementation as follows:
|
||||
* - SWIG_THREADS:
|
||||
* If defined than mutexes are used.
|
||||
* If not defined then mutexes are not used.
|
||||
* - SWIG_HAVE_MUTEX:
|
||||
* If there is a target language defined 'Mutex' class available, the target
|
||||
* language will define this macro to use the class over the options below.
|
||||
* The language 'Mutex' class needs to be Basic Lockable.
|
||||
* It must have public 'void lock()' and 'void unlock()' methods.
|
||||
* See: https://en.cppreference.com/w/cpp/named_req/BasicLockable
|
||||
* If the macro is not defined, one of the following will be used in this order:
|
||||
* - std::mutex if using C++11 or later.
|
||||
* - CRITICAL_SECTION on Windows.
|
||||
* - POSIX pthread mutex.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef SWIG_THREADS
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
/*
|
||||
* C++ 11 or above
|
||||
* std::mutex https://en.cppreference.com/w/cpp/thread/mutex
|
||||
* std::unique_lock https://en.cppreference.com/w/cpp/thread/unique_lock
|
||||
*/
|
||||
#include <mutex>
|
||||
#ifdef SWIG_HAVE_MUTEX
|
||||
/* Use Language defined Mutex class */
|
||||
#define SWIG_GUARD(_mutex) std::unique_lock<Mutex> _guard(_mutex)
|
||||
#define SWIG_GUARD_DEFINITION(_cls, _mutex) Mutex _cls::_mutex
|
||||
#define SWIG_GUARD_DECLARATION(_mutex) static Mutex _mutex
|
||||
#else
|
||||
#define SWIG_GUARD(_mutex) std::unique_lock<std::mutex> _guard(_mutex)
|
||||
#define SWIG_GUARD_DEFINITION(_cls, _mutex) std::mutex _cls::_mutex
|
||||
#define SWIG_GUARD_DECLARATION(_mutex) static std::mutex _mutex
|
||||
#endif
|
||||
|
||||
#else /* __cplusplus */
|
||||
|
||||
#ifdef SWIG_HAVE_MUTEX
|
||||
/* Use Language defined Mutex class */
|
||||
|
||||
#elif defined(_WIN32)
|
||||
/*
|
||||
* Windows Critical Section Objects
|
||||
* https://learn.microsoft.com/en-us/windows/win32/Sync/critical-section-objects
|
||||
*/
|
||||
#include <windows.h>
|
||||
#include <synchapi.h>
|
||||
namespace Swig {
|
||||
class Mutex {
|
||||
CRITICAL_SECTION mutex_;
|
||||
public:
|
||||
Mutex() { InitializeCriticalSection(&mutex_); }
|
||||
~Mutex() { DeleteCriticalSection(&mutex_); }
|
||||
void lock() { EnterCriticalSection(&mutex_); }
|
||||
void unlock() { LeaveCriticalSection(&mutex_); }
|
||||
};
|
||||
}
|
||||
|
||||
#else /* _WIN32 */
|
||||
/*
|
||||
* POSIX Thread mutex
|
||||
* https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread.h.html
|
||||
*/
|
||||
#include <pthread.h>
|
||||
namespace Swig {
|
||||
class Mutex {
|
||||
pthread_mutex_t mutex_;
|
||||
public:
|
||||
Mutex() { pthread_mutex_init(&mutex_, NULL); }
|
||||
~Mutex() { pthread_mutex_destroy(&mutex_); }
|
||||
void lock() { pthread_mutex_lock(&mutex_); }
|
||||
void unlock() { pthread_mutex_unlock(&mutex_); }
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
namespace Swig {
|
||||
class Unique_lock {
|
||||
Mutex &mutex_;
|
||||
public:
|
||||
Unique_lock(Mutex &_mutex) : mutex_(_mutex) { mutex_.lock(); }
|
||||
~Unique_lock() { mutex_.unlock(); }
|
||||
};
|
||||
}
|
||||
#define SWIG_GUARD(_mutex) Unique_lock _guard(_mutex)
|
||||
#define SWIG_GUARD_DEFINITION(_cls, _mutex) Mutex _cls::_mutex
|
||||
#define SWIG_GUARD_DECLARATION(_mutex) static Mutex _mutex
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#else /* SWIG_THREADS */
|
||||
|
||||
#define SWIG_GUARD(_mutex)
|
||||
#define SWIG_GUARD_DEFINITION(_cls, _mutex)
|
||||
#define SWIG_GUARD_DECLARATION(_mutex)
|
||||
|
||||
#endif /* SWIG_THREADS */
|
|
@ -9,17 +9,16 @@
|
|||
#include <stdexcept>
|
||||
%}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class vector {
|
||||
|
||||
%define SWIG_STD_VECTOR_INTERNAL(CTYPE, CONST_REFERENCE)
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef CTYPE value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef CTYPE& reference;
|
||||
typedef CONST_REFERENCE const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
|
@ -34,7 +33,7 @@ namespace std {
|
|||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
const_reference get(int i) throw (std::out_of_range) {
|
||||
CONST_REFERENCE get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
|
@ -49,47 +48,17 @@ namespace std {
|
|||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
%enddef
|
||||
|
||||
namespace std {
|
||||
|
||||
template<class T> class vector {
|
||||
SWIG_STD_VECTOR_INTERNAL(T, const value_type&)
|
||||
};
|
||||
|
||||
// bool specialization
|
||||
template<> class vector<bool> {
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef bool value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef const value_type* const_pointer;
|
||||
typedef value_type& reference;
|
||||
typedef bool const_reference;
|
||||
|
||||
vector();
|
||||
vector(size_type n);
|
||||
vector(const vector& other);
|
||||
|
||||
size_type size() const;
|
||||
size_type capacity() const;
|
||||
void reserve(size_type n);
|
||||
%rename(isEmpty) empty;
|
||||
bool empty() const;
|
||||
void clear();
|
||||
%rename(add) push_back;
|
||||
void push_back(const value_type& x);
|
||||
%extend {
|
||||
bool get(int i) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
return (*self)[i];
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
void set(int i, const value_type& val) throw (std::out_of_range) {
|
||||
int size = int(self->size());
|
||||
if (i>=0 && i<size)
|
||||
(*self)[i] = val;
|
||||
else
|
||||
throw std::out_of_range("vector index out of range");
|
||||
}
|
||||
}
|
||||
SWIG_STD_VECTOR_INTERNAL(bool, bool)
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -49,20 +49,6 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
/* simple thread abstraction for pthreads on win32 */
|
||||
#ifdef __THREAD__
|
||||
#define __PTHREAD__
|
||||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#define pthread_mutex_lock EnterCriticalSection
|
||||
#define pthread_mutex_unlock LeaveCriticalSection
|
||||
#define pthread_mutex_t CRITICAL_SECTION
|
||||
#define MUTEX_INIT(var) CRITICAL_SECTION var
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#define MUTEX_INIT(var) pthread_mutex_t var = PTHREAD_MUTEX_INITIALIZER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* director base class */
|
||||
class Director {
|
||||
private:
|
||||
|
|
|
@ -72,7 +72,6 @@ BUILD = @LDSHARED@
|
|||
# Python installation
|
||||
|
||||
PY_INCLUDE = -DHAVE_CONFIG_H @PYINCLUDE@
|
||||
PY_LIB = @PYLIB@
|
||||
|
||||
# Build libraries (needed for static builds)
|
||||
|
||||
|
|
|
@ -14,25 +14,6 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#if defined(SWIG_PYTHON_THREADS)
|
||||
/* __THREAD__ is the old macro to activate some thread support */
|
||||
# if !defined(__THREAD__)
|
||||
# define __THREAD__ 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __THREAD__
|
||||
#ifndef Py_LIMITED_API
|
||||
# include "pythread.h"
|
||||
#else
|
||||
# if defined(_WIN32)
|
||||
# include <windows.h>
|
||||
# else
|
||||
# include <pthread.h>
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
Use -DSWIG_PYTHON_DIRECTOR_NO_VTABLE if you don't want to generate a 'virtual
|
||||
table', and avoid multiple GetAttr calls to retrieve the python
|
||||
|
@ -262,95 +243,6 @@ namespace Swig {
|
|||
};
|
||||
|
||||
|
||||
#ifdef __THREAD__
|
||||
#ifndef Py_LIMITED_API
|
||||
class Mutex
|
||||
{
|
||||
public:
|
||||
Mutex() {
|
||||
mutex_ = PyThread_allocate_lock();
|
||||
}
|
||||
|
||||
~Mutex() {
|
||||
PyThread_release_lock(mutex_);
|
||||
}
|
||||
|
||||
private:
|
||||
void Lock() {
|
||||
PyThread_acquire_lock(mutex_, WAIT_LOCK);
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
PyThread_free_lock(mutex_);
|
||||
}
|
||||
|
||||
PyThread_type_lock mutex_;
|
||||
|
||||
friend class Guard;
|
||||
};
|
||||
#elif defined(_WIN32)
|
||||
class Mutex : private CRITICAL_SECTION {
|
||||
public:
|
||||
Mutex() {
|
||||
InitializeCriticalSection(this);
|
||||
}
|
||||
|
||||
~Mutex() {
|
||||
DeleteCriticalSection(this);
|
||||
}
|
||||
|
||||
private:
|
||||
void Lock() {
|
||||
EnterCriticalSection(this);
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
LeaveCriticalSection(this);
|
||||
}
|
||||
|
||||
friend class Guard;
|
||||
};
|
||||
#else
|
||||
class Mutex {
|
||||
public:
|
||||
Mutex() {
|
||||
pthread_mutex_init(&mutex_, NULL);
|
||||
}
|
||||
|
||||
~Mutex() {
|
||||
pthread_mutex_destroy(&mutex_);
|
||||
}
|
||||
|
||||
private:
|
||||
void Lock() {
|
||||
pthread_mutex_lock(&mutex_);
|
||||
}
|
||||
|
||||
void Unlock() {
|
||||
pthread_mutex_unlock(&mutex_);
|
||||
}
|
||||
|
||||
friend class Guard;
|
||||
|
||||
pthread_mutex_t mutex_;
|
||||
};
|
||||
#endif
|
||||
class Guard {
|
||||
Mutex &mutex_;
|
||||
|
||||
public:
|
||||
Guard(Mutex & mutex) : mutex_(mutex) {
|
||||
mutex_.Lock();
|
||||
}
|
||||
|
||||
~Guard() {
|
||||
mutex_.Unlock();
|
||||
}
|
||||
};
|
||||
# define SWIG_GUARD(mutex) Guard _guard(mutex)
|
||||
#else
|
||||
# define SWIG_GUARD(mutex)
|
||||
#endif
|
||||
|
||||
/* director base class */
|
||||
class Director {
|
||||
|
@ -411,9 +303,7 @@ namespace Swig {
|
|||
private:
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
#ifdef __THREAD__
|
||||
static Mutex swig_mutex_own;
|
||||
#endif
|
||||
SWIG_GUARD_DECLARATION(swig_mutex_own);
|
||||
|
||||
public:
|
||||
template <typename Type>
|
||||
|
@ -463,9 +353,7 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef __THREAD__
|
||||
Mutex Director::swig_mutex_own;
|
||||
#endif
|
||||
SWIG_GUARD_DEFINITION(Director, swig_mutex_own);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* director_py_mutex.swg
|
||||
*
|
||||
* contains python mutex for threads
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if defined(SWIG_PYTHON_THREADS) && !defined(SWIG_THREADS)
|
||||
#define SWIG_THREADS 1
|
||||
#endif
|
||||
#if defined(SWIG_THREADS) && !defined(Py_LIMITED_API)
|
||||
#include "pythread.h"
|
||||
#define SWIG_HAVE_MUTEX
|
||||
namespace Swig {
|
||||
class Mutex
|
||||
{
|
||||
PyThread_type_lock mutex_;
|
||||
public:
|
||||
Mutex() : mutex_(PyThread_allocate_lock()) {}
|
||||
~Mutex() { PyThread_release_lock(mutex_); }
|
||||
void lock() { PyThread_acquire_lock(mutex_, WAIT_LOCK); }
|
||||
void unlock() { PyThread_free_lock(mutex_); }
|
||||
};
|
||||
}
|
||||
#endif
|
|
@ -202,37 +202,6 @@ namespace Swig {
|
|||
}
|
||||
};
|
||||
|
||||
/* Simple thread abstraction for pthreads on win32 */
|
||||
#ifdef __THREAD__
|
||||
# define __PTHREAD__
|
||||
# if defined(_WIN32) || defined(__WIN32__)
|
||||
# define pthread_mutex_lock EnterCriticalSection
|
||||
# define pthread_mutex_unlock LeaveCriticalSection
|
||||
# define pthread_mutex_t CRITICAL_SECTION
|
||||
# define SWIG_MUTEX_INIT(var) var
|
||||
# else
|
||||
# include <pthread.h>
|
||||
# define SWIG_MUTEX_INIT(var) var = PTHREAD_MUTEX_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __PTHREAD__
|
||||
struct Guard {
|
||||
pthread_mutex_t *_mutex;
|
||||
|
||||
Guard(pthread_mutex_t &mutex) : _mutex(&mutex) {
|
||||
pthread_mutex_lock(_mutex);
|
||||
}
|
||||
|
||||
~Guard() {
|
||||
pthread_mutex_unlock(_mutex);
|
||||
}
|
||||
};
|
||||
# define SWIG_GUARD(mutex) Guard _guard(mutex)
|
||||
#else
|
||||
# define SWIG_GUARD(mutex)
|
||||
#endif
|
||||
|
||||
/* director base class */
|
||||
class Director {
|
||||
private:
|
||||
|
@ -266,9 +235,7 @@ namespace Swig {
|
|||
private:
|
||||
typedef std::map<void *, GCItem_var> swig_ownership_map;
|
||||
mutable swig_ownership_map swig_owner;
|
||||
#ifdef __PTHREAD__
|
||||
static pthread_mutex_t swig_mutex_own;
|
||||
#endif
|
||||
SWIG_GUARD_DECLARATION(swig_mutex_own);
|
||||
|
||||
public:
|
||||
template <typename Type>
|
||||
|
@ -307,5 +274,6 @@ namespace Swig {
|
|||
return own;
|
||||
}
|
||||
};
|
||||
SWIG_GUARD_DEFINITION(Director, swig_mutex_own);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
* swigcompat.swg
|
||||
*
|
||||
* Macros to provide support compatibility with older C and C++ standards.
|
||||
*
|
||||
* Note that SWIG expects __cplusplus to be defined to the appropriate C++ standard.
|
||||
* MSVC users are urged to check and examine the /Zc:__cplusplus compiler option.
|
||||
* See https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF
|
||||
|
|
|
@ -425,10 +425,10 @@ $(srcdir)/Lib/swigwarn.swg: $(srcdir)/Source/Include/swigwarn.h
|
|||
# TARGETS: install & friends
|
||||
#####################################################################
|
||||
|
||||
INSTALL = @abs_srcdir@/Tools/config/install-sh -c
|
||||
INSTALL_DATA = ${INSTALL} -m 644
|
||||
INSTALL_PROGRAM = ${INSTALL} -m 755
|
||||
MKINSTDIRS = @abs_srcdir@/Tools/config/install-sh -m 0755 -d
|
||||
INSTALL = @abs_srcdir@/Tools/config/install-sh
|
||||
INSTALL_DATA = ${INSTALL} -c -m 644
|
||||
INSTALL_PROGRAM = ${INSTALL} -c -m 755
|
||||
MKINSTDIRS = ${INSTALL} -m 0755 -d
|
||||
# Use standard autoconf approach to transform executable name using --program-prefix and --program-suffix
|
||||
transform = @program_transform_name@
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ static void add_symbols(Node *n) {
|
|||
String *symname = 0;
|
||||
String *old_prefix = 0;
|
||||
Symtab *old_scope = 0;
|
||||
int isfriend = inclass && Checkattr(n, "storage", "friend");
|
||||
int isfriend = inclass && Strstr(Getattr(n, "storage"), "friend") != NULL;
|
||||
int iscdecl = Cmp(nodeType(n),"cdecl") == 0;
|
||||
int only_csymbol = 0;
|
||||
|
||||
|
@ -2905,7 +2905,7 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
if (GetFlag(nn, "instantiate")) {
|
||||
Delattr(nn, "instantiate");
|
||||
{
|
||||
int nnisclass = (Strcmp(Getattr(nn, "templatetype"), "class") == 0); /* if not a class template it is a function template */
|
||||
int nnisclass = (Strcmp(Getattr(nn, "templatetype"), "class") == 0); /* class template not a classforward nor function template */
|
||||
Parm *tparms = Getattr(nn, "templateparms");
|
||||
int specialized = !tparms; /* fully specialized (an explicit specialization) */
|
||||
String *tname = Copy(idcolonnt);
|
||||
|
@ -2960,6 +2960,13 @@ template_directive: SWIGTEMPLATE LPAREN idstringopt RPAREN idcolonnt LESSTHAN va
|
|||
}
|
||||
add_symbols_copy(templnode);
|
||||
|
||||
if (Equal(nodeType(templnode), "classforward")) {
|
||||
SWIG_WARN_NODE_BEGIN(templnode);
|
||||
/* A full template class definition is required in order to wrap a template class as a proxy class so this %template is ineffective. */
|
||||
Swig_warning(WARN_PARSE_TEMPLATE_FORWARD, cparse_file, cparse_line, "Template forward class instantiation '%s' with name '%s' is ineffective.\n", Swig_name_decl(templnode), Getattr(templnode, "sym:name"));
|
||||
SWIG_WARN_NODE_END(templnode);
|
||||
}
|
||||
|
||||
if (Strcmp(nodeType(templnode),"class") == 0) {
|
||||
|
||||
/* Identify pure abstract methods */
|
||||
|
|
|
@ -223,6 +223,8 @@ static void cparse_template_expand(Node *templnode, Node *n, String *tname, Stri
|
|||
cn = nextSibling(cn);
|
||||
}
|
||||
}
|
||||
} else if (Equal(nodeType, "classforward")) {
|
||||
/* Nothing to expand */
|
||||
} else if (Equal(nodeType, "constructor")) {
|
||||
if (!(Getattr(n, "templatetype"))) {
|
||||
String *symname = Getattr(n, "sym:name");
|
||||
|
@ -1172,12 +1174,10 @@ Node *Swig_cparse_template_locate(String *name, Parm *instantiated_parms, String
|
|||
|
||||
if (n) {
|
||||
String *nodeType = nodeType(n);
|
||||
int isclass = 0;
|
||||
assert(Equal(nodeType, "template"));
|
||||
(void)nodeType;
|
||||
isclass = (Equal(Getattr(n, "templatetype"), "class"));
|
||||
String *templatetype = Getattr(n, "templatetype");
|
||||
|
||||
if (isclass) {
|
||||
if (Equal(templatetype, "class") || Equal(templatetype, "classforward")) {
|
||||
Node *primary = Getattr(n, "primarytemplate");
|
||||
Parm *tparmsfound = Getattr(primary ? primary : n, "templateparms");
|
||||
int specialized = !tparmsfound; /* fully specialized (an explicit specialization) */
|
||||
|
@ -1361,8 +1361,9 @@ static void expand_defaults(ParmList *expanded_templateparms) {
|
|||
|
||||
ParmList *Swig_cparse_template_parms_expand(ParmList *instantiated_parms, Node *primary, Node *templ) {
|
||||
ParmList *expanded_templateparms = CopyParmList(instantiated_parms);
|
||||
String *templatetype = Getattr(primary, "templatetype");
|
||||
|
||||
if (Equal(Getattr(primary, "templatetype"), "class")) {
|
||||
if (Equal(templatetype, "class") || Equal(templatetype, "classforward")) {
|
||||
/* Class template */
|
||||
ParmList *templateparms = Getattr(primary, "templateparms");
|
||||
int variadic = merge_parameters(expanded_templateparms, templateparms);
|
||||
|
@ -1399,8 +1400,9 @@ ParmList *Swig_cparse_template_parms_expand(ParmList *instantiated_parms, Node *
|
|||
|
||||
ParmList *Swig_cparse_template_partialargs_expand(ParmList *partially_specialized_parms, Node *primary, ParmList *templateparms) {
|
||||
ParmList *expanded_templateparms = CopyParmList(partially_specialized_parms);
|
||||
String *templatetype = Getattr(primary, "templatetype");
|
||||
|
||||
if (Equal(Getattr(primary, "templatetype"), "class")) {
|
||||
if (Equal(templatetype, "class") || Equal(templatetype, "classforward")) {
|
||||
/* Class template */
|
||||
int variadic = ParmList_variadic_parm(templateparms) ? 1 : 0;
|
||||
/* Add default arguments from primary template */
|
||||
|
|
|
@ -96,6 +96,7 @@
|
|||
#define WARN_PARSE_EXTERN_TEMPLATE 327
|
||||
#define WARN_PARSE_ASSIGNED_VALUE 328
|
||||
#define WARN_PARSE_USING_CONSTRUCTOR 329
|
||||
#define WARN_PARSE_TEMPLATE_FORWARD 330
|
||||
|
||||
#define WARN_CPP11_LAMBDA 340
|
||||
/* Unused since 3.0.11: #define WARN_CPP11_ALIAS_DECLARATION 341 */
|
||||
|
|
|
@ -1000,6 +1000,9 @@ Allocate():
|
|||
|
||||
virtual int usingDeclaration(Node *n) {
|
||||
|
||||
if (GetFlag(n, "feature:ignore"))
|
||||
return SWIG_OK;
|
||||
|
||||
if (!Getattr(n, "namespace")) {
|
||||
Node *ns;
|
||||
/* using id */
|
||||
|
@ -1024,7 +1027,7 @@ Allocate():
|
|||
} else if (Equal(nodeType(ns), "constructor") && !GetFlag(n, "usingctor")) {
|
||||
Swig_warning(WARN_PARSE_USING_CONSTRUCTOR, Getfile(n), Getline(n), "Using declaration '%s' for inheriting constructors uses base '%s' which is not an immediate base of '%s'.\n", SwigType_namestr(Getattr(n, "uname")), SwigType_namestr(Getattr(ns, "name")), SwigType_namestr(Getattr(parentNode(n), "name")));
|
||||
} else {
|
||||
if (inclass && !GetFlag(n, "feature:ignore") && Getattr(n, "sym:name")) {
|
||||
if (inclass && Getattr(n, "sym:name")) {
|
||||
{
|
||||
String *ntype = nodeType(ns);
|
||||
if (Equal(ntype, "cdecl") || Equal(ntype, "constructor") || Equal(ntype, "template") || Equal(ntype, "using")) {
|
||||
|
|
|
@ -827,7 +827,7 @@ public:
|
|||
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(returntype, 0));
|
||||
}
|
||||
|
||||
is_void_return = (Cmp(c_return_type, "void") == 0);
|
||||
is_void_return = Cmp(c_return_type, "void") == 0;
|
||||
if (!is_void_return)
|
||||
Wrapper_add_localv(f, "jresult", c_return_type, "jresult", NIL);
|
||||
|
||||
|
@ -1035,8 +1035,7 @@ public:
|
|||
/* Substitute the cleanup code */
|
||||
Replaceall(f->code, "$cleanup", cleanup);
|
||||
|
||||
bool isvoid = !Cmp(returntype, "void");
|
||||
Replaceall(f->code, "$isvoid", isvoid ? "1" : "0");
|
||||
Replaceall(f->code, "$isvoid", is_void_return ? "1" : "0");
|
||||
|
||||
/* Substitute the function name */
|
||||
Replaceall(f->code, "$symname", symname);
|
||||
|
|
|
@ -1801,8 +1801,7 @@ public:
|
|||
/* Substitute the cleanup code */
|
||||
Replaceall(f->code, "$cleanup", cleanup);
|
||||
|
||||
bool isvoid = !Cmp(returntype, "void");
|
||||
Replaceall(f->code, "$isvoid", isvoid ? "1" : "0");
|
||||
Replaceall(f->code, "$isvoid", is_void_return ? "1" : "0");
|
||||
|
||||
/* Substitute the function name */
|
||||
Replaceall(f->code, "$symname", symname);
|
||||
|
|
|
@ -908,7 +908,7 @@ public:
|
|||
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number, "No jtype typemap defined for %s\n", SwigType_str(returntype, 0));
|
||||
}
|
||||
|
||||
is_void_return = (Cmp(c_return_type, "void") == 0);
|
||||
is_void_return = Cmp(c_return_type, "void") == 0;
|
||||
if (!is_void_return)
|
||||
Wrapper_add_localv(f, "jresult", c_return_type, "jresult = 0", NIL);
|
||||
|
||||
|
@ -1130,8 +1130,7 @@ public:
|
|||
/* Substitute the cleanup code */
|
||||
Replaceall(f->code, "$cleanup", cleanup);
|
||||
|
||||
bool isvoid = !Cmp(returntype, "void");
|
||||
Replaceall(f->code, "$isvoid", isvoid ? "1" : "0");
|
||||
Replaceall(f->code, "$isvoid", is_void_return ? "1" : "0");
|
||||
|
||||
/* Substitute the function name */
|
||||
Replaceall(f->code, "$symname", symname);
|
||||
|
|
|
@ -894,7 +894,8 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) {
|
|||
// Create Library search directories
|
||||
|
||||
// Check for SWIG_LIB environment variable
|
||||
if ((c = getenv("SWIG_LIB")) == (char *) 0) {
|
||||
c = getenv("SWIG_LIB");
|
||||
if (c == (char *) 0 || *c == 0) {
|
||||
#if defined(_WIN32)
|
||||
char buf[MAX_PATH];
|
||||
char *p;
|
||||
|
|
|
@ -808,6 +808,8 @@ public:
|
|||
if (Swig_directors_enabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director_py_mutex.swg", f_runtime);
|
||||
Swig_insert_file("director_guard.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
|
@ -1155,6 +1155,7 @@ public:
|
|||
if (Swig_directors_enabled()) {
|
||||
// Insert director runtime into the f_runtime file (make it occur before %header section)
|
||||
Swig_insert_file("director_common.swg", f_runtime);
|
||||
Swig_insert_file("director_guard.swg", f_runtime);
|
||||
Swig_insert_file("director.swg", f_runtime);
|
||||
}
|
||||
|
||||
|
|
|
@ -993,7 +993,7 @@ void Swig_symbol_conflict_warn(Node *n, Node *c, const String *symname, int incl
|
|||
if (redefined) {
|
||||
Swig_warning(WARN_PARSE_REDEFINED, Getfile(n), Getline(n), "%s\n", en);
|
||||
Swig_warning(WARN_PARSE_REDEFINED, Getfile(c), Getline(c), "%s\n", ec);
|
||||
} else if (!Checkattr(n, "storage", "friend") && !Checkattr(c, "storage", "friend")) {
|
||||
} else if (!Strstr(Getattr(n, "storage"), "friend") && !Strstr(Getattr(c, "storage"), "friend")) {
|
||||
Swig_warning(WARN_PARSE_REDUNDANT, Getfile(n), Getline(n), "%s\n", en);
|
||||
Swig_warning(WARN_PARSE_REDUNDANT, Getfile(c), Getline(c), "%s\n", ec);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,8 @@ case "$SWIGLANG" in
|
|||
"python")
|
||||
pip install --user pycodestyle
|
||||
if [[ "$PY_ABI_VER" ]]; then
|
||||
pip install --user abi3audit
|
||||
# assertion in abi3audit after upgrade from 0.0.10 to 0.0.11
|
||||
pip install --user abi3audit==0.0.10
|
||||
fi
|
||||
if [[ "$PY2" ]]; then
|
||||
WITHLANG=$SWIGLANG
|
||||
|
@ -162,7 +163,8 @@ case "$SWIGLANG" in
|
|||
else
|
||||
# Starting with version 2023.0.0 the download filename format changed.
|
||||
case $VER in
|
||||
20*) scilab_tarball=scilab-$VER.bin.x86_64-pc-linux-gnu.tar.xz ;;
|
||||
2023.0*) scilab_tarball=scilab-$VER.bin.x86_64-pc-linux-gnu.tar.xz ;;
|
||||
20*) scilab_tarball=scilab-$VER.bin.x86_64-linux-gnu.tar.xz ;;
|
||||
*) scilab_tarball=scilab-$VER.bin.linux-x86_64.tar.gz ;;
|
||||
esac
|
||||
$RETRY wget --progress=dot:giga "https://www.scilab.org/download/$VER/$scilab_tarball"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This is a simple utility for Cygwin/Mingw which is useful when running the SWIG
|
||||
# This is a simple utility for Cygwin/MinGW which is useful when running the SWIG
|
||||
# test-suite through Visual Studio. If the output from the test-suite is piped
|
||||
# through this utility, it will filter the junk that the compiler outputs to stdout.
|
||||
# Typical usage: make check | vcfilter
|
||||
|
|
|
@ -167,6 +167,7 @@ install:
|
|||
- pwd
|
||||
- echo MAKEJOBS=%MAKEJOBS%
|
||||
- uname -a
|
||||
- systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version"
|
||||
|
||||
build_script:
|
||||
- set PATH=C:\Tools\bison\Bison.3.7.4\bin;%PATH%
|
||||
|
|
49
configure.ac
49
configure.ac
|
@ -122,7 +122,7 @@ then
|
|||
case $host in
|
||||
*-*-hp*) SO=.sl;;
|
||||
*-*-darwin*) SO=.bundle;;
|
||||
*-*-cygwin* | *-*-mingw*) SO=.dll;;
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*) SO=.dll;;
|
||||
*) SO=.so;;
|
||||
esac
|
||||
fi
|
||||
|
@ -137,7 +137,7 @@ if test -z "$LDSHARED"
|
|||
then
|
||||
case $host in
|
||||
*-*-aix*) LDSHARED="$CC -shared";;
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
if test "$GCC" = yes; then
|
||||
LDSHARED="\$(CC) -shared"
|
||||
else
|
||||
|
@ -203,7 +203,7 @@ then
|
|||
fi;;
|
||||
*-*-hp*) TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) +z ";;
|
||||
*-*-darwin*) TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -bundle -undefined suppress -flat_namespace";;
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
if test "$GCC" = yes; then
|
||||
TRYLINKINGWITHCXX="CXXSHARED= \$(CXX) -shared "
|
||||
else
|
||||
|
@ -595,7 +595,7 @@ else
|
|||
|
||||
if test -z "$CSHARPCOMPILERBIN" ; then
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
# prefer unified Mono mcs compiler (not to be confused with the ancient .NET 1 mcs) over older/alternative names.
|
||||
AC_CHECK_PROGS(CSHARPCOMPILER, csc mcs mono-csc gmcs cscc)
|
||||
if test -n "$CSHARPCOMPILER" && test "$CSHARPCOMPILER" = "csc" ; then
|
||||
|
@ -652,7 +652,7 @@ fi
|
|||
|
||||
# Cygwin requires the Windows standard (Pascal) calling convention as it is a Windows executable and not a Cygwin built executable
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
if test "$GCC" = yes; then
|
||||
CSHARPDYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
|
||||
CSHARPCFLAGS="$GCC_MNO_CYGWIN -mthreads"
|
||||
|
@ -668,7 +668,7 @@ esac
|
|||
|
||||
# CSharp on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*) CSHARPLIBRARYPREFIX="";;
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*) CSHARPLIBRARYPREFIX="";;
|
||||
*)CSHARPLIBRARYPREFIX="lib";;
|
||||
esac
|
||||
|
||||
|
@ -734,7 +734,7 @@ fi
|
|||
|
||||
# Do not prefix library file names with "lib" on Windows.
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*) DLIBPREFIX="";;
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*) DLIBPREFIX="";;
|
||||
*)DLIBPREFIX="lib";;
|
||||
esac
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ esac
|
|||
|
||||
# java.exe on Cygwin requires the Windows standard (Pascal) calling convention as it is a normal Windows executable and not a Cygwin built executable
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
if test "$GCC" = yes; then
|
||||
JAVADYNAMICLINKING="$GCC_MNO_CYGWIN -mthreads -Wl,--add-stdcall-alias"
|
||||
JAVACFLAGS="$GCC_MNO_CYGWIN -mthreads"
|
||||
|
@ -1136,7 +1136,7 @@ esac
|
|||
|
||||
# Java on Windows platforms including Cygwin doesn't use libname.dll, rather name.dll when loading dlls
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*) JAVALIBRARYPREFIX="";;
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*) JAVALIBRARYPREFIX="";;
|
||||
*)JAVALIBRARYPREFIX="lib";;
|
||||
esac
|
||||
|
||||
|
@ -1963,10 +1963,10 @@ else
|
|||
|
||||
AC_MSG_CHECKING(for Python 2.x library directory)
|
||||
if test -d $PYPREFIX/libs; then
|
||||
PYLIB=$PYPREFIX/libs
|
||||
PYLIB="$PYPREFIX/libs"
|
||||
PYLINKFILE=`ls $PYLIB/python*.lib | grep "python[[0-9]][[0-9]]\+\.lib"`
|
||||
if test -r "$PYLINKFILE"; then
|
||||
PYLINK=-l`basename $PYLINKFILE | sed -e 's/\.lib$//'`
|
||||
PYLINK=-l`basename "$PYLINKFILE" | sed -e 's/\.lib$//'`
|
||||
else
|
||||
PYLIB=
|
||||
fi
|
||||
|
@ -2009,7 +2009,7 @@ else
|
|||
AC_MSG_CHECKING(for Python 2.x library directory)
|
||||
dirs="$PYVERSION/config $PYVERSION/$PYLIBDIR python/$PYLIBDIR"
|
||||
for i in $dirs; do
|
||||
if test -d $PYEPREFIX/$PYLIBDIR/$i; then
|
||||
if test -d "$PYEPREFIX/$PYLIBDIR/$i"; then
|
||||
PYLIB="$PYEPREFIX/$PYLIBDIR/$i"
|
||||
break
|
||||
fi
|
||||
|
@ -2022,6 +2022,7 @@ else
|
|||
AC_MSG_RESULT(Not found)
|
||||
else
|
||||
AC_MSG_RESULT($PYLIB)
|
||||
PYLIB="-L$PYLIB"
|
||||
fi
|
||||
AC_MSG_CHECKING(for Python 2.x library)
|
||||
if test -z "$PYLINK"; then
|
||||
|
@ -2033,12 +2034,12 @@ else
|
|||
|
||||
# Cygwin (Windows) needs the library for dynamic linking
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK"
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
PYTHONDYNAMICLINKING="$PYLIB $PYLINK"
|
||||
DEFS="-DUSE_DL_IMPORT $DEFS"
|
||||
;;
|
||||
*-*-aix*)
|
||||
PYTHONDYNAMICLINKING="-L$PYLIB $PYLINK"
|
||||
PYTHONDYNAMICLINKING="$PYLIB $PYLINK"
|
||||
;;
|
||||
*)PYTHONDYNAMICLINKING="";;
|
||||
esac
|
||||
|
@ -2121,8 +2122,8 @@ else
|
|||
AC_MSG_RESULT($PY3INCLUDE)
|
||||
|
||||
AC_MSG_CHECKING(for Python 3.x library directory)
|
||||
if test -d $PY3PREFIX/libs; then
|
||||
PY3LIB=$PY3PREFIX/libs
|
||||
if test -d "$PY3PREFIX/libs"; then
|
||||
PY3LIB="$PY3PREFIX/libs"
|
||||
PY3LINKFILE=`ls $PY3LIB/python*.lib | grep "python[[0-9]][[0-9]]\+\.lib"`
|
||||
if test -r "$PY3LINKFILE"; then
|
||||
PY3LINK=-l`basename $PY3LINKFILE | sed -e 's/\.lib$//'`
|
||||
|
@ -2134,6 +2135,7 @@ else
|
|||
AC_MSG_RESULT([Not found])
|
||||
else
|
||||
AC_MSG_RESULT($PY3LIB)
|
||||
PY3LIB="-L$PY3LIB"
|
||||
fi
|
||||
AC_MSG_CHECKING([for Python 3.x library])
|
||||
if test -z "$PY3LINK"; then
|
||||
|
@ -2187,7 +2189,7 @@ else
|
|||
done
|
||||
if test -z "$PY3LIB"; then
|
||||
# Last resort
|
||||
if test -d $PY3EPREFIX/$PY3LIBDIR; then
|
||||
if test -d "$PY3EPREFIX/$PY3LIBDIR"; then
|
||||
PY3LIB="$PY3EPREFIX/$PY3LIBDIR"
|
||||
fi
|
||||
fi
|
||||
|
@ -2195,6 +2197,7 @@ else
|
|||
AC_MSG_RESULT([Not found])
|
||||
else
|
||||
AC_MSG_RESULT($PY3LIB)
|
||||
PY3LIB="-L$PY3LIB"
|
||||
fi
|
||||
|
||||
PY3LINK="-l$PY3VERSION"
|
||||
|
@ -2210,13 +2213,13 @@ else
|
|||
|
||||
# Cygwin (Windows) needs the library for dynamic linking
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
# PYTHON3DYNAMICLINKING ought to be replaced by $PY3CONFIG --ldflags
|
||||
PYTHON3DYNAMICLINKING="-L$PY3LIB $PY3LINK"
|
||||
PYTHON3DYNAMICLINKING="$PY3LIB $PY3LINK"
|
||||
DEFS="-DUSE_DL_IMPORT $DEFS"
|
||||
;;
|
||||
*-*-aix*)
|
||||
PYTHON3DYNAMICLINKING="-L$PY3LIB $PY3LINK"
|
||||
PYTHON3DYNAMICLINKING="$PY3LIB $PY3LINK"
|
||||
;;
|
||||
*)PYTHON3DYNAMICLINKING="";;
|
||||
esac
|
||||
|
@ -2803,7 +2806,7 @@ dnl although this is probably more rare, also be built as a Cygwin program.
|
|||
dnl Using "mixed" path like we do here allows the path to work in both cases.
|
||||
case $host in
|
||||
*-*-mingw* ) ABS_SRCDIR=`${srcdir}/Tools/convertpath -m $ABS_SRCDIR` ;;
|
||||
*-*-cygwin* ) ABS_SRCDIR=`cygpath --mixed $ABS_SRCDIR` ;;
|
||||
*-*-cygwin* | *-*-msys*) ABS_SRCDIR=`cygpath --mixed $ABS_SRCDIR` ;;
|
||||
esac
|
||||
|
||||
# Root directory
|
||||
|
@ -2818,7 +2821,7 @@ case $host in
|
|||
esac
|
||||
|
||||
case $host in
|
||||
*-*-cygwin* | *-*-mingw*)
|
||||
*-*-cygwin* | *-*-mingw* | *-*-msys*)
|
||||
# Extra files generated by some Windows compilers
|
||||
EXTRA_CLEAN="*.stackdump *.exp *.lib *.pdb *.ilk"
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue