PREPEND and MEX_LIB_DIR in Matlab module's CMakeLists.txt (Bug #3440)
Description
There are two problem in the Matlab module's CMakeLists.txt.
- According the implementation of macro PREPEND, I think it might be designed to take various IN arguments. But in fact it's not.
- The value of MEX_LIB_DIR was not taken into account of UNIX systems.
I fix those two problem and make the compiling go on. Diff result is like this@
-27,11 +27,11 @@
# Given a list of strings IN and a TOKEN, prepend the token to each string
# and append to OUT. This is used for passing command line "-I", "-L" and "-l"
# arguments to mex. e.g.
# prepend("-I" OUT /path/to/include/dir) --> I/path/to/include/dir foreach(VAR ${IN})
macro(PREPEND TOKEN OUT IN)
+ foreach(VAR ${IN} ${ARGN})
list(APPEND ${OUT} "${TOKEN}${VAR}")
endforeach()
endmacro()
@ -102,11 +102,12
@ set(JINJA2_PATH ${CMAKE_SOURCE_DIR}/3rdparty)
set(HDR_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/python/src2)
set(RST_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/java/generator)
- set mex compiler options
prepend("-I" MEX_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
-prepend("-L" MEX_LIB_DIR ${LIBRARY_OUTPUT_PATH}/$<CONFIGURATION>)
prepend("-L" MEX_LIB_DIR ${LIBRARY_OUTPUT_PATH}/$<CONFIGURATION> ${LIBRARY_OUTPUT_PATH}/)
set(MEX_OPTS "-largeArrayDims")
if (BUILD_TESTS)
add_subdirectory(test)
endif()
@ -234,11 +235,11
@ add_custom_command(
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py
--jinja2 ${JINJA2_PATH}
--opts="${MEX_OPTS}"
--include_dirs="${MEX_INCLUDE_DIRS}"
- --lib_dir=${MEX_LIB_DIR}
+ --lib_dir="${MEX_LIB_DIR}"
--libs="${MEX_LIBS}"
--flags ${MEX_CXXFLAGS}
--outdir ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} E copy ${CMAKE_CURRENT_SOURCE_DIR}/test/help.m ${CMAKE_CURRENT_BINARY_DIR}/+cv
COMMAND ${CMAKE_COMMAND} -E touch ${GENERATE_PROXY}
@ -254,11 +255,11
@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -DMATLAB_MEX_SCRIPT=${MATLAB_MEX_SCRIPT}
-DMATLAB_MEXEXT=${MATLAB_MEXEXT}
-DMEX_OPTS=${MEX_OPTS}
-DMEX_CXXFLAGS=${MEX_CXX_FLAGS}
-DMEX_INCLUDE_DIRS="${MEX_INCLUDE_DIRS}"
-DMEX_LIB_DIR=${MEX_LIB_DIR}
+ -DMEX_LIB_DIR="${MEX_LIB_DIR}"
-DCONFIGURATION="$<CONFIGURATION>"
-DMEX_LIBS="${MEX_LIBS}"
-DMEX_DEBUG_LIBS="${MEX_DEBUG_LIBS}"
-P ${CMAKE_CURRENT_SOURCE_DIR}/compile.cmake
COMMAND ${CMAKE_COMMAND} -E touch ${COMPILE_PROXY}@
Related issues
related to Bug #3439: matlab module | Cancelled | 2013-12-17 |
History
Updated by Yantao Xie about 11 years ago
The above description's format is not correct, I repost it.
There are two problem in the Matlab module's CMakeLists.txt.- According the implementation of macro PREPEND, I think it might be designed to take various IN arguments. But in fact it's not.
- The value of MEX_LIB_DIR was not taken into account of UNIX systems.
I fix those two problem and make the compiling go on. Diff result is like this
@@ -27,11 +27,11 @@ # Given a list of strings IN and a TOKEN, prepend the token to each string # and append to OUT. This is used for passing command line "-I", "-L" and "-l" # arguments to mex. e.g. # prepend("-I" OUT /path/to/include/dir) --> -I/path/to/include/dir macro(PREPEND TOKEN OUT IN) - foreach(VAR ${IN}) + foreach(VAR ${IN} ${ARGN}) list(APPEND ${OUT} "${TOKEN}${VAR}") endforeach() endmacro() @@ -102,11 +102,12 @@ set(JINJA2_PATH ${CMAKE_SOURCE_DIR}/3rdparty) set(HDR_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/python/src2) set(RST_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/java/generator) # set mex compiler options prepend("-I" MEX_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include) -prepend("-L" MEX_LIB_DIR ${LIBRARY_OUTPUT_PATH}/$<CONFIGURATION>) +prepend("-L" MEX_LIB_DIR ${LIBRARY_OUTPUT_PATH}/$<CONFIGURATION> ${LIBRARY_OUTPUT_PATH}/) + set(MEX_OPTS "-largeArrayDims") if (BUILD_TESTS) add_subdirectory(test) endif() @@ -234,11 +235,11 @@ add_custom_command( COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py --jinja2 ${JINJA2_PATH} --opts="${MEX_OPTS}" --include_dirs="${MEX_INCLUDE_DIRS}" - --lib_dir=${MEX_LIB_DIR} + --lib_dir="${MEX_LIB_DIR}" --libs="${MEX_LIBS}" --flags ${MEX_CXXFLAGS} --outdir ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/test/help.m ${CMAKE_CURRENT_BINARY_DIR}/+cv COMMAND ${CMAKE_COMMAND} -E touch ${GENERATE_PROXY} @@ -254,11 +255,11 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -DMATLAB_MEX_SCRIPT=${MATLAB_MEX_SCRIPT} -DMATLAB_MEXEXT=${MATLAB_MEXEXT} -DMEX_OPTS=${MEX_OPTS} -DMEX_CXXFLAGS=${MEX_CXX_FLAGS} -DMEX_INCLUDE_DIRS="${MEX_INCLUDE_DIRS}" - -DMEX_LIB_DIR=${MEX_LIB_DIR} + -DMEX_LIB_DIR="${MEX_LIB_DIR}" -DCONFIGURATION="$<CONFIGURATION>" -DMEX_LIBS="${MEX_LIBS}" -DMEX_DEBUG_LIBS="${MEX_DEBUG_LIBS}" -P ${CMAKE_CURRENT_SOURCE_DIR}/compile.cmake COMMAND ${CMAKE_COMMAND} -E touch ${COMPILE_PROXY}
Updated by Alexander Shishkov about 11 years ago
Thanks for the report! Could you please create pullrequest based on your changes? More details are available here: http://code.opencv.org/projects/opencv/wiki/How_to_contribute
Updated by Alexander Shishkov about 11 years ago
- Category set to matlab bindings
- Assignee set to Vadim Pisarevsky
Updated by Yantao Xie about 11 years ago
Alexander Shishkov wrote:
Thanks for the report! Could you please create pullrequest based on your changes? More details are available here: http://code.opencv.org/projects/opencv/wiki/How_to_contribute
OK. I've create a pull request on the github.
Updated by Anna Kogan about 11 years ago
- Status changed from New to Open
Updated by Roman Donchenko about 11 years ago
The aforementioned pull request has been merged, so presumably this is fixed.
- Pull request set to https://github.com/Itseez/opencv/pull/2062
- Status changed from Open to Done