1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-17 15:26:00 +08:00

matlab: fix bindings generator

This commit is contained in:
Alexander Alekhin
2018-09-08 22:03:00 +00:00
parent 45f9d57118
commit 9ef878f3bf
8 changed files with 74 additions and 25 deletions

View File

@@ -28,11 +28,18 @@ endif()
# 2. attempt compile if required
# 3. if the compile fails, throw an error and cancel compilation
file(GLOB SOURCE_FILES "${CMAKE_CURRENT_BINARY_DIR}/src/*.cpp")
list(LENGTH SOURCE_FILES __size)
message("Matlab: compiling ${__size} files")
set(__index 0)
foreach(SOURCE_FILE ${SOURCE_FILES})
MATH(EXPR __index "${__index}+1")
# strip out the filename
get_filename_component(FILENAME ${SOURCE_FILE} NAME_WE)
message("[${__index}/${__size}] Compiling: ${FILENAME}")
# compile the source file using mex
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/+cv/${FILENAME}.${MATLAB_MEXEXT})
if (NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/+cv/${FILENAME}.${MATLAB_MEXEXT}" OR
"${SOURCE_FILE}" IS_NEWER_THAN "${CMAKE_CURRENT_BINARY_DIR}/+cv/${FILENAME}.${MATLAB_MEXEXT}"
)
execute_process(
COMMAND ${MATLAB_MEX_SCRIPT} ${MEX_OPTS} "CXXFLAGS=\$CXXFLAGS ${MEX_CXXFLAGS}" ${MEX_INCLUDE_DIRS_LIST}
${MEX_LIB_DIR} ${MEX_LIBS_LIST} ${SOURCE_FILE}