提交 52e5e3ed 编写于 作者: M Marius Muja

Build MEX extension for Octave if matlab is not present (Thanks Jordi...

Build MEX extension for Octave if matlab is not present (Thanks Jordi Gutiérrez Hermoso for the patch)
上级 c036b20f
......@@ -9,6 +9,8 @@ SET(MEX_NAME nearest_neighbors)
find_program(MEX_CMD mex)
find_program(MEXEXT_CMD mexext)
find_program(OCT_CMD mkoctfile)
if(MEX_CMD AND MEXEXT_CMD)
get_filename_component(MEX_REAL_CMD ${MEX_CMD} ABSOLUTE)
......@@ -42,7 +44,25 @@ if(MEX_CMD AND MEXEXT_CMD)
else()
message("The 'mex' and 'mexext' programs have been found in different locations. It's likely that one of them is not part of the MATLAB instalation. Make sure that the 'bin' directory from the MATLAB instalation is in PATH")
endif()
elseif(OCT_CMD)
SET(MEX_FILE ${CMAKE_CURRENT_BINARY_DIR}/${MEX_NAME}.mex)
ADD_CUSTOM_COMMAND(
OUTPUT ${MEX_FILE}
COMMAND ${OCT_CMD}
ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp -I${PROJECT_SOURCE_DIR}/src/cpp -L${LIBRARY_OUTPUT_PATH} -lflann_s --mex
DEPENDS flann_s ${CMAKE_CURRENT_SOURCE_DIR}/${MEX_NAME}.cpp
COMMENT "Building MEX extension ${MEX_FILE}"
)
ADD_CUSTOM_TARGET(mex_${MEX_NAME} ALL DEPENDS ${MEX_FILE})
FILE(GLOB MATLAB_SOURCES *.m)
INSTALL (
FILES ${MEX_FILE} ${MATLAB_SOURCES}
DESTINATION share/flann/octave
)
else()
message("Cannot find MATLAB instalation. Make sure that the 'bin' directory from the MATLAB instalation is in PATH")
message("Cannot find MATLAB or Octave instalation. Make sure that the 'bin' directory from the MATLAB instalation or that mkoctfile is in PATH")
endif()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册