Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
032e5e3f
Commit
032e5e3f
authored
Feb 02, 2016
by
Davis King
Browse files
merged
parents
dd603855
64c7e966
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
34 deletions
+60
-34
dlib/cmake_find_blas.txt
dlib/cmake_find_blas.txt
+35
-33
dlib/matlab/call_matlab.h
dlib/matlab/call_matlab.h
+8
-0
dlib/matlab/cmake_mex_wrapper
dlib/matlab/cmake_mex_wrapper
+2
-0
dlib/matlab/mex_wrapper.cpp
dlib/matlab/mex_wrapper.cpp
+15
-1
No files found.
dlib/cmake_find_blas.txt
View file @
032e5e3f
...
...
@@ -49,10 +49,6 @@ if (UNIX)
include(CheckLibraryExists)
# Don't try to use the Intel MKL when we are building a MATLAB mex file
# since it will usually conflict with MATLAB's copy of the MKL and cause
# problems.
if (NOT BUILDING_MATLAB_MEX_FILE)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path})
...
...
@@ -65,6 +61,13 @@ if (UNIX)
set(lapack_found 1)
set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
if (BUILDING_MATLAB_MEX_FILE)
message(STATUS "\n!!!! Don't forget to set the BLAS_VERSION and LAPACK_VERSION environment variables to !!!!\n!!!! ${blas_libraries} so MATLAB doesn't explode when you run this mex file !!!!\n")
endif()
endif()
if (BUILDING_MATLAB_MEX_FILE)
return()
endif()
if (NOT found_intel_mkl)
...
...
@@ -86,7 +89,6 @@ if (UNIX)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
endif()
endif()
endif()
# try to find some other LAPACK libraries if we didn't find the MKL
...
...
dlib/matlab/call_matlab.h
View file @
032e5e3f
...
...
@@ -8,6 +8,14 @@
// ----------------------------------------------------------------------------------------
void
check_for_ctrl_c
();
/*!
ensures
- If the user of MATLAB has pressed ctrl+c then this function will throw an
exception.
!*/
// ----------------------------------------------------------------------------------------
class
matlab_struct
{
...
...
dlib/matlab/cmake_mex_wrapper
View file @
032e5e3f
...
...
@@ -6,6 +6,7 @@
cmake_minimum_required(VERSION 2.8.4)
set(BUILDING_MATLAB_MEX_FILE true)
set(CMAKE_POSITION_INDEPENDENT_CODE True)
# Find MATLAB's include directory and needed libraries
find_program(MATLAB_EXECUTABLE matlab PATHS
...
...
@@ -67,6 +68,7 @@ INCLUDE(InstallRequiredSystemLibraries)
MACRO(add_mex_function name )
ADD_LIBRARY(${name} MODULE ${name}.cpp )
# Change the output file extension to a mex extension.
if (WIN32)
set_target_properties(${name} PROPERTIES SUFFIX ".mexw64")
...
...
dlib/matlab/mex_wrapper.cpp
View file @
032e5e3f
...
...
@@ -253,6 +253,8 @@ namespace mex_binding
// -------------------------------------------------------
struct
user_hit_ctrl_c
{};
struct
invalid_args_exception
{
invalid_args_exception
(
const
std
::
string
&
msg_
)
:
msg
(
msg_
)
{}
...
...
@@ -897,7 +899,7 @@ namespace mex_binding
}
else
if
(
is_same_type
<
dlib
::
rgb_pixel
,
type
>::
value
)
{
mwSize
dims
[
3
]
=
{(
unsigned
long
)
item
.
nr
(),
(
unsigned
long
)
item
.
nc
(),
3
};
mwSize
dims
[
3
]
=
{(
mwSize
)
item
.
nr
(),
(
mwSize
)
item
.
nc
(),
3
};
plhs
=
mxCreateNumericArray
(
3
,
dims
,
mxUINT8_CLASS
,
mxREAL
);
assign_image_to_matlab
((
dlib
::
uint8
*
)
mxGetData
(
plhs
),
item
);
...
...
@@ -1573,6 +1575,10 @@ namespace mex_binding
mexErrMsgIdAndTxt
(
"mex_function:validate_and_populate_arg"
,
(
"Input"
+
e
.
msg
).
c_str
());
}
catch
(
user_hit_ctrl_c
&
)
{
// do nothing, just return to matlab
}
catch
(
dlib
::
error
&
e
)
{
mexErrMsgIdAndTxt
(
"mex_function:error"
,
...
...
@@ -2371,6 +2377,14 @@ void call_matlab (
call_matlab
(
"feval"
,
funct
);
}
extern
"C"
bool
utIsInterruptPending
();
void
check_for_ctrl_c
(
)
{
if
(
utIsInterruptPending
())
throw
mex_binding
::
user_hit_ctrl_c
();
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
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