From 9ce9fc3361decee8ac2381fc0dfcff551927ed7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9verin=20Lemaignan?= Date: Tue, 26 Nov 2013 05:53:44 +0100 Subject: [PATCH] Ensure compilation to Javascript with Emscripten --- modules/core/include/opencv2/core/operations.hpp | 6 ++++-- modules/core/src/system.cpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/core/include/opencv2/core/operations.hpp b/modules/core/include/opencv2/core/operations.hpp index 9569d1abc..4ab7e35f9 100644 --- a/modules/core/include/opencv2/core/operations.hpp +++ b/modules/core/include/opencv2/core/operations.hpp @@ -56,7 +56,7 @@ #define CV_XADD(addr,delta) _InterlockedExchangeAdd(const_cast(reinterpret_cast(addr)), delta) #elif defined __GNUC__ - #if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ + #if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__ && !defined __EMSCRIPTEN__ #ifdef __ATOMIC_SEQ_CST #define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(addr), (delta), __ATOMIC_SEQ_CST) #else @@ -66,7 +66,9 @@ #if !(defined WIN32 || defined _WIN32) && (defined __i486__ || defined __i586__ || \ defined __i686__ || defined __MMX__ || defined __SSE__ || defined __ppc__) || \ - (defined __GNUC__ && defined _STLPORT_MAJOR) + (defined __GNUC__ && defined _STLPORT_MAJOR) || \ + defined __EMSCRIPTEN__ + #define CV_XADD __sync_fetch_and_add #else #include diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp index 88993630e..88f13d622 100644 --- a/modules/core/src/system.cpp +++ b/modules/core/src/system.cpp @@ -126,7 +126,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix) #include -#if defined __linux__ || defined __APPLE__ +#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ #include #include #include