Commit 78dc2c54 authored by hbristow's avatar hbristow

Upadated include tree to match the rest of opencv. Added install configuration…

Upadated include tree to match the rest of opencv. Added install configuration for custom mex compiler
parent 52dc51a6
...@@ -276,22 +276,26 @@ endif() ...@@ -276,22 +276,26 @@ endif()
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# NOTE: Trailing slashes on the DIRECTORY paths are important! # NOTE: Trailing slashes on the DIRECTORY paths are important!
# TODO: What needs to be done with rpath???? # TODO: What needs to be done with rpath????
file(GLOB MATLAB_FUNCTIONS "${CMAKE_CURRENT_BINARY_DIR}/src/*.${MATLAB_MEXEXT}")
file(GLOB MATLAB_CLASSES "${CMAKE_CURRENT_BINARY_DIR}/+cv/*.m") # install the +cv directory verbatim
file(GLOB MATLAB_PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/src/private/*.${MATLAB_MEXEXT}") install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/ DESTINATION matlab/+cv)
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cv.m DESTINATION matlab)
FILES_MATCHING PATTERN "*.${MATLAB_MEXEXT}"
) # update the custom mex compiler to point to the install locations
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/ string(REPLACE ";" "\\ " MEX_OPTS "${MEX_OPTS}")
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv string(REPLACE ";" "\\ " MEX_LIBS "${MEX_LIBS}")
FILES_MATCHING PATTERN "*.m" string(REPLACE " " "\\ " MEX_CXXFLAGS ${MEX_CXXFLAGS})
) string(REPLACE ";" "\\ " MEX_INCLUDE_DIRS "${MEX_INCLUDE_DIRS}")
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/private/ install(CODE
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv/private "execute_process(
FILES_MATCHING PATTERN "*.${MATLAB_MEXEXT}" COMMAND ${PYTHON_EXECUTABLE}
) ${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ --opts=${MEX_OPTS}
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab --include_dirs=-I${CMAKE_INSTALL_PREFIX}/${OPENCV_INCLUDE_INSTALL_PATH}
FILES_MATCHING PATTERN "cv.m" --lib_dir=-L${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}
--libs=${MEX_LIBS}
--flags=${MEX_CXXFLAGS}
--outdir ${CMAKE_INSTALL_PREFIX}/matlab
)"
) )
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
* See LICENCE for full modification and redistribution details. * See LICENCE for full modification and redistribution details.
* Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation * Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation
*/ */
#include "mex.h" #include <mex.h>
#include "map.hpp"
#include "bridge.hpp"
#include <vector> #include <vector>
#include <string> #include <string>
#include <opencv2/matlab/map.hpp>
#include <opencv2/matlab/bridge.hpp>
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
using namespace cv; using namespace cv;
......
...@@ -8,12 +8,11 @@ ...@@ -8,12 +8,11 @@
* See LICENCE for full modification and redistribution details. * See LICENCE for full modification and redistribution details.
* Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation * Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation
*/ */
#include "mex.h"
#include "bridge.hpp"
#include <string> #include <string>
#include <vector> #include <vector>
#include <cassert> #include <cassert>
#include <exception> #include <exception>
#include <opencv2/matlab/bridge.hpp>
#include <opencv2/{{includes}}.hpp> #include <opencv2/{{includes}}.hpp>
using namespace cv; using namespace cv;
......
...@@ -15,7 +15,7 @@ typedef std::unordered_set<std::string> StringSet; ...@@ -15,7 +15,7 @@ typedef std::unordered_set<std::string> StringSet;
#include <set> #include <set>
typedef std::set<std::string> StringSet; typedef std::set<std::string> StringSet;
#endif #endif
#include "mex.h" #include <mex.h>
#include "transpose.hpp" #include "transpose.hpp"
/* /*
...@@ -488,6 +488,7 @@ private: ...@@ -488,6 +488,7 @@ private:
struct Variant; struct Variant;
typedef std::string String; typedef std::string String;
typedef std::vector<std::string> StringVector; typedef std::vector<std::string> StringVector;
typedef std::vector<size_t> IndexVector;
typedef std::vector<MxArray> MxArrayVector; typedef std::vector<MxArray> MxArrayVector;
typedef std::vector<Variant> VariantVector; typedef std::vector<Variant> VariantVector;
/* @class Variant /* @class Variant
...@@ -506,6 +507,7 @@ private: ...@@ -506,6 +507,7 @@ private:
size_t nreq; size_t nreq;
size_t nopt; size_t nopt;
StringVector keys; StringVector keys;
IndexVector order;
bool using_named; bool using_named;
/*! @brief return true if the named-argument is in the Variant */ /*! @brief return true if the named-argument is in the Variant */
bool count(const String& key) { return std::find(keys.begin(), keys.end(), key) != keys.end(); } bool count(const String& key) { return std::find(keys.begin(), keys.end(), key) != keys.end(); }
...@@ -529,6 +531,14 @@ private: ...@@ -529,6 +531,14 @@ private:
return s.str(); return s.str();
} }
}; };
void sortArguments(Variant& v, MxArrayVector& in, MxArrayVector& out) {
// allocate the output array with ALL arguments
out.resize(v.nreq + v.nopt);
// reorder the inputs based on the variant ordering
for (size_t n = 0; n < v.order.size(); ++n) {
swap(in[n], out[v.order[n]]);
}
}
MxArrayVector filled_; MxArrayVector filled_;
VariantVector variants_; VariantVector variants_;
String valid_; String valid_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment