Removing trailing whitespace and expanded tabs

pull/1384/head
hbristow 12 years ago
parent f57145dc64
commit 7e5bbec895
  1. 84
      cmake/OpenCVFindMatlab.cmake
  2. 68
      modules/matlab/README.md
  3. 1
      modules/matlab/generator/templates/template_function_base.cpp

@ -37,16 +37,16 @@
# find_library when finding Matlab libraries. It does not affect scopes
# outside of this file.
function(set_libarch_prefix_suffix)
if (UNIX AND NOT APPLE)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
elseif (APPLE)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
elseif (WIN32)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
endif()
if (UNIX AND NOT APPLE)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a" PARENT_SCOPE)
elseif (APPLE)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a" PARENT_SCOPE)
elseif (WIN32)
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" PARENT_SCOPE)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll" PARENT_SCOPE)
endif()
endfunction()
@ -90,40 +90,40 @@ function(locate_matlab_root)
# --- WINDOWS ---
elseif (WIN32)
# search the path to see if Matlab exists there
# search the path to see if Matlab exists there
# Contrary to EVERY OTHER REGEX IMPLEMENTATION ON EARTH, cmake returns
# the entire input string if no matches for the capture group are found.
string(REGEX REPLACE ".*[;=](.*[Mm][Aa][Tt][Ll][Aa][Bb][^;]*)\\\\bin.*" "\\1" MATLAB_ROOT_DIR_ "$ENV{PATH}")
string(REGEX REPLACE ".*[;=](.*[Mm][Aa][Tt][Ll][Aa][Bb][^;]*)\\\\bin.*" "\\1" MATLAB_ROOT_DIR_ "$ENV{PATH}")
if ("${MATLAB_ROOT_DIR_}" STREQUAL "$ENV{PATH}")
set(MATLAB_ROOT_DIR_)
endif()
# registry-hacking
# registry-hacking
# determine the available Matlab versions
set(REG_EXTENSION_ "SOFTWARE\\Mathworks\\MATLAB")
set(REG_EXTENSION_ "SOFTWARE\\Mathworks\\MATLAB")
set(REG_ROOTS_ "HKEY_LOCAL_MACHINE" "HKEY_CURRENT_USER")
foreach(REG_ROOT_ ${REG_ROOTS_})
execute_process(COMMAND reg query "${REG_ROOT_}\\${REG_EXTENSION_}" OUTPUT_VARIABLE QUERY_RESPONSE_)
if (QUERY_RESPONSE_)
execute_process(COMMAND reg query "${REG_ROOT_}\\${REG_EXTENSION_}" OUTPUT_VARIABLE QUERY_RESPONSE_)
if (QUERY_RESPONSE_)
string(REGEX MATCHALL "[0-9]\\.[0-9]" VERSION_STRINGS_ ${QUERY_RESPONSE_})
list(APPEND VERSIONS_ ${VERSION_STRINGS_})
endif()
endforeach()
# select the highest version
list(APPEND VERSIONS_ "0.0")
list(SORT VERSIONS_)
list(REVERSE VERSIONS_)
list(GET VERSIONS_ 0 VERSION_)
# request the MATLABROOT from the registry
foreach(REG_ROOT_ ${REG_ROOTS_})
get_filename_component(QUERY_RESPONSE_ [${REG_ROOT_}\\${REG_EXTENSION_}\\${VERSION_};MATLABROOT] ABSOLUTE)
if ("${MATLAB_ROOT_DIR_}" STREQUAL "" AND NOT ${QUERY_RESPONSE_} MATCHES "registry$")
set(MATLAB_ROOT_DIR_ ${QUERY_RESPONSE_})
endif()
endforeach()
endif()
endif()
endforeach()
# select the highest version
list(APPEND VERSIONS_ "0.0")
list(SORT VERSIONS_)
list(REVERSE VERSIONS_)
list(GET VERSIONS_ 0 VERSION_)
# request the MATLABROOT from the registry
foreach(REG_ROOT_ ${REG_ROOTS_})
get_filename_component(QUERY_RESPONSE_ [${REG_ROOT_}\\${REG_EXTENSION_}\\${VERSION_};MATLABROOT] ABSOLUTE)
if ("${MATLAB_ROOT_DIR_}" STREQUAL "" AND NOT ${QUERY_RESPONSE_} MATCHES "registry$")
set(MATLAB_ROOT_DIR_ ${QUERY_RESPONSE_})
endif()
endforeach()
endif()
# export the root into the parent scope
if (MATLAB_ROOT_DIR_)
@ -150,20 +150,20 @@ function(locate_matlab_components MATLAB_ROOT_DIR)
endif()
string(STRIP ${MATLAB_MEXEXT_} MATLAB_MEXEXT_)
# map the mexext to an architecture extension
set(ARCHITECTURES_ "maci64" "maci" "glnxa64" "glnx64" "sol64" "sola64" "win32" "win64" )
foreach(ARCHITECTURE_ ${ARCHITECTURES_})
if(EXISTS ${MATLAB_ROOT_DIR}/bin/${ARCHITECTURE_})
set(MATLAB_ARCH_ ${ARCHITECTURE_})
break()
endif()
endforeach()
# map the mexext to an architecture extension
set(ARCHITECTURES_ "maci64" "maci" "glnxa64" "glnx64" "sol64" "sola64" "win32" "win64" )
foreach(ARCHITECTURE_ ${ARCHITECTURES_})
if(EXISTS ${MATLAB_ROOT_DIR}/bin/${ARCHITECTURE_})
set(MATLAB_ARCH_ ${ARCHITECTURE_})
break()
endif()
endforeach()
# get the path to the libraries
set(MATLAB_LIBRARY_DIR_ ${MATLAB_ROOT_DIR}/bin/${MATLAB_ARCH_})
# get the libraries
set_libarch_prefix_suffix()
set_libarch_prefix_suffix()
find_library(MATLAB_LIB_MX_ mx PATHS ${MATLAB_LIBRARY_DIR_} NO_DEFAULT_PATH)
find_library(MATLAB_LIB_MEX_ mex PATHS ${MATLAB_LIBRARY_DIR_} NO_DEFAULT_PATH)
find_library(MATLAB_LIB_MAT_ mat PATHS ${MATLAB_LIBRARY_DIR_} NO_DEFAULT_PATH)

@ -7,7 +7,7 @@ Build
-----
The Matlab code generator is fully integrated into the OpenCV build system. If cmake finds a Matlab installation available on the host system while configuring OpenCV, it will attempt to generate Matlab wrappers for all OpenCV modules. If cmake is having trouble finding your Matlab installation, you can explicitly point it to the root by defining the `MATLAB_ROOT_DIR` variable. For example, on a Mac you could type:
cmake -DMATLAB_ROOT_DIR=/Applications/MATLAB_R2013a.app ..
cmake -DMATLAB_ROOT_DIR=/Applications/MATLAB_R2013a.app ..
Install
@ -44,7 +44,7 @@ to get help on the purpose and call signature of a particular method, or
to get general help regarding the OpenCV bindings. If you ever run into issues with the bindings
cv.buildInformation();
cv.buildInformation();
will produce a printout of diagnostic information pertaining to your particular build of OS, OpenCV and Matlab. It is useful to submit this information alongside a bug report to the OpenCV team.
@ -158,9 +158,9 @@ Attempt to compile a simple definition using the mex compiler. A mex file is act
If any of the configure time tests fail, the bindings will be disabled, but the main OpenCV configure will continue without error. The configuration summary will contain the block:
Matlab
mex: /Applications/MATLAB_R2013a.app/bin/mex
compiler/generator: Not working (bindings will not be generated)
Matlab
mex: /Applications/MATLAB_R2013a.app/bin/mex
compiler/generator: Not working (bindings will not be generated)
**Generate the sources (build)**
Given a set of modules (the intersection of the OpenCV modules being built and the matlab module optional dependencies), the `CppHeaderParser()` from `opencv/modules/python/src2/hdr_parser.py` will parse the module headers and produce a set of definitions.
@ -174,18 +174,18 @@ The `ParseTree()` from `opencv/modules/matlab/generator/parse_tree.py` takes thi
The equivalent refactored output will look like:
```python
Function
name = 'fill'
rtype = 'void'
static = True
req =
Argument
name = 'mat'
type = 'cv::Mat'
ref = '&'
I = True
O = True
default = ''
Function
name = 'fill'
rtype = 'void'
static = True
req =
Argument
name = 'mat'
type = 'cv::Mat'
ref = '&'
I = True
O = True
default = ''
```
The added semantics (Namespace, Class, Function, Argument, name, etc) make it easier for the templating engine to parse, slice and populate definitions.
@ -262,27 +262,27 @@ File Reference
**gen_matlab.py**
gen_matlab has the following call signature:
gen_matlab.py --hdrparser path/to/hdr_parser/dir
--rstparser path/to/rst_parser/dir
--moduleroot path/to/opencv/modules
--modules core imgproc highgui etc
--extra namespace=/additional/header/to/parse
--outdir /path/to/place/generated/src
gen_matlab.py --hdrparser path/to/hdr_parser/dir
--rstparser path/to/rst_parser/dir
--moduleroot path/to/opencv/modules
--modules core imgproc highgui etc
--extra namespace=/additional/header/to/parse
--outdir /path/to/place/generated/src
**build_info.py**
build_info has the following call signature:
build_info.py --os operating_system_string
--arch bitness processor
--compiler id version
--mex_arch arch_string
--mex_script /path/to/mex/script
--cxx_flags -list -of -flags -to -passthrough
--opencv_version version_string
--commit commit_hash_if_using_git
--modules core imgproc highgui etc
--configuration Debug/Release
--outdir path/to/place/build/info
build_info.py --os operating_system_string
--arch bitness processor
--compiler id version
--mex_arch arch_string
--mex_script /path/to/mex/script
--cxx_flags -list -of -flags -to -passthrough
--opencv_version version_string
--commit commit_hash_if_using_git
--modules core imgproc highgui etc
--configuration Debug/Release
--outdir path/to/place/build/info
**parse_tree.py**
To build a parse tree, first parse a set of headers, then invoke the parse tree to refactor the output:

@ -58,4 +58,3 @@ void mexFunction(int nlhs, mxArray*{% if fun|noutputs %} plhs[]{% else %}*{% end
}
{% endif %}
}

Loading…
Cancel
Save