Merge remote-tracking branch 'wsfulton/appveyor-vs2022'

* wsfulton/appveyor-vs2022:
  Cygwin testing - test python3 (3.9) instead of python-2.7
  Last resort to use /usr/lib in python linking
  mingw - install python from pacman
  Fix detection of python .lib file for 2 digits in minor version
  cpp11_result_of testcase and result_of deprecation in c++17
  Testcase correction for using declaration and members
  Fix compiler warning using Java std::wstring
  Appveyor changes to use Visual Studio 2022 image
This commit is contained in:
William S Fulton 2022-03-17 08:23:13 +00:00
commit 06364ae749
6 changed files with 55 additions and 34 deletions

View file

@ -2,11 +2,28 @@
and its templating capabilities introduced in C++11. */
%module cpp11_result_of
// std::result_of is deprecated in C++17
// Replace std implementation with a simple implementation in order to continue testing with C++17 compilers and later
%inline %{
#include <functional>
typedef double(*fn_ptr)(double);
%}
%{
#if __cplusplus >= 201703L
namespace std {
// Forward declaration of result_of
template<typename Func> struct result_of;
// Add in the required partial specialization of result_of
template<> struct result_of< fn_ptr(double) > {
typedef double type;
};
}
#else
#include <functional>
#endif
%}
namespace std {
// Forward declaration of result_of
template<typename Func> struct result_of;
@ -34,13 +51,6 @@ std::result_of< fn_ptr(double) >::type test_result_alternative1(double(*fun)(dou
}
%}
%{
// Another alternative approach using decltype (not very SWIG friendly)
std::result_of< decltype(square)&(double) >::type test_result_alternative2(double(*fun)(double), double arg) {
return fun(arg);
}
%}
%inline %{
#include <iostream>
@ -49,7 +59,6 @@ void cpp_testing() {
std::cout << "result: " << test_result_impl<double(*)(double), double>(square, 4) << std::endl;
std::cout << "result: " << test_result_impl< fn_ptr, double >(square, 5) << std::endl;
std::cout << "result: " << test_result_alternative1(square, 6) << std::endl;
std::cout << "result: " << test_result_alternative2(square, 7) << std::endl;
}
%}

View file

@ -26,7 +26,7 @@ namespace OgreBites
class ApplicationContextSDL : public ApplicationContextBase {
public:
using ApplicationContextBase::setWindowGrab;
int setWindowGrab(NativeWindowType* win, bool grab) { return 10; } // This should not be added again as it exists in base class
int setWindowGrab(NativeWindowType* win, bool grab = true) { return 10; } // This should not be added again as it exists in base class
static int call_setWindowGrab(ApplicationContextSDL* ptr, NativeWindowType* win, bool grab) { return ptr->setWindowGrab(win, grab); }
};
@ -44,7 +44,7 @@ namespace OgreBites
class ACSDL : public ACB {
public:
using ACB::setWindowGrab; // This introduces two methods, not one method like ApplicationContextSDL
int setWindowGrab(NativeWindowType* win, bool grab) { return 10; } // This should not be added again as it exists in base class
int setWindowGrab(NativeWindowType* win, bool grab = true) { return 10; } // This should not be added again as it exists in base class
static int call_setWindowGrab(ACSDL* ptr, NativeWindowType* win, bool grab) { return ptr->setWindowGrab(win, grab); }
static int call_setWindowGrab(ACSDL* ptr, const char *s, int val) { return ptr->setWindowGrab(s, val); }

View file

@ -16,7 +16,7 @@ namespace OgreBites
class ApplicationContextSDL : public ApplicationContextBase {
public:
using ApplicationContextBase::setWindowGrab;
void setWindowGrab(NativeWindowType* win, bool grab) {} // This should not be added again as it exists in base class
void setWindowGrab(NativeWindowType* win, bool grab = true) {} // This should not be added again as it exists in base class
};
/*
typedef not working yet

View file

@ -60,7 +60,7 @@ class wstring;
%}
%typemap(directorin,descriptor="Ljava/lang/String;") wstring %{
jsize $1_len = $1.length();
jsize $1_len = (jsize)$1.length();
jchar *$1_conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
$1_conv_buf[i] = (jchar)$1[i];
@ -71,7 +71,7 @@ class wstring;
%}
%typemap(out) wstring
%{jsize $1_len = $1.length();
%{jsize $1_len = (jsize)$1.length();
jchar *conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
conv_buf[i] = (jchar)$1[i];
@ -138,7 +138,7 @@ class wstring;
jenv->ReleaseStringChars($input, $1_pstr); %}
%typemap(directorin,descriptor="Ljava/lang/String;") const wstring & %{
jsize $1_len = $1.length();
jsize $1_len = (jsize)$1.length();
jchar *$1_conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
$1_conv_buf[i] = (jchar)($1)[i];
@ -149,7 +149,7 @@ class wstring;
%}
%typemap(out) const wstring &
%{jsize $1_len = $1->length();
%{jsize $1_len = (jsize)$1->length();
jchar *conv_buf = new jchar[$1_len];
for (jsize i = 0; i < $1_len; ++i) {
conv_buf[i] = (jchar)(*$1)[i];

View file

@ -24,6 +24,8 @@ environment:
VSVER: 14
VER: 27
PY2: 2
- BUILDSYSTEM: cmake
VSVER: 14
- SWIGLANG: python
VSVER: 15
VER: 38
@ -32,25 +34,25 @@ environment:
VSVER: 16
VER: 39
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- SWIGLANG: python
VSVER: 17
VER: 310
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- SWIGLANG: python
OSVARIANT: cygwin
PY2: 2
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- SWIGLANG: java
OSVARIANT: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
- SWIGLANG: python
OSVARIANT: mingw
WITHLANG: python
VER: 37
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
- BUILDSYSTEM: cmake
VSVER: 14
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
matrix:
allow_failures:
- SWIGLANG: python
OSVARIANT: cygwin
PY2: 2
#matrix:
# allow_failures:
# - SWIGLANG: python
# OSVARIANT: cygwin
# Skip stale commits (pull requests only), see https://github.com/appveyor/ci/issues/38#issuecomment-70628826
init:
@ -77,7 +79,7 @@ install:
$env:VSARCH=""
} else {
$env:PCRE_PLATFORM="x64"
$env:JAVA_HOME="C:/Program Files/Java/jdk15"
$env:JAVA_HOME="C:/Program Files/Java/jdk17"
$env:VCVARS_PLATFORM="amd64"
$env:LANG_PLATFORM="-x64"
$env:CYGWINBIN="C:\cygwin64\bin"
@ -94,7 +96,10 @@ install:
$env:CYGWIN="nodosfilewarning"
$env:CC="cccl"
$env:CXX="cccl"
if ($env:VSVER -ge 16) {
if ($env:VSVER -ge 17) {
$env:VCVARSBAT="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars$env:MBITS.bat"
$env:BOOSTROOT="C:/Libraries/boost_1_77_0"
} elseif ($env:VSVER -eq 16) {
$env:VCVARSBAT="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars$env:MBITS.bat"
$env:BOOSTROOT="C:/Libraries/boost_1_73_0"
} elseif ($env:VSVER -eq 15) {
@ -126,13 +131,13 @@ install:
- if "%OSVARIANT%"=="" appveyor-retry appveyor DownloadFile https://github.com/PhilipHazel/pcre2/archive/refs/tags/pcre2-10.39.zip
- if "%OSVARIANT%"=="" 7z x pcre2-10.39.zip
- if "%OSVARIANT%"=="" set PCRE_ROOT=C:/pcre
- if not "%OSVARIANT%"=="cygwin" set PATH=C:\Python%VER%%LANG_PLATFORM%;%PATH%
- if "%OSVARIANT%"=="" set PATH=C:\Python%VER%%LANG_PLATFORM%;%PATH%
- if "%OSVARIANT%"=="" bash -c "which cl.exe"
- if "%OSVARIANT%"=="" bash -c "cl.exe /? 2>&1 | head -n 1"
- if "%OSVARIANT%"=="" bash -c "which csc.exe"
- if "%OSVARIANT%"=="" bash -c "csc.exe /? | head -n 1"
- if "%OSVARIANT%"=="cygwin" %CYGWINSETUP% --quiet-mode --packages python2-devel,libpcre2-devel,libboost-devel > cygwin-install.txt || bash -c "cat cygwin-install.txt"
- if "%OSVARIANT%"=="mingw" bash -c "pacman --noconfirm --sync mingw%MBITS%/mingw-w64-%MARCH%-autotools mingw%MBITS%/mingw-w64-%MARCH%-pcre2 mingw%MBITS%/mingw-w64-%MARCH%-boost"
- if "%OSVARIANT%"=="cygwin" %CYGWINSETUP% --quiet-mode --packages python3-devel,libpcre2-devel,libboost-devel > cygwin-install.txt || bash -c "cat cygwin-install.txt"
- if "%OSVARIANT%"=="mingw" bash -c "pacman --noconfirm --sync mingw%MBITS%/mingw-w64-%MARCH%-autotools mingw%MBITS%/mingw-w64-%MARCH%-pcre2 mingw%MBITS%/mingw-w64-%MARCH%-boost mingw%MBITS%/mingw-w64-%MARCH%-python"
- if not "%WITHLANG%"=="" set SWIGWITHLANG==%WITHLANG%
- if not "%WITHLANG%"=="" where %WITHLANG%
- bash -c "which $CC"

View file

@ -708,7 +708,7 @@ else
AC_MSG_CHECKING(for Python library directory)
if test -d $PYPREFIX/libs; then
PYLIB=$PYPREFIX/libs
PYLINKFILE=`ls $PYLIB/python*.lib | grep "python[[0-9]][[0-9]]\.lib"`
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$//'`
else
@ -864,7 +864,7 @@ else
AC_MSG_CHECKING(for Python 3.x library directory)
if test -d $PY3PREFIX/libs; then
PY3LIB=$PY3PREFIX/libs
PY3LINKFILE=`ls $PY3LIB/python*.lib | grep "python[[0-9]][[0-9]]\.lib"`
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$//'`
else
@ -926,6 +926,12 @@ else
break
fi
done
if test -z "$PY3LIB"; then
# Last resort
if test -d $PY3EPREFIX/$PY3LIBDIR; then
PY3LIB="$PY3EPREFIX/$PY3LIBDIR"
fi
fi
if test -z "$PY3LIB"; then
AC_MSG_RESULT([Not found])
else
@ -946,6 +952,7 @@ else
# Cygwin (Windows) needs the library for dynamic linking
case $host in
*-*-cygwin* | *-*-mingw*)
# PYTHON3DYNAMICLINKING ought to be replaced by $PY3CONFIG --ldflags
PYTHON3DYNAMICLINKING="-L$PY3LIB $PY3LINK"
DEFS="-DUSE_DL_IMPORT $DEFS"
;;