Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
d52cef17
Commit
d52cef17
authored
Aug 31, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
js: use generated list of OpenCV headers
- replaces hand-written list
parent
32a02544
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
8 deletions
+8
-8
CMakeLists.txt
modules/js/CMakeLists.txt
+1
-1
core_bindings.cpp
modules/js/src/core_bindings.cpp
+2
-7
embindgen.py
modules/js/src/embindgen.py
+5
-0
No files found.
modules/js/CMakeLists.txt
View file @
d52cef17
...
@@ -56,7 +56,7 @@ add_custom_command(
...
@@ -56,7 +56,7 @@ add_custom_command(
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/embindgen.py
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/embindgen.py
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/templates.py
DEPENDS
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/templates.py
DEPENDS
${
scripts_hdr_parser
}
DEPENDS
${
scripts_hdr_parser
}
DEPENDS
${
CMAKE_CURRENT_BINARY_DIR
}
/headers.txt
#(not needed - generated by CMake)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/headers.txt
DEPENDS
${
opencv_hdrs
}
DEPENDS
${
opencv_hdrs
}
DEPENDS
${
JS_HELPER
}
)
DEPENDS
${
JS_HELPER
}
)
...
...
modules/js/src/core_bindings.cpp
View file @
d52cef17
...
@@ -68,15 +68,10 @@
...
@@ -68,15 +68,10 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//M*/
//M*/
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/video/background_segm.hpp"
#include "opencv2/objdetect.hpp"
#include "opencv2/dnn.hpp"
#include <emscripten/bind.h>
#include <emscripten/bind.h>
@
INCLUDES
@
using
namespace
emscripten
;
using
namespace
emscripten
;
using
namespace
cv
;
using
namespace
cv
;
using
namespace
dnn
;
using
namespace
dnn
;
...
...
modules/js/src/embindgen.py
View file @
d52cef17
...
@@ -733,12 +733,14 @@ class JSWrapperGenerator(object):
...
@@ -733,12 +733,14 @@ class JSWrapperGenerator(object):
def
gen
(
self
,
dst_file
,
src_files
,
core_bindings
):
def
gen
(
self
,
dst_file
,
src_files
,
core_bindings
):
# step 1: scan the headers and extract classes, enums and functions
# step 1: scan the headers and extract classes, enums and functions
headers
=
[]
for
hdr
in
src_files
:
for
hdr
in
src_files
:
decls
=
self
.
parser
.
parse
(
hdr
)
decls
=
self
.
parser
.
parse
(
hdr
)
# print(hdr);
# print(hdr);
# self.print_decls(decls);
# self.print_decls(decls);
if
len
(
decls
)
==
0
:
if
len
(
decls
)
==
0
:
continue
continue
headers
.
append
(
hdr
[
hdr
.
rindex
(
'opencv2/'
):])
for
decl
in
decls
:
for
decl
in
decls
:
name
=
decl
[
0
]
name
=
decl
[
0
]
type
=
name
[:
name
.
find
(
" "
)]
type
=
name
[:
name
.
find
(
" "
)]
...
@@ -890,6 +892,9 @@ class JSWrapperGenerator(object):
...
@@ -890,6 +892,9 @@ class JSWrapperGenerator(object):
with
open
(
core_bindings
)
as
f
:
with
open
(
core_bindings
)
as
f
:
ret
=
f
.
read
()
ret
=
f
.
read
()
header_includes
=
'
\n
'
.
join
([
'#include "{}"'
.
format
(
hdr
)
for
hdr
in
headers
])
ret
=
ret
.
replace
(
'@INCLUDES@'
,
header_includes
)
defis
=
'
\n
'
.
join
(
self
.
wrapper_funcs
)
defis
=
'
\n
'
.
join
(
self
.
wrapper_funcs
)
ret
+=
wrapper_codes_template
.
substitute
(
ns
=
wrapper_namespace
,
defs
=
defis
)
ret
+=
wrapper_codes_template
.
substitute
(
ns
=
wrapper_namespace
,
defs
=
defis
)
ret
+=
emscripten_binding_template
.
substitute
(
binding_name
=
'testBinding'
,
bindings
=
''
.
join
(
self
.
bindings
))
ret
+=
emscripten_binding_template
.
substitute
(
binding_name
=
'testBinding'
,
bindings
=
''
.
join
(
self
.
bindings
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment