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
60d7acb4
Commit
60d7acb4
authored
Mar 12, 2013
by
Hilton Bristow
Committed by
hbristow
Jun 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Windows functionality to FindMatlab. Untested
parent
e8e537a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
18 deletions
+40
-18
OpenCVFindMatlab.cmake
cmake/OpenCVFindMatlab.cmake
+40
-18
No files found.
cmake/OpenCVFindMatlab.cmake
View file @
60d7acb4
...
...
@@ -36,6 +36,9 @@ MACRO(locate_matlab_root)
foreach
(
DIR_
${
SEARCH_DIRS_
}
)
file
(
GLOB MATLAB_ROOT_DIR
${
DIR_
}
/*matlab*
)
if
(
MATLAB_ROOT_DIR
)
list
(
SORT MATLAB_ROOT_DIR
)
list
(
REVERSE MATLAB_ROOT_DIR
)
list
(
GET MATLAB_ROOT_DIR 0 MATLAB_ROOT_DIR
)
break
()
endif
()
endforeach
()
...
...
@@ -47,12 +50,30 @@ MACRO(locate_matlab_root)
foreach
(
DIR_
${
SEARCH_DIRS_
}
)
file
(
GLOB MATLAB_ROOT_DIR
${
DIR_
}
/*matlab*
)
if
(
MATLAB_ROOT_DIR
)
list
(
SORT MATLAB_ROOT_DIR
)
list
(
REVERSE MATLAB_ROOT_DIR
)
list
(
GET MATLAB_ROOT_DIR 0 MATLAB_ROOT_DIR
)
break
()
endif
()
endforeach
()
# --- WINDOWS ---
elseif
(
WIN32
)
# query the registry
set
(
REG_ROOTS_
"HKEY_LOCAL_MACHINE"
"HKEY_CURRENT_USER"
)
foreach
(
REG_ROOT_ REG_ROOTS_
)
execute_process
(
COMMAND reg query
${
REG_ROOT_
}
\\SOFTWARE\\MathWorks\\MATLAB /f * /k OUTPUT_VARIABLE VERSIONS_
)
if
(
VERSIONS_
)
# sort in order from highest to lowest
list
(
SORT VERSIONS_
)
list
(
REVERSE VERSIONS_
)
list
(
GET VERSIONS_ 0 VERSION_
)
get_filename_component
(
MATLAB_ROOT_DIR [
${
REG_ROOT_
}
\\SOFTWARE\\MathWorks\\MATLAB\\
${
VERSION_
}
;Install_Dir] ABSOLUTE PATH
)
if
(
MATLAB_ROOT_DIR
)
break
()
endif
()
endif
()
endforeach
()
endif
()
# unset local variables
unset
(
SEARCH_DIRS_
)
...
...
@@ -67,30 +88,31 @@ endMACRO()
# (include directory and libraries) under the root. If everything is found,
# sets the variable MATLAB_FOUND to TRUE
MACRO
(
locate_matlab_components MATLAB_ROOT_DIR
)
# get the mex extension
if
(
UNIX
)
# get the mex extension
execute_process
(
COMMAND
${
MATLAB_ROOT_DIR
}
/bin/mexext OUTPUT_VARIABLE MATLAB_MEXEXT
)
string
(
STRIP
${
MATLAB_MEXEXT
}
MATLAB_MEXEXT
)
string
(
REPLACE
"mex"
""
MATLAB_ARCH
${
MATLAB_MEXEXT
}
)
# get the path to the libraries
set
(
MATLAB_LIBRARY_DIRS
${
MATLAB_ROOT_DIR
}
/bin/
${
MATLAB_ARCH
}
)
elseif
(
WIN32
)
execute_process
(
COMMAND
${
MATLAB_ROOT_DIR
}
/bin/mexext.bat OUTPUT_VARIABLE MATLAB_MEXEXT
)
endif
()
string
(
STRIP
${
MATLAB_MEXEXT
}
MATLAB_MEXEXT
)
string
(
REPLACE
"mex"
""
MATLAB_ARCH
${
MATLAB_MEXEXT
}
)
# get the libraries
find_library
(
MATLAB_LIB_MX mx PATHS
${
MATLAB_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
find_library
(
MATLAB_LIB_MEX mex PATHS
${
MATLAB_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
find_library
(
MATLAB_LIB_MAT mat PATHS
${
MATLAB_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
set
(
MATLAB_LIBS
${
MATLAB_LIB_MX
}
${
MATLAB_LIB_MEX
}
${
MATLAB_LIB_MAT
}
)
# get the path to the libraries
set
(
MATLAB_LIBRARY_DIRS
${
MATLAB_ROOT_DIR
}
/bin/
${
MATLAB_ARCH
}
)
# get the include path
find_path
(
MATLAB_INCLUDE_DIRS mex.h
${
MATLAB_ROOT_DIR
}
/extern/include
)
# get the libraries
find_library
(
MATLAB_LIB_MX mx PATHS
${
MATLAB_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
find_library
(
MATLAB_LIB_MEX mex PATHS
${
MATLAB_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
find_library
(
MATLAB_LIB_MAT mat PATHS
${
MATLAB_LIBRARY_DIRS
}
NO_DEFAULT_PATH
)
set
(
MATLAB_LIBS
${
MATLAB_LIB_MX
}
${
MATLAB_LIB_MEX
}
${
MATLAB_LIB_MAT
}
)
# get the mex shell script
find_file
(
MATLAB_MEX_SCRIPT NAMES mex mex.bat PATHS
${
MATLAB_ROOT_DIR
}
/bin NO_DEFAULT_PATH
)
elseif
(
WIN32
)
endif
()
# get the include path
find_path
(
MATLAB_INCLUDE_DIRS mex.h
${
MATLAB_ROOT_DIR
}
/extern/include
)
# get the mex shell script
find_file
(
MATLAB_MEX_SCRIPT NAMES mex mex.bat PATHS
${
MATLAB_ROOT_DIR
}
/bin NO_DEFAULT_PATH
)
# verify that everything has been found successfully
if
(
MATLAB_LIB_MX AND MATLAB_LIB_MEX AND MATLAB_LIB_MAT AND MATLAB_INCLUDE_DIRS AND MATLAB_MEX_SCRIPT
)
set
(
MATLAB_FOUND TRUE
)
...
...
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