summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
diff options
context:
space:
mode:
authorRaffi Enficiaud <raffi.enficiaud@tuebingen.mpg.de>2015-02-12 16:13:31 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-17 13:47:04 (GMT)
commit49c8dcf7bb8ae9e7584286e552769a61bf23e61b (patch)
tree5f87e1b1974d15a6b23babdc730b321dde1c7f44 /Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
parent6390d5f5cb107dcc4a0bc6124ab5f17370dcadcd (diff)
downloadCMake-49c8dcf7bb8ae9e7584286e552769a61bf23e61b.zip
CMake-49c8dcf7bb8ae9e7584286e552769a61bf23e61b.tar.gz
CMake-49c8dcf7bb8ae9e7584286e552769a61bf23e61b.tar.bz2
FindMatlab: Rewrite module and provide a usage API
Implement a brand new FindMatlab module: - Add support for versions and components. - Find Matlab and its version in a more precise and multiplatform way. - Add API to create a new mex extension with documentation. - Add API to add matlab unit tests (with or without the unit test framework). - Find as much as possible based on a single Matlab_ROOT_DIR cache entry and allow the user to change it to re-find everything.
Diffstat (limited to 'Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp')
-rw-r--r--Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
new file mode 100644
index 0000000..4149bb9
--- /dev/null
+++ b/Tests/RunCMake/FindMatlab/matlab_wrapper1.cpp
@@ -0,0 +1,26 @@
+
+// simple workaround to some compiler specific problems
+// see http://stackoverflow.com/questions/22367516/mex-compile-error-unknown-type-name-char16-t/23281916#23281916
+#include <algorithm>
+
+#include "mex.h"
+
+// this test should return a matrix of 10 x 10 and should check some of the arguments
+
+void mexFunction(const int nlhs, mxArray *plhs[], const int nrhs, const mxArray *prhs[])
+{
+ if(nrhs != 1)
+ {
+ mexErrMsgTxt("Incorrect arguments");
+ }
+
+ size_t dim1 = mxGetM(prhs[0]);
+ size_t dim2 = mxGetN(prhs[0]);
+
+ if(dim1 == 1 || dim2 == 1)
+ {
+ mexErrMsgIdAndTxt("cmake_matlab:configuration", "Incorrect arguments");
+ }
+
+ plhs[0] = mxCreateNumericMatrix(dim1, dim2, mxGetClassID(prhs[0]), mxREAL);
+}