2013-03-11 00:17:05 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# CMake file for Matlab/Octave support
|
2013-06-19 09:54:14 +08:00
|
|
|
#
|
|
|
|
# Matlab code generation and compilation is broken down into two distinct
|
|
|
|
# stages: configure time and build time. The idea is that we want to give
|
2013-06-19 11:59:22 +08:00
|
|
|
# the user reasonable guarantees that once they type 'make', wrapper
|
2013-06-19 09:54:14 +08:00
|
|
|
# generation is unlikely to fail. Therefore we run a series of tests at
|
|
|
|
# configure time to check the working status of the core components.
|
|
|
|
#
|
|
|
|
# Configure Time
|
|
|
|
# During configure time, the script attempts to ascertain whether the
|
|
|
|
# generator and mex compiler are working for a given architecture.
|
|
|
|
# Currently this involves:
|
|
|
|
# 1) Generating a simple CV_EXPORTS_W symbol and checking whether a file
|
|
|
|
# of the symbol name is generated
|
|
|
|
# 2) Compiling a simple mex gateway to check that Bridge.hpp and mex.h
|
|
|
|
# can be found, and that a file with the mexext is produced
|
|
|
|
#
|
|
|
|
# Build Time
|
|
|
|
# If the configure time tests pass, then we assume Matlab wrapper generation
|
|
|
|
# will not fail during build time. We simply glob all of the symbols in
|
|
|
|
# the OpenCV module headers, generate intermediate .cpp files, then compile
|
|
|
|
# them with mex.
|
2013-03-11 00:17:05 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
2013-06-19 09:54:14 +08:00
|
|
|
|
|
|
|
# PREPEND
|
|
|
|
# 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
|
2013-06-18 21:00:48 +08:00
|
|
|
macro(PREPEND TOKEN OUT IN)
|
2013-12-26 17:54:05 +08:00
|
|
|
foreach(VAR ${IN} ${ARGN})
|
2013-06-19 09:54:14 +08:00
|
|
|
list(APPEND ${OUT} "${TOKEN}${VAR}")
|
2013-06-18 21:00:48 +08:00
|
|
|
endforeach()
|
|
|
|
endmacro()
|
2013-03-11 00:17:05 +08:00
|
|
|
|
2013-08-28 10:01:34 +08:00
|
|
|
|
2013-08-06 11:01:57 +08:00
|
|
|
# WARN_MIXED_PRECISION
|
|
|
|
# Formats a warning message if the compiler and Matlab bitness is different
|
|
|
|
macro(WARN_MIXED_PRECISION COMPILER_BITNESS MATLAB_BITNESS)
|
|
|
|
set(MSG "Your compiler is ${COMPILER_BITNESS}-bit")
|
|
|
|
set(MSG "${MSG} but your version of Matlab is ${MATLAB_BITNESS}-bit.")
|
2013-08-28 10:01:34 +08:00
|
|
|
set(MSG "${MSG} To build Matlab bindings, please switch to a ${MATLAB_BITNESS}-bit compiler.")
|
2013-08-06 11:01:57 +08:00
|
|
|
message(WARNING ${MSG})
|
|
|
|
endmacro()
|
|
|
|
|
2013-08-28 10:01:34 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Architecture checks
|
|
|
|
# ----------------------------------------------------------------------------
|
2013-03-14 15:26:18 +08:00
|
|
|
# make sure we're on a supported architecture with Matlab and python installed
|
2013-08-28 10:01:34 +08:00
|
|
|
if (IOS OR ANDROID OR NOT MATLAB_FOUND)
|
|
|
|
ocv_module_disable(matlab)
|
|
|
|
return()
|
|
|
|
elseif (NOT PYTHONLIBS_FOUND)
|
|
|
|
message(WARNING "A required dependency of the matlab module (PythonLibs) was not found. Disabling Matlab bindings...")
|
2013-03-11 00:17:05 +08:00
|
|
|
ocv_module_disable(matlab)
|
2013-06-19 11:59:22 +08:00
|
|
|
return()
|
2013-03-11 00:17:05 +08:00
|
|
|
endif()
|
2013-09-02 22:16:46 +08:00
|
|
|
|
2013-03-11 00:17:05 +08:00
|
|
|
|
2013-08-06 11:01:57 +08:00
|
|
|
# If the user built OpenCV as X-bit, but they have a Y-bit version of Matlab,
|
|
|
|
# attempting to link to OpenCV during binding generation will fail, since
|
|
|
|
# mixed precision pointers are not allowed. Disable the bindings.
|
2013-08-08 00:42:17 +08:00
|
|
|
math(EXPR ARCH "${CMAKE_SIZEOF_VOID_P} * 8")
|
|
|
|
if (${ARCH} EQUAL 32 AND ${MATLAB_ARCH} MATCHES "64")
|
2013-08-06 11:01:57 +08:00
|
|
|
warn_mixed_precision("32" "64")
|
|
|
|
ocv_module_disable(matlab)
|
|
|
|
return()
|
2013-08-08 00:42:17 +08:00
|
|
|
elseif (${ARCH} EQUAL 64 AND NOT ${MATLAB_ARCH} MATCHES "64")
|
2013-08-06 11:01:57 +08:00
|
|
|
warn_mixed_precision("64" "32")
|
|
|
|
ocv_module_disable(matlab)
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2013-08-28 10:01:34 +08:00
|
|
|
# If it's MSVC, warn the user that bindings will only be built in Release mode.
|
|
|
|
# Debug mode seems to cause issues...
|
|
|
|
if (MSVC)
|
|
|
|
message(STATUS "Warning: Matlab bindings will only be built in Release configurations")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Configure time components
|
|
|
|
# ----------------------------------------------------------------------------
|
2013-03-11 00:17:05 +08:00
|
|
|
set(the_description "The Matlab/Octave bindings")
|
2013-06-28 09:13:04 +08:00
|
|
|
ocv_add_module(matlab BINDINGS
|
2013-06-24 04:34:01 +08:00
|
|
|
OPTIONAL opencv_core
|
2013-06-28 04:58:40 +08:00
|
|
|
opencv_imgproc opencv_ml opencv_highgui
|
2013-06-28 09:13:04 +08:00
|
|
|
opencv_objdetect opencv_flann opencv_features2d
|
|
|
|
opencv_photo opencv_video opencv_videostab
|
|
|
|
opencv_calib opencv_calib3d
|
2013-09-02 22:16:46 +08:00
|
|
|
opencv_stitching opencv_superres
|
2013-06-28 07:25:18 +08:00
|
|
|
opencv_nonfree
|
2013-06-28 04:58:40 +08:00
|
|
|
)
|
2013-03-11 00:17:05 +08:00
|
|
|
|
2013-08-08 00:42:17 +08:00
|
|
|
# get the commit information
|
|
|
|
execute_process(COMMAND git log -1 --pretty=%H OUTPUT_VARIABLE GIT_COMMIT ERROR_QUIET)
|
2013-08-08 03:26:56 +08:00
|
|
|
string(REGEX REPLACE "(\r?\n)+$" "" GIT_COMMIT "${GIT_COMMIT}")
|
2013-08-08 00:42:17 +08:00
|
|
|
|
2013-09-15 15:31:34 +08:00
|
|
|
# set the path to the C++ header and doc parser, and template engine
|
|
|
|
set(JINJA2_PATH ${CMAKE_SOURCE_DIR}/3rdparty)
|
2013-08-06 22:14:13 +08:00
|
|
|
set(HDR_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/python/src2)
|
|
|
|
set(RST_PARSER_PATH ${CMAKE_SOURCE_DIR}/modules/java/generator)
|
2013-06-23 03:38:40 +08:00
|
|
|
|
|
|
|
# set mex compiler options
|
|
|
|
prepend("-I" MEX_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
2014-04-28 19:42:27 +08:00
|
|
|
if (MSVC)
|
|
|
|
prepend("-L" MEX_LIB_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
|
|
|
|
else()
|
|
|
|
prepend("-L" MEX_LIB_DIR ${LIBRARY_OUTPUT_PATH})
|
|
|
|
endif()
|
2013-08-08 00:42:17 +08:00
|
|
|
set(MEX_OPTS "-largeArrayDims")
|
2013-06-19 15:37:41 +08:00
|
|
|
|
2013-06-19 13:04:52 +08:00
|
|
|
if (BUILD_TESTS)
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
2013-07-30 21:58:32 +08:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
2013-06-18 21:00:48 +08:00
|
|
|
|
2013-08-04 22:44:38 +08:00
|
|
|
|
2013-08-28 10:01:34 +08:00
|
|
|
# intersection of available modules and optional dependencies
|
|
|
|
# 1. populate the command-line include directories (-I/path/to/module/header, ...)
|
|
|
|
# 2. populate the command-line link libraries (-lopencv_core, ...) for Debug and Release
|
2013-06-24 00:44:26 +08:00
|
|
|
set(MATLAB_DEPS ${OPENCV_MODULE_${the_module}_REQ_DEPS} ${OPENCV_MODULE_${the_module}_OPT_DEPS})
|
|
|
|
foreach(opencv_module ${MATLAB_DEPS})
|
|
|
|
if (HAVE_${opencv_module})
|
|
|
|
string(REPLACE "opencv_" "" module ${opencv_module})
|
2013-08-07 14:34:30 +08:00
|
|
|
list(APPEND opencv_modules ${module})
|
2013-06-24 00:44:26 +08:00
|
|
|
list(APPEND ${the_module}_ACTUAL_DEPS ${opencv_module})
|
|
|
|
prepend("-I" MEX_INCLUDE_DIRS "${OPENCV_MODULE_${opencv_module}_LOCATION}/include")
|
2013-08-05 15:37:48 +08:00
|
|
|
prepend("-l" MEX_LIBS ${opencv_module}${OPENCV_DLLVERSION})
|
|
|
|
prepend("-l" MEX_DEBUG_LIBS ${opencv_module}${OPENCV_DLLVERSION}${OPENCV_DEBUG_POSTFIX})
|
2013-06-23 14:26:27 +08:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2013-07-30 21:58:32 +08:00
|
|
|
# add extra headers by hand
|
2013-08-08 03:26:56 +08:00
|
|
|
list(APPEND opencv_extra_hdrs "core=${OPENCV_MODULE_opencv_core_LOCATION}/include/opencv2/core/base.hpp")
|
2013-09-01 15:10:44 +08:00
|
|
|
list(APPEND opencv_extra_hdrs "video=${OPENCV_MODULE_opencv_video_LOCATION}/include/opencv2/video/tracking.hpp")
|
2013-07-30 21:58:32 +08:00
|
|
|
|
2013-08-04 22:44:38 +08:00
|
|
|
# pass the OPENCV_CXX_EXTRA_FLAGS through to the mex compiler
|
|
|
|
# remove the visibility modifiers, so the mex gateway is visible
|
2013-08-08 00:42:17 +08:00
|
|
|
# TODO: get mex working without warnings
|
2013-08-28 10:01:34 +08:00
|
|
|
string(REGEX REPLACE "[^\ ]*visibility[^\ ]*" "" MEX_CXXFLAGS "${OPENCV_EXTRA_FLAGS} ${OPENCV_EXTRA_CXX_FLAGS}")
|
2013-08-04 22:44:38 +08:00
|
|
|
|
2013-06-23 14:52:05 +08:00
|
|
|
# Configure checks
|
|
|
|
# Check to see whether the generator and the mex compiler are working.
|
|
|
|
# The checks currently test:
|
|
|
|
# - whether the python generator can be found
|
|
|
|
# - whether the python generator correctly outputs a file for a definition
|
|
|
|
# - whether the mex compiler can find the required headers
|
|
|
|
# - whether the mex compiler can compile a trivial definition
|
|
|
|
if (NOT MEX_WORKS)
|
|
|
|
# attempt to generate a gateway for a function
|
2013-06-24 00:44:26 +08:00
|
|
|
message(STATUS "Trying to generate Matlab code")
|
2013-06-23 14:52:05 +08:00
|
|
|
execute_process(
|
2013-09-02 22:16:46 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/generator/gen_matlab.py
|
2013-09-15 15:31:34 +08:00
|
|
|
--jinja2 ${JINJA2_PATH}
|
2013-08-06 23:41:10 +08:00
|
|
|
--hdrparser ${HDR_PARSER_PATH}
|
|
|
|
--rstparser ${RST_PARSER_PATH}
|
2013-08-08 03:26:56 +08:00
|
|
|
--extra "test=${CMAKE_CURRENT_SOURCE_DIR}/test/test_generator.hpp"
|
2013-08-06 23:41:10 +08:00
|
|
|
--outdir ${CMAKE_BINARY_DIR}/junk
|
2013-06-23 14:52:05 +08:00
|
|
|
ERROR_VARIABLE GEN_ERROR
|
2013-09-02 22:16:46 +08:00
|
|
|
OUTPUT_QUIET
|
2013-06-23 14:52:05 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if (GEN_ERROR)
|
|
|
|
message(${GEN_ERROR})
|
2013-06-24 00:44:26 +08:00
|
|
|
message(STATUS "Error generating Matlab code. Disabling Matlab bindings...")
|
2013-08-06 11:01:57 +08:00
|
|
|
ocv_module_disable(matlab)
|
2013-06-23 14:52:05 +08:00
|
|
|
return()
|
|
|
|
else()
|
2013-06-24 00:44:26 +08:00
|
|
|
message(STATUS "Trying to generate Matlab code - OK")
|
2013-06-23 14:52:05 +08:00
|
|
|
endif()
|
2013-06-18 21:00:48 +08:00
|
|
|
|
2013-06-23 14:52:05 +08:00
|
|
|
# attempt to compile a gateway using mex
|
2013-06-24 00:44:26 +08:00
|
|
|
message(STATUS "Trying to compile mex file")
|
2013-06-23 14:52:05 +08:00
|
|
|
execute_process(
|
2013-08-28 10:01:34 +08:00
|
|
|
COMMAND ${MATLAB_MEX_SCRIPT} ${MEX_OPTS} "CXXFLAGS=\$CXXFLAGS ${MEX_CXX_FLAGS}"
|
2013-08-04 22:44:38 +08:00
|
|
|
${MEX_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/test/test_compiler.cpp
|
2013-06-23 14:52:05 +08:00
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/junk
|
|
|
|
ERROR_VARIABLE MEX_ERROR
|
2013-07-12 08:38:48 +08:00
|
|
|
OUTPUT_QUIET
|
2013-06-23 14:52:05 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
if (MEX_ERROR)
|
|
|
|
message(${MEX_ERROR})
|
2013-06-24 00:44:26 +08:00
|
|
|
message(STATUS "Error compiling mex file. Disabling Matlab bindings...")
|
2013-08-06 11:01:57 +08:00
|
|
|
ocv_module_disable(matlab)
|
2013-06-23 14:52:05 +08:00
|
|
|
return()
|
|
|
|
else()
|
2013-06-24 00:44:26 +08:00
|
|
|
message(STATUS "Trying to compile mex file - OK")
|
2013-06-23 14:52:05 +08:00
|
|
|
endif()
|
2013-06-18 21:00:48 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# if we make it here, mex works!
|
2013-06-23 14:52:05 +08:00
|
|
|
set(MEX_WORKS True CACHE BOOL ADVANCED)
|
2013-06-18 21:00:48 +08:00
|
|
|
|
2013-08-04 22:44:38 +08:00
|
|
|
|
2013-06-18 21:00:48 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Build time components
|
|
|
|
# ----------------------------------------------------------------------------
|
2013-06-23 14:52:05 +08:00
|
|
|
|
|
|
|
# proxies
|
|
|
|
# these proxies are used to trigger the add_custom_commands
|
|
|
|
# (which do the real work) only when they're outdated
|
2013-06-23 14:26:27 +08:00
|
|
|
set(GENERATE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/generate.proxy)
|
|
|
|
set(COMPILE_PROXY ${CMAKE_CURRENT_BINARY_DIR}/compile.proxy)
|
2013-08-04 22:44:38 +08:00
|
|
|
# TODO: Remove following line before merging with master
|
2013-06-28 07:25:18 +08:00
|
|
|
file(REMOVE ${GENERATE_PROXY} ${COMPILE_PROXY})
|
2013-03-14 15:26:18 +08:00
|
|
|
|
2013-06-23 14:52:05 +08:00
|
|
|
# generate
|
|
|
|
# call the python executable to generate the Matlab gateways
|
2013-06-23 14:26:27 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${GENERATE_PROXY}
|
2013-09-02 22:16:46 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/generator/gen_matlab.py
|
2013-09-15 15:31:34 +08:00
|
|
|
--jinja2 ${JINJA2_PATH}
|
2013-08-07 14:34:30 +08:00
|
|
|
--hdrparser ${HDR_PARSER_PATH}
|
|
|
|
--rstparser ${RST_PARSER_PATH}
|
|
|
|
--moduleroot ${CMAKE_SOURCE_DIR}/modules
|
|
|
|
--modules ${opencv_modules}
|
2013-09-02 22:16:46 +08:00
|
|
|
--extra ${opencv_extra_hdrs}
|
2013-08-07 14:34:30 +08:00
|
|
|
--outdir ${CMAKE_CURRENT_BINARY_DIR}
|
2013-08-08 00:42:17 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/generator/build_info.py
|
2013-09-15 15:31:34 +08:00
|
|
|
--jinja2 ${JINJA2_PATH}
|
|
|
|
--os ${CMAKE_SYSTEM}
|
|
|
|
--arch ${ARCH} ${CMAKE_SYSTEM_PROCESSOR}
|
|
|
|
--compiler ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}
|
|
|
|
--mex_arch ${MATLAB_ARCH}
|
|
|
|
--mex_script ${MATLAB_MEX_SCRIPT}
|
|
|
|
--cxx_flags ${MEX_CXXFLAGS}
|
2013-09-02 22:16:46 +08:00
|
|
|
--opencv_version ${OPENCV_VERSION}
|
2013-09-15 15:31:34 +08:00
|
|
|
--commit ${GIT_COMMIT}
|
|
|
|
--modules ${opencv_modules}
|
2013-10-24 20:58:21 +08:00
|
|
|
--configuration $<CONFIGURATION>
|
2013-09-15 15:31:34 +08:00
|
|
|
--outdir ${CMAKE_CURRENT_BINARY_DIR}
|
2013-08-28 10:01:34 +08:00
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/generator/cvmex.py
|
2013-09-15 15:31:34 +08:00
|
|
|
--jinja2 ${JINJA2_PATH}
|
2013-08-28 10:01:34 +08:00
|
|
|
--opts="${MEX_OPTS}"
|
|
|
|
--include_dirs="${MEX_INCLUDE_DIRS}"
|
2013-12-26 17:54:05 +08:00
|
|
|
--lib_dir="${MEX_LIB_DIR}"
|
2013-08-28 10:01:34 +08:00
|
|
|
--libs="${MEX_LIBS}"
|
2013-09-15 15:31:34 +08:00
|
|
|
--flags ${MEX_CXXFLAGS}
|
2013-08-28 10:01:34 +08:00
|
|
|
--outdir ${CMAKE_CURRENT_BINARY_DIR}
|
2013-08-08 00:42:17 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/test/help.m ${CMAKE_CURRENT_BINARY_DIR}/+cv
|
2013-06-23 14:26:27 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch ${GENERATE_PROXY}
|
2013-07-12 14:57:05 +08:00
|
|
|
COMMENT "Generating Matlab source files"
|
2013-06-19 11:59:22 +08:00
|
|
|
)
|
2013-03-14 15:26:18 +08:00
|
|
|
|
2013-06-23 14:52:05 +08:00
|
|
|
# compile
|
|
|
|
# call the mex compiler to compile the gateways
|
|
|
|
# because we don't know the source files at configure-time, this
|
|
|
|
# has to be executed in a separate script in cmake's script processing mode
|
2013-06-23 14:26:27 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${COMPILE_PROXY}
|
|
|
|
COMMAND ${CMAKE_COMMAND} -DMATLAB_MEX_SCRIPT=${MATLAB_MEX_SCRIPT}
|
2013-06-27 15:25:48 +08:00
|
|
|
-DMATLAB_MEXEXT=${MATLAB_MEXEXT}
|
2013-06-23 14:26:27 +08:00
|
|
|
-DMEX_OPTS=${MEX_OPTS}
|
2013-08-28 10:01:34 +08:00
|
|
|
-DMEX_CXXFLAGS=${MEX_CXX_FLAGS}
|
2013-06-23 14:26:27 +08:00
|
|
|
-DMEX_INCLUDE_DIRS="${MEX_INCLUDE_DIRS}"
|
2013-12-26 17:54:05 +08:00
|
|
|
-DMEX_LIB_DIR="${MEX_LIB_DIR}"
|
2013-10-24 20:58:21 +08:00
|
|
|
-DCONFIGURATION="$<CONFIGURATION>"
|
2013-06-23 14:26:27 +08:00
|
|
|
-DMEX_LIBS="${MEX_LIBS}"
|
2013-08-05 15:37:48 +08:00
|
|
|
-DMEX_DEBUG_LIBS="${MEX_DEBUG_LIBS}"
|
2013-06-23 14:26:27 +08:00
|
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/compile.cmake
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E touch ${COMPILE_PROXY}
|
|
|
|
COMMENT "Compiling Matlab source files. This could take a while..."
|
|
|
|
)
|
|
|
|
|
2013-06-23 14:52:05 +08:00
|
|
|
# targets
|
2013-06-24 04:34:01 +08:00
|
|
|
# opencv_matlab_sources --> opencv_matlab
|
2013-06-23 14:26:27 +08:00
|
|
|
add_custom_target(${the_module}_sources ALL DEPENDS ${GENERATE_PROXY})
|
|
|
|
add_custom_target(${the_module} ALL DEPENDS ${COMPILE_PROXY})
|
2013-06-24 00:44:26 +08:00
|
|
|
add_dependencies(${the_module} ${the_module}_sources ${${the_module}_ACTUAL_DEPS})
|
2013-06-19 13:04:52 +08:00
|
|
|
|
2013-07-31 10:37:05 +08:00
|
|
|
if (ENABLE_SOLUTION_FOLDERS)
|
|
|
|
set_target_properties(${the_module} PROPERTIES FOLDER "modules")
|
|
|
|
endif()
|
|
|
|
|
2013-08-04 22:44:38 +08:00
|
|
|
|
2013-06-19 13:04:52 +08:00
|
|
|
# ----------------------------------------------------------------------------
|
|
|
|
# Install time components
|
|
|
|
# ----------------------------------------------------------------------------
|
2013-06-24 04:34:01 +08:00
|
|
|
# NOTE: Trailing slashes on the DIRECTORY paths are important!
|
2013-06-24 11:48:40 +08:00
|
|
|
# TODO: What needs to be done with rpath????
|
2013-08-28 15:06:19 +08:00
|
|
|
|
|
|
|
# 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
|
2013-09-15 15:31:34 +08:00
|
|
|
--jinja2 ${JINJA2_PATH}
|
2013-08-28 15:06:19 +08:00
|
|
|
--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
|
|
|
|
)"
|
2013-06-27 08:39:08 +08:00
|
|
|
)
|