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
3b77fa5e
Commit
3b77fa5e
authored
Jun 23, 2013
by
hbristow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved dependency checking
parent
24d5adfd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
14 deletions
+22
-14
CMakeLists.txt
modules/matlab/CMakeLists.txt
+15
-14
compile.cmake
modules/matlab/compile.cmake
+7
-0
No files found.
modules/matlab/CMakeLists.txt
View file @
3b77fa5e
...
@@ -67,13 +67,14 @@ endif()
...
@@ -67,13 +67,14 @@ endif()
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Configure time components
# Configure time components
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
string
(
REPLACE
"opencv_"
""
OPENCV_MATLAB_MODULES
"
${
OPENCV_MODULE_
${
the_module
}
_REQ_DEPS
}
;
set
(
MATLAB_DEPS
${
OPENCV_MODULE_
${
the_module
}
_REQ_DEPS
}
${
OPENCV_MODULE_
${
the_module
}
_OPT_DEPS
}
)
${
OPENCV_MODULE_
${
the_module
}
_OPT_DEPS
}
"
)
foreach
(
opencv_module
${
MATLAB_DEPS
}
)
foreach
(
module
${
OPENCV_MATLAB_MODULES
}
)
if
(
HAVE_
${
opencv_module
}
)
if
(
HAVE_opencv_
${
module
}
)
string
(
REPLACE
"opencv_"
""
module
${
opencv_module
}
)
list
(
APPEND opencv_hdrs
"
${
OPENCV_MODULE_opencv_
${
module
}
_LOCATION
}
/include/opencv2/
${
module
}
.hpp"
)
list
(
APPEND opencv_hdrs
"
${
OPENCV_MODULE_
${
opencv_module
}
_LOCATION
}
/include/opencv2/
${
module
}
.hpp"
)
prepend
(
"-I"
MEX_INCLUDE_DIRS
"
${
OPENCV_MODULE_opencv_
${
module
}
_LOCATION
}
/include"
)
list
(
APPEND
${
the_module
}
_ACTUAL_DEPS
${
opencv_module
}
)
prepend
(
"-l"
MEX_LIBS
"opencv_
${
module
}
"
)
prepend
(
"-I"
MEX_INCLUDE_DIRS
"
${
OPENCV_MODULE_
${
opencv_module
}
_LOCATION
}
/include"
)
prepend
(
"-l"
MEX_LIBS
${
opencv_module
}
)
endif
()
endif
()
endforeach
()
endforeach
()
...
@@ -86,7 +87,7 @@ endforeach()
...
@@ -86,7 +87,7 @@ endforeach()
# - whether the mex compiler can compile a trivial definition
# - whether the mex compiler can compile a trivial definition
if
(
NOT MEX_WORKS
)
if
(
NOT MEX_WORKS
)
# attempt to generate a gateway for a function
# attempt to generate a gateway for a function
message
(
"--
Trying to generate Matlab code"
)
message
(
STATUS
"
Trying to generate Matlab code"
)
execute_process
(
execute_process
(
COMMAND
${
CMAKE_COMMAND
}
-E touch
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/trigger.cpp
COMMAND
${
CMAKE_COMMAND
}
-E touch
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/trigger.cpp
COMMAND
${
PYTHON_EXECUTABLE
}
COMMAND
${
PYTHON_EXECUTABLE
}
...
@@ -98,14 +99,14 @@ if (NOT MEX_WORKS)
...
@@ -98,14 +99,14 @@ if (NOT MEX_WORKS)
if
(
GEN_ERROR
)
if
(
GEN_ERROR
)
message
(
${
GEN_ERROR
}
)
message
(
${
GEN_ERROR
}
)
message
(
"--
Error generating Matlab code. Disabling Matlab bindings..."
)
message
(
STATUS
"
Error generating Matlab code. Disabling Matlab bindings..."
)
return
()
return
()
else
()
else
()
message
(
"--
Trying to generate Matlab code - OK"
)
message
(
STATUS
"
Trying to generate Matlab code - OK"
)
endif
()
endif
()
# attempt to compile a gateway using mex
# attempt to compile a gateway using mex
message
(
"--
Trying to compile mex file"
)
message
(
STATUS
"
Trying to compile mex file"
)
execute_process
(
execute_process
(
COMMAND
${
MATLAB_MEX_SCRIPT
}
${
MEX_OPTS
}
${
MEX_INCLUDE_DIRS
}
COMMAND
${
MATLAB_MEX_SCRIPT
}
${
MEX_OPTS
}
${
MEX_INCLUDE_DIRS
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/test_compiler.cpp
${
CMAKE_CURRENT_SOURCE_DIR
}
/test/test_compiler.cpp
...
@@ -116,10 +117,10 @@ if (NOT MEX_WORKS)
...
@@ -116,10 +117,10 @@ if (NOT MEX_WORKS)
if
(
MEX_ERROR
)
if
(
MEX_ERROR
)
message
(
${
MEX_ERROR
}
)
message
(
${
MEX_ERROR
}
)
message
(
"--
Error compiling mex file. Disabling Matlab bindings..."
)
message
(
STATUS
"
Error compiling mex file. Disabling Matlab bindings..."
)
return
()
return
()
else
()
else
()
message
(
"--
Trying to compile mex file - OK"
)
message
(
STATUS
"
Trying to compile mex file - OK"
)
endif
()
endif
()
endif
()
endif
()
...
@@ -168,7 +169,7 @@ add_custom_command(
...
@@ -168,7 +169,7 @@ add_custom_command(
# opencv_matlab_sources --> opencv_matlab_compile
# opencv_matlab_sources --> opencv_matlab_compile
add_custom_target
(
${
the_module
}
_sources ALL DEPENDS
${
GENERATE_PROXY
}
)
add_custom_target
(
${
the_module
}
_sources ALL DEPENDS
${
GENERATE_PROXY
}
)
add_custom_target
(
${
the_module
}
ALL DEPENDS
${
COMPILE_PROXY
}
)
add_custom_target
(
${
the_module
}
ALL DEPENDS
${
COMPILE_PROXY
}
)
add_dependencies
(
${
the_module
}
${
the_module
}
_sources
)
add_dependencies
(
${
the_module
}
${
the_module
}
_sources
${${
the_module
}
_ACTUAL_DEPS
}
)
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Install time components
# Install time components
...
...
modules/matlab/compile.cmake
View file @
3b77fa5e
...
@@ -5,10 +5,17 @@ endmacro()
...
@@ -5,10 +5,17 @@ endmacro()
listify
(
MEX_INCLUDE_DIRS_LIST
${
MEX_INCLUDE_DIRS
}
)
listify
(
MEX_INCLUDE_DIRS_LIST
${
MEX_INCLUDE_DIRS
}
)
file
(
GLOB SOURCE_FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/src/*.cpp"
)
file
(
GLOB SOURCE_FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/src/*.cpp"
)
foreach
(
SOURCE_FILE
${
SOURCE_FILES
}
)
foreach
(
SOURCE_FILE
${
SOURCE_FILES
}
)
# strip out the filename
get_filename_component
(
FILENAME
${
SOURCE_FILE
}
NAME_WE
)
# compile the source file using mex
# compile the source file using mex
execute_process
(
execute_process
(
COMMAND
${
MATLAB_MEX_SCRIPT
}
${
MEX_OPTS
}
${
MEX_INCLUDE_DIRS_LIST
}
COMMAND
${
MATLAB_MEX_SCRIPT
}
${
MEX_OPTS
}
${
MEX_INCLUDE_DIRS_LIST
}
${
MEX_LIB_DIR
}
${
MEX_LIBS
}
${
SOURCE_FILE
}
${
MEX_LIB_DIR
}
${
MEX_LIBS
}
${
SOURCE_FILE
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/src
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
/src
ERROR_VARIABLE FAILED
)
)
# TODO: If a mex file fails to cmpile, should we error out?
if
(
FAILED
)
message
(
FATAL_ERROR
"Failed to compile
${
FILENAME
}
:
${
FAILED
}
"
)
endif
()
endforeach
()
endforeach
()
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