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