diff --git a/Examples/test-suite/cpp11_result_of.i b/Examples/test-suite/cpp11_result_of.i index 8a26c5f24..44e7299b0 100644 --- a/Examples/test-suite/cpp11_result_of.i +++ b/Examples/test-suite/cpp11_result_of.i @@ -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 typedef double(*fn_ptr)(double); %} +%{ +#if __cplusplus >= 201703L +namespace std { + // Forward declaration of result_of + template struct result_of; + // Add in the required partial specialization of result_of + template<> struct result_of< fn_ptr(double) > { + typedef double type; + }; +} +#else +#include +#endif +%} + namespace std { // Forward declaration of result_of template 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 @@ -49,7 +59,6 @@ void cpp_testing() { std::cout << "result: " << test_result_impl(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; } %} diff --git a/Examples/test-suite/director_using_member_scopes.i b/Examples/test-suite/director_using_member_scopes.i index 9e359539c..d2776ea1e 100644 --- a/Examples/test-suite/director_using_member_scopes.i +++ b/Examples/test-suite/director_using_member_scopes.i @@ -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); } diff --git a/Examples/test-suite/using_member_scopes.i b/Examples/test-suite/using_member_scopes.i index bfd09902c..354988a0b 100644 --- a/Examples/test-suite/using_member_scopes.i +++ b/Examples/test-suite/using_member_scopes.i @@ -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 diff --git a/Lib/java/std_wstring.i b/Lib/java/std_wstring.i index dd0b2f5ff..3e462256a 100644 --- a/Lib/java/std_wstring.i +++ b/Lib/java/std_wstring.i @@ -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]; diff --git a/appveyor.yml b/appveyor.yml index c6485cc65..b1783c7c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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" diff --git a/configure.ac b/configure.ac index 640c4de0f..a7f41a3ba 100644 --- a/configure.ac +++ b/configure.ac @@ -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" ;;