Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: ports/opencv/nacl.patch

Issue 76153002: OpenCV 2.4.7 porting to PNaCl (Closed) Base URL: https://chromium.googlesource.com/external/naclports.git@master
Patch Set: sbc@ comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 diff --git opencv-v2.4.7/XCompile-nacl.txt opencv-v2.4.7.nacl/XCompile-nacl.txt
2 new file mode 100644
3 index 0000000..c651a2a
4 --- /dev/null
5 +++ opencv-2.4.7.nacl/XCompile-nacl.txt
6 @@ -0,0 +1,17 @@
7 +# the name of the target operating system
8 +SET(CMAKE_SYSTEM_NAME Linux)
9 +
10 +SET(NACL_CROSS_PREFIX nacl)
11 +
12 +# which compilers to use for C and C++
13 +SET(CMAKE_C_COMPILER "${NACLCC}")
14 +SET(CMAKE_CXX_COMPILER "${NACLCXX}")
15 +set(CMAKE_AR ${NACLAR} CACHE FILEPATH "Archiver")
16 +SET(CMAKE_LINKER "${NACLLD}")
17 +SET(_CMAKE_TOOLCHAIN_PREFIX ${NACL_CROSS_PREFIX})
18 +
19 +# here is the target environment located
20 +SET(CMAKE_FIND_ROOT_PATH ${NACL_TOOLCHAIN_ROOT})
21 +
22 +# nacl abi says 32bits little endian
23 +set(CMAKE_SIZEOF_VOID_P 4)
24 diff -Naur opencv-2.4.7/modules/contrib/src/inputoutput.cpp opencv-2.4.7.nacl/mo dules/contrib/src/inputoutput.cpp
25 --- opencv-2.4.7/modules/contrib/src/inputoutput.cpp 2013-11-06 15:26:39.0000 00000 +0100
26 +++ opencv-2.4.7.nacl/modules/contrib/src/inputoutput.cpp 2013-11-19 21:00 :51.000000000 +0100
27 @@ -76,7 +76,8 @@
28 {
29 return list;
30 }
31 -
32 +// NaCl does not define struct fields to deal with folders.
33 +#ifndef __native_client__
34 while ((dirp = readdir(dp)) != NULL)
35 {
36 if (dirp->d_type == DT_REG)
37 @@ -89,6 +90,7 @@
38 }
39 }
40 closedir(dp);
41 +#endif //#ifndef __native__client__
42 #endif
43
44 return list;
45 @@ -166,7 +168,8 @@
46 {
47 return list;
48 }
49 -
50 +// NaCl does not define struct fields to deal with folders.
51 +#ifndef __native_client__
52 while ((dirp = readdir(dp)) != NULL)
53 {
54 if (dirp->d_type == DT_DIR &&
55 @@ -181,6 +184,8 @@
56 }
57 }
58 closedir(dp);
59 +#endif //#ifndef __native__client__
60 +
61 #endif
62
63 return list;
64 diff -Naur opencv-2.4.7/modules/core/include/opencv2/core/operations.hpp opencv- 2.4.7.nacl/modules/core/include/opencv2/core/operations.hpp
65 --- opencv-2.4.7/modules/core/include/opencv2/core/operations.hpp 2013-11- 06 15:26:39.000000000 +0100
66 +++ opencv-2.4.7.nacl/modules/core/include/opencv2/core/operations.hpp 2013-11- 19 21:03:40.000000000 +0100
67 @@ -58,7 +58,13 @@
68
69 #if defined __clang__ && __clang_major__ >= 3 && !defined __ANDROID__
70 #ifdef __ATOMIC_SEQ_CST
71 + // Clang in NaCl "cannot compile this atomic library call yet": use
72 + // instead a programmatic atomic fetch.
73 + #ifndef __native_client__
74 #define CV_XADD(addr, delta) __c11_atomic_fetch_add((_Atomic(int)*)(add r), (delta), __ATOMIC_SEQ_CST)
75 + #else
76 + int CV_XADD(int* addr, int delta) { int tmp = *addr; *addr += delta; re turn tmp; }
77 +#endif //#ifndef __native_client__
78 #else
79 #define CV_XADD(addr, delta) __atomic_fetch_add((_Atomic(int)*)(addr), (delta), 5)
80 #endif
81 diff -Naur opencv-2.4.7/modules/flann/include/opencv2/flann/allocator.h opencv-2 .4.7.nacl/modules/flann/include/opencv2/flann/allocator.h
82 --- opencv-2.4.7/modules/flann/include/opencv2/flann/allocator.h 2013-11- 06 15:26:39.000000000 +0100
83 +++ opencv-2.4.7.nacl/modules/flann/include/opencv2/flann/allocator.h 2013-11- 19 21:04:57.000000000 +0100
84 @@ -68,7 +68,10 @@
85 *
86 */
87
88 +// In NaCl newlib, this variable is declared elsewhere non-const.
89 +#if defined(__native_client__) && defined(__GLIBC__)
90 const size_t WORDSIZE=16;
91 +#endif //#ifndef __native__client__
92 const size_t BLOCKSIZE=8192;
93
94 class PooledAllocator
95 diff -Naur opencv-2.4.7/modules/legacy/src/calibfilter.cpp opencv-2.4.7.nacl/mod ules/legacy/src/calibfilter.cpp
96 --- opencv-2.4.7/modules/legacy/src/calibfilter.cpp 2013-11-06 15:26:39.0000 00000 +0100
97 +++ opencv-2.4.7.nacl/modules/legacy/src/calibfilter.cpp 2013-11-19 21:05 :54.000000000 +0100
98 @@ -42,7 +42,10 @@
99 #include "precomp.hpp"
100 #include <stdio.h>
101
102 +// NaCl likes this preprocessor definition active, to use a struct field.
103 +#ifndef __native_client__
104 #undef quad
105 +#endif //#ifndef __native_client__
106
107 CvCalibFilter::CvCalibFilter()
108 {
109 diff -Naur opencv-2.4.7/modules/legacy/src/epilines.cpp opencv-2.4.7.nacl/module s/legacy/src/epilines.cpp
110 --- opencv-2.4.7/modules/legacy/src/epilines.cpp 2013-11-06 15:26:39.0000 00000 +0100
111 +++ opencv-2.4.7.nacl/modules/legacy/src/epilines.cpp 2013-11-19 21:06:08.0000 00000 +0100
112 @@ -46,7 +46,10 @@
113
114 /* Valery Mosyagin */
115
116 +// NaCl likes this preprocessor definition active, to use a struct field.
117 +#ifndef __native_client__
118 #undef quad
119 +#endif //#ifndef __native_client__
120
121 #define EPS64D 1e-9
122
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698