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
fd0df5a8
Commit
fd0df5a8
authored
Sep 08, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12469 from cv3d:fix/js/python3_msvc
parents
40b1dc12
b487e2df
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
10 deletions
+29
-10
CMakeLists.txt
modules/js/CMakeLists.txt
+8
-3
embindgen.py
modules/js/src/embindgen.py
+21
-7
No files found.
modules/js/CMakeLists.txt
View file @
fd0df5a8
...
...
@@ -66,9 +66,14 @@ link_libraries(${OPENCV_MODULE_${the_module}_DEPS})
ocv_add_executable
(
${
the_module
}
${
bindings_cpp
}
)
set_target_properties
(
${
the_module
}
PROPERTIES COMPILE_FLAGS
"-Wno-missing-prototypes"
)
set_target_properties
(
${
the_module
}
PROPERTIES LINK_FLAGS
"--memory-init-file 0 -s TOTAL_MEMORY=134217728 -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s EXPORT_NAME=
\"
'cv'
\"
-s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1 --use-preload-plugins --bind --post-js
${
JS_HELPER
}
-Wno-missing-prototypes"
)
set
(
COMPILE_FLAGS
""
)
if
(
NOT CMAKE_CXX_COMPILER_ID MATCHES
"MSVC"
)
set
(
COMPILE_FLAGS
"
${
COMPILE_FLAGS
}
-Wno-missing-prototypes"
)
endif
()
if
(
COMPILE_FLAGS
)
set_target_properties
(
${
the_module
}
PROPERTIES COMPILE_FLAGS
${
COMPILE_FLAGS
}
)
endif
()
set_target_properties
(
${
the_module
}
PROPERTIES LINK_FLAGS
"--memory-init-file 0 -s TOTAL_MEMORY=134217728 -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s EXPORT_NAME=
\"
'cv'
\"
-s DEMANGLE_SUPPORT=1 -s FORCE_FILESYSTEM=1 --use-preload-plugins --bind --post-js
${
JS_HELPER
}
${
COMPILE_FLAGS
}
"
)
# add UMD wrapper
set
(
MODULE_JS_PATH
"
${
OpenCV_BINARY_DIR
}
/bin/
${
the_module
}
.js"
)
...
...
modules/js/src/embindgen.py
View file @
fd0df5a8
...
...
@@ -70,7 +70,6 @@
from
__future__
import
print_function
import
sys
,
re
,
os
from
templates
import
*
from
sets
import
Set
if
sys
.
version_info
[
0
]
>=
3
:
from
io
import
StringIO
...
...
@@ -185,7 +184,7 @@ class ClassInfo(object):
self
.
consts
=
{}
customname
=
False
self
.
jsfuncs
=
{}
self
.
constructor_arg_num
=
S
et
()
self
.
constructor_arg_num
=
s
et
()
self
.
has_smart_ptr
=
False
...
...
@@ -369,14 +368,23 @@ class JSWrapperGenerator(object):
return
namespace
,
classes
,
chunks
[
-
1
]
def
add_enum
(
self
,
decl
):
name
=
decl
[
1
]
name
=
decl
[
0
]
.
rsplit
(
" "
,
1
)[
1
]
namespace
,
classes
,
val
=
self
.
split_decl_name
(
name
)
namespace
=
'.'
.
join
(
namespace
)
ns
=
self
.
namespaces
.
setdefault
(
namespace
,
Namespace
())
if
len
(
name
)
==
0
:
name
=
"<unnamed>"
if
name
.
endswith
(
"<unnamed>"
):
i
=
0
while
True
:
i
+=
1
candidate_name
=
name
.
replace
(
"<unnamed>"
,
"unnamed_
%
u"
%
i
)
if
candidate_name
not
in
ns
.
enums
:
name
=
candidate_name
break
;
val
=
'_'
.
join
(
classes
+
[
name
])
cname
=
name
.
replace
(
'.'
,
'::'
)
ns
=
self
.
namespaces
.
setdefault
(
namespace
,
Namespace
())
if
name
in
ns
.
enums
:
print
(
"Generator warning:
constant
%
s (cname=
%
s) already exists"
\
print
(
"Generator warning:
enum
%
s (cname=
%
s) already exists"
\
%
(
name
,
cname
))
# sys.exit(-1)
else
:
...
...
@@ -384,6 +392,12 @@ class JSWrapperGenerator(object):
for
item
in
decl
[
3
]:
ns
.
enums
[
name
]
.
append
(
item
)
const_decls
=
decl
[
3
]
for
decl
in
const_decls
:
name
=
decl
[
0
]
self
.
add_const
(
name
.
replace
(
"const "
,
""
)
.
strip
(),
decl
)
def
add_const
(
self
,
name
,
decl
):
cname
=
name
.
replace
(
'.'
,
'::'
)
namespace
,
classes
,
name
=
self
.
split_decl_name
(
name
)
...
...
@@ -803,7 +817,7 @@ class JSWrapperGenerator(object):
continue
# Generate bindings for methods
for
method_name
,
method
in
class_info
.
methods
.
ite
rite
ms
():
for
method_name
,
method
in
class_info
.
methods
.
items
():
if
method
.
cname
in
ignore_list
:
continue
if
not
method
.
name
in
white_list
[
method
.
class_name
]:
...
...
@@ -833,7 +847,7 @@ class JSWrapperGenerator(object):
class_bindings
.
append
(
smart_ptr_reg_template
.
substitute
(
cname
=
class_info
.
cname
,
name
=
class_info
.
name
))
# Attach external constructors
# for method_name, method in class_info.ext_constructors.ite
rite
ms():
# for method_name, method in class_info.ext_constructors.items():
# print("ext constructor", method_name)
#if class_info.ext_constructors:
...
...
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