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
d9cea3b8
Commit
d9cea3b8
authored
Jun 19, 2013
by
hbristow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Compiling matlab from sources now appears as a single target
parent
0c726a3f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
16 deletions
+38
-16
CMakeLists.txt
modules/matlab/CMakeLists.txt
+8
-9
debug.py
modules/matlab/generator/jinja2/debug.py
+0
-0
template_class_base.cpp
modules/matlab/generator/templates/template_class_base.cpp
+1
-1
CMakeLists.txt
modules/matlab/test/CMakeLists.txt
+25
-2
cv_exception.cpp
modules/matlab/test/cv_exception.cpp
+4
-4
No files found.
modules/matlab/CMakeLists.txt
View file @
d9cea3b8
...
...
@@ -46,6 +46,9 @@ ocv_add_module(matlab BINDINGS opencv_core opencv_imgproc
opencv_highgui opencv_ml opencv_calib3d opencv_photo
opencv_nonfree opencv_calib
)
set
(
HDR_PARSER_PATH
${
OPENCV_MODULE_opencv_python_LOCATION
}
/src2
)
prepend
(
"-I"
MEX_INCLUDES
${
CMAKE_CURRENT_SOURCE_DIR
}
/include
)
if
(
BUILD_TESTS
)
add_subdirectory
(
test
)
endif
()
...
...
@@ -53,9 +56,6 @@ endif()
# ----------------------------------------------------------------------------
# Configure time components
# ----------------------------------------------------------------------------
set
(
HDR_PARSER_PATH
${
OPENCV_MODULE_opencv_python_LOCATION
}
/src2
)
prepend
(
"-I"
MEX_INCLUDES
${
CMAKE_CURRENT_SOURCE_DIR
}
/include
)
message
(
"-- Trying to generate Matlab code"
)
execute_process
(
COMMAND
${
PYTHON_EXECUTABLE
}
...
...
@@ -102,7 +102,6 @@ string(REPLACE "opencv_" "" OPENCV_MATLAB_MODULES "${OPENCV_MODULE_${the_module}
foreach
(
module
${
OPENCV_MATLAB_MODULES
}
)
if
(
HAVE_opencv_
${
module
}
)
list
(
APPEND opencv_hdrs
"
${
OPENCV_MODULE_opencv_
${
module
}
_LOCATION
}
/include/opencv2/
${
module
}
.hpp"
)
prepend
(
"-I"
MEX_INCLUDES
"
${
OPENCV_MODULE_opencv_
${
module
}
_LOCATION
}
/include"
)
endif
()
endforeach
()
...
...
@@ -113,15 +112,15 @@ add_custom_target(opencv_matlab_sources ALL
${
opencv_hdrs
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
# get the matlab sources
# compile the matlab sources to mex
add_custom_target
(
opencv_matlab ALL
)
file
(
GLOB SOURCE_FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/src/*.cpp"
)
foreach
(
SOURCE_FILE
${
SOURCE_FILES
}
)
get_filename_component
(
FILENAME
${
SOURCE_FILE
}
NAME_WE
)
# compile the source file using mex
add_custom_target
(
"opencv_matlab_
${
FILENAME
}
"
ALL
COMMAND
"/usr/bin/true"
#COMMAND ${MATLAB_MEX_SCRIPT} ${MEX_INCLUDES}
# ${SOURCE_FILE}
add_custom_command
(
TARGET opencv_matlab PRE_BUILD
COMMAND echo
${
MATLAB_MEX_SCRIPT
}
${
MEX_INCLUDES
}
${
SOURCE_FILE
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/src
DEPENDS opencv_matlab_sources
)
...
...
modules/matlab/generator/jinja2/debug.py
0 → 100644
View file @
d9cea3b8
This diff is collapsed.
Click to expand it.
modules/matlab/generator/templates/template_class_base.cpp
View file @
d9cea3b8
...
...
@@ -34,7 +34,7 @@ std::vector<Bridge> {{function.name}}({{clss.name}}& inst, const std::vector<Bri
}
catch
(
std
::
exception
&
e
)
{
mexErrMsgTxt
(
std
::
string
(
"std::exception caught: "
).
append
(
e
.
what
()).
c_str
());
}
catch
(...)
{
mexErrMsgTxt
(
"Uncaught exception occurred in {{fun.name}}"
);
mexErrMsgTxt
(
"Uncaught exception occurred in {{fun
ction
.name}}"
);
}
...
...
modules/matlab/test/CMakeLists.txt
View file @
d9cea3b8
# compile the test sources
file
(
GLOB SOURCE_FILES
"*.cpp"
)
add_custom_target
(
opencv_test_matlab_sources ALL
)
foreach
(
SOURCE_FILE
${
SOURCE_FILES
}
)
get_filename_component
(
FILENAME
${
SOURCE_FILE
}
NAME_WE
)
# compile the source file using mex
add_custom_command
(
TARGET opencv_test_matlab_sources PRE_BUILD
COMMAND echo
${
MATLAB_MEX_SCRIPT
}
${
MEX_INCLUDES
}
${
SOURCE_FILE
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
endforeach
()
# copy the test files into the build dir
file
(
GLOB TEST_FILES
"*.m"
)
foreach
(
TEST_FILE
${
TEST_FILES
}
)
add_custom_command
(
TARGET opencv_test_matlab_sources PRE_BUILD
COMMAND
${
CMAKE_COMMAND
}
-E
copy
${
TEST_FILE
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
endforeach
()
# run the matlab test suite
add_test
(
opencv_
matlab_test
add_test
(
opencv_
test_matlab
COMMAND
${
MATLAB_BIN
}
"-nodisplay"
"-r"
"testsuite.m"
WORKING_DIRECTORY
${
CMAKE_CURRENT_
SOURCE
_DIR
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_
BINARY
_DIR
}
)
modules/matlab/test/cv_exception.cpp
View file @
d9cea3b8
...
...
@@ -7,7 +7,7 @@
* Copyright 2013 The OpenCV Foundation
*/
#include <exception>
#include <opencv2/core.hpp>
//
#include <opencv2/core.hpp>
#include "mex.h"
/*
...
...
@@ -24,9 +24,9 @@ void mexFunction(int nlhs, mxArray* plhs[],
// call the opencv function
// [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
try
{
throw
cv
::
exception
;
}
catch
(
cv
::
exception
&
e
)
{
mexErrMsgTxt
(
e
.
what
());
//
throw cv::exception;
//
} catch(cv::exception& e) {
//
mexErrMsgTxt(e.what());
}
catch
(...)
{
mexErrMsgTxt
(
"Incorrect exception caught!"
);
}
...
...
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