From fe45a688ef1d8f3862005fc8d5c7b4f0a12545e2 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 14 Mar 2022 18:36:36 +0000 Subject: [PATCH 1/8] Appveyor changes to use Visual Studio 2022 image - Mingw/MSYS2 now running on VS2022 image updating to python-3.10 and jdk-17. - Added Visual 2022 C++ compiler, version 19.3 to build (python-3.10) on VS2022 image. - Update cygwin to use VS2022 image. --- appveyor.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 52ad130cb..5261ef460 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,6 +23,8 @@ environment: - SWIGLANG: python VSVER: 14 VER: 27 + - BUILDSYSTEM: cmake + VSVER: 14 - SWIGLANG: python VSVER: 15 VER: 38 @@ -33,19 +35,23 @@ environment: VER: 39 PY3: 3 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + - SWIGLANG: python + VSVER: 17 + VER: 310 + PY3: 3 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - SWIGLANG: python OSVARIANT: cygwin + 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 + VER: 310 PY3: 3 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - BUILDSYSTEM: cmake - VSVER: 14 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 matrix: allow_failures: @@ -77,7 +83,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 +100,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) { From 1da824ceff9388783ef8b56f5f14fc8aab1c7bec Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 14 Mar 2022 19:02:31 +0000 Subject: [PATCH 2/8] Fix compiler warning using Java std::wstring Fixes: conversion from 'size_t' to 'jsize', possible loss of data --- Lib/java/std_wstring.i | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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]; From 7f9727873988ad875c994ad3235b4ecd22606021 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 14 Mar 2022 19:09:46 +0000 Subject: [PATCH 3/8] Testcase correction for using declaration and members The compiler calls setWindowGrab(bool) instead of setWindowsGrab(NativeWindowType*) and gives a warning with Visual C++ when calling setWindowGrab(true) with a pointer to ApplicationContextSDL. Looks like function function hiding of the non-virtual method. I can't see this changing testing of the original bug. --- Examples/test-suite/director_using_member_scopes.i | 4 ++-- Examples/test-suite/using_member_scopes.i | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 From a9a110fbaea08b2131c35a9d5fb7862d6408db10 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Tue, 15 Mar 2022 20:38:17 +0000 Subject: [PATCH 4/8] cpp11_result_of testcase and result_of deprecation in c++17 Avoid deprecations warnings using c++17 and later compiler. Keep testing using c++11 and c++14 compilers. Provide simple alternative to keep run time tests working with c++17 and later compilers. --- Examples/test-suite/cpp11_result_of.i | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) 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; } %} From ade890854d57cdcce625097c8a4c3209a84a1b54 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 16 Mar 2022 13:07:20 +0000 Subject: [PATCH 5/8] Fix detection of python .lib file for 2 digits in minor version --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 640c4de0f..7bd9f637f 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 From c0f20ff7e0fcc33573854258c63a69c078311bb1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 16 Mar 2022 18:21:31 +0000 Subject: [PATCH 6/8] mingw - install python from pacman Python 3.8 stopped shipping libpython38.a with the main Python distribution which is required for linking using mingw. --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 5261ef460..0a090a5cb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -49,7 +49,6 @@ environment: - SWIGLANG: python OSVARIANT: mingw WITHLANG: python - VER: 310 PY3: 3 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 @@ -135,13 +134,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%"=="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" From b433ef94159ed523fb18717434921d7f8eaeb9e3 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 16 Mar 2022 20:20:55 +0000 Subject: [PATCH 7/8] Last resort to use /usr/lib in python linking --- configure.ac | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index 7bd9f637f..a7f41a3ba 100644 --- a/configure.ac +++ b/configure.ac @@ -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" ;; From 40f711d11e0c5cbcb59d82aa7d7d0073501f7e8a Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Wed, 16 Mar 2022 23:05:35 +0000 Subject: [PATCH 8/8] Cygwin testing - test python3 (3.9) instead of python-2.7 --- appveyor.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0a090a5cb..e5b2250ae 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -42,6 +42,7 @@ environment: APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - SWIGLANG: python OSVARIANT: cygwin + PY3: 3 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - SWIGLANG: java OSVARIANT: mingw @@ -52,10 +53,10 @@ environment: PY3: 3 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 -matrix: - allow_failures: - - SWIGLANG: python - OSVARIANT: cygwin +#matrix: +# allow_failures: +# - SWIGLANG: python +# OSVARIANT: cygwin # Skip stale commits (pull requests only), see https://github.com/appveyor/ci/issues/38#issuecomment-70628826 init: @@ -139,7 +140,7 @@ install: - 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%"=="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%