From c7d7718c21828883a4d8eea585b89185a1eaf150 Mon Sep 17 00:00:00 2001 From: Hirokazu MORIKAWA Date: Mon, 3 May 2021 10:05:48 +0900 Subject: [PATCH] Support for swig 4.1.0 In swig 4.1.0, the complicated handling of "SWIG_V8_VERSION" has been cleaned up a bit. I made the same changes as in this swig. Signed-off-by: Hirokazu MORIKAWA --- CMakeLists.txt | 4 +++- src/carrays_uint32_t.i | 4 ++++ src/common_top.i | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 069e4902..031b64e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,7 +272,9 @@ if (CMAKE_VERSION VERSION_LESS "3.1") endif() else() # 3.1+ uses this generic method to enable c++11 - set (CMAKE_CXX_STANDARD 11) + if(NOT "${CMAKE_CXX_STANDARD}") + set (CMAKE_CXX_STANDARD 11) + endif () set (CXX_STANDARD_REQUIRED ON) set (CXX_EXTENSIONS OFF) endif() diff --git a/src/carrays_uint32_t.i b/src/carrays_uint32_t.i index c458f490..282e9018 100644 --- a/src/carrays_uint32_t.i +++ b/src/carrays_uint32_t.i @@ -24,7 +24,11 @@ %typemap(in) uint32_t { int ecode2 = 0 ; if (($input)->IsInt32()) +%#if (V8_MAJOR_VERSION-0) < 7 $1 = ($input)->Uint32Value(); +%#else + $1 = ($input)->Uint32Value(SWIGV8_CURRENT_CONTEXT()).FromJust(); +%#endif else SWIG_exception_fail(SWIG_ArgError(ecode2), "failed to convert uint32"); } diff --git a/src/common_top.i b/src/common_top.i index ae2b904e..3d61a319 100644 --- a/src/common_top.i +++ b/src/common_top.i @@ -27,7 +27,7 @@ void cleanUp() /* Call the v8 garbage collector as long as there is memory to clean up * See https://codereview.chromium.org/412163003 for this API change */ -#if (SWIG_V8_VERSION < 0x032838) +#if (V8_MAJOR_VERSION-0) < 4 && (SWIG_V8_VERSION < 0x032838) while (!v8::V8::IdleNotificationDeadline()) #else while (!v8::Isolate::GetCurrent()->IdleNotificationDeadline(1000))