Upadated include tree to match the rest of opencv. Added install configuration for custom mex compiler
This commit is contained in:
@@ -276,22 +276,26 @@ endif()
|
||||
# ----------------------------------------------------------------------------
|
||||
# NOTE: Trailing slashes on the DIRECTORY paths are important!
|
||||
# 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")
|
||||
file(GLOB MATLAB_PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/src/private/*.${MATLAB_MEXEXT}")
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv
|
||||
FILES_MATCHING PATTERN "*.${MATLAB_MEXEXT}"
|
||||
)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv
|
||||
FILES_MATCHING PATTERN "*.m"
|
||||
)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/private/
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab/+cv/private
|
||||
FILES_MATCHING PATTERN "*.${MATLAB_MEXEXT}"
|
||||
)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
|
||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/matlab
|
||||
FILES_MATCHING PATTERN "cv.m"
|
||||
|
||||
# install the +cv directory verbatim
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION ${OPENCV_INCLUDE_INSTALL_PATH})
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/+cv/ DESTINATION matlab/+cv)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cv.m DESTINATION matlab)
|
||||
|
||||
# update the custom mex compiler to point to the install locations
|
||||
string(REPLACE ";" "\\ " MEX_OPTS "${MEX_OPTS}")
|
||||
string(REPLACE ";" "\\ " MEX_LIBS "${MEX_LIBS}")
|
||||
string(REPLACE " " "\\ " MEX_CXXFLAGS ${MEX_CXXFLAGS})
|
||||
string(REPLACE ";" "\\ " MEX_INCLUDE_DIRS "${MEX_INCLUDE_DIRS}")
|
||||
install(CODE
|
||||
"execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py
|
||||
--opts=${MEX_OPTS}
|
||||
--include_dirs=-I${CMAKE_INSTALL_PREFIX}/${OPENCV_INCLUDE_INSTALL_PATH}
|
||||
--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 @@
|
||||
* See LICENCE for full modification and redistribution details.
|
||||
* Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation
|
||||
*/
|
||||
#include "mex.h"
|
||||
#include "map.hpp"
|
||||
#include "bridge.hpp"
|
||||
#include <mex.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <opencv2/matlab/map.hpp>
|
||||
#include <opencv2/matlab/bridge.hpp>
|
||||
#include <opencv2/core.hpp>
|
||||
using namespace cv;
|
||||
|
||||
|
@@ -8,12 +8,11 @@
|
||||
* See LICENCE for full modification and redistribution details.
|
||||
* Copyright {{time.strftime("%Y", time.localtime())}} The OpenCV Foundation
|
||||
*/
|
||||
#include "mex.h"
|
||||
#include "bridge.hpp"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
#include <exception>
|
||||
#include <opencv2/matlab/bridge.hpp>
|
||||
#include <opencv2/{{includes}}.hpp>
|
||||
using namespace cv;
|
||||
|
||||
|
@@ -15,7 +15,7 @@ typedef std::unordered_set<std::string> StringSet;
|
||||
#include <set>
|
||||
typedef std::set<std::string> StringSet;
|
||||
#endif
|
||||
#include "mex.h"
|
||||
#include <mex.h>
|
||||
#include "transpose.hpp"
|
||||
|
||||
/*
|
||||
@@ -488,6 +488,7 @@ private:
|
||||
struct Variant;
|
||||
typedef std::string String;
|
||||
typedef std::vector<std::string> StringVector;
|
||||
typedef std::vector<size_t> IndexVector;
|
||||
typedef std::vector<MxArray> MxArrayVector;
|
||||
typedef std::vector<Variant> VariantVector;
|
||||
/* @class Variant
|
||||
@@ -506,6 +507,7 @@ private:
|
||||
size_t nreq;
|
||||
size_t nopt;
|
||||
StringVector keys;
|
||||
IndexVector order;
|
||||
bool using_named;
|
||||
/*! @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(); }
|
||||
@@ -529,6 +531,14 @@ private:
|
||||
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_;
|
||||
VariantVector variants_;
|
||||
String valid_;
|
Reference in New Issue
Block a user