Browse Source

CEF3 msvc C++20 fix (#975)

* Create msvc_cpp20.patch

* Update msvc_cpp20.patch

* Add a patch to fix CEF3 when using msvc C++20
yamashi 3 years ago
parent
commit
5a308fe05b
2 changed files with 20 additions and 0 deletions
  1. 18 0
      packages/c/cef/patches/97.1.9/msvc_cpp20.patch
  2. 2 0
      packages/c/cef/xmake.lua

+ 18 - 0
packages/c/cef/patches/97.1.9/msvc_cpp20.patch

@@ -0,0 +1,18 @@
+diff --git a/include/base/cef_template_util.h b/include/base/cef_template_util.h
+index 02e2ead06..a77cf643a 100644
+--- a/include/base/cef_template_util.h
++++ b/include/base/cef_template_util.h
+@@ -276,8 +276,13 @@ struct negation : bool_constant<!static_cast<bool>(B::value)> {};
+ // References:
+ // [1] https://en.cppreference.com/w/cpp/types/result_of
+ // [2] https://wg21.link/meta.trans.other#lib:invoke_result
++#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
++template <typename Functor, typename... Args>
++using invoke_result = std::invoke_result<Functor, Args...>;
++#else
+ template <typename Functor, typename... Args>
+ using invoke_result = std::result_of<Functor && (Args && ...)>;
++#endif
+ 
+ // Implementation of C++17's std::invoke_result_t.
+ //

+ 2 - 0
packages/c/cef/xmake.lua

@@ -32,6 +32,8 @@ package("cef")
         add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true})
         add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MT", type = "string", readonly = true})
     end
     end
 
 
+    add_patches("97.7.9", path.join(os.scriptdir(), "patches", "97.1.9", "msvc_cpp20.patch"), "28562870ae1dd30eaa42a9297ad76eae8f80422cdf3638674c80e51768fb520d")
+
     add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
     add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
     
     
     if is_plat("windows") then
     if is_plat("windows") then