FindMatlab: adding handling of component "MAT"
- documentation - test - cosmetic changes
This commit is contained in:
parent
57d121fbb1
commit
bf09271b65
|
@ -15,8 +15,8 @@
|
||||||
#
|
#
|
||||||
# The module supports the following components:
|
# The module supports the following components:
|
||||||
#
|
#
|
||||||
# * ``MX_LIBRARY`` and ``ENG_LIBRARY`` respectively the MX and ENG libraries of
|
# * ``MX_LIBRARY``, ``ENG_LIBRARY`` and ``MAT_LIBRARY``: respectively the MX,
|
||||||
# Matlab
|
# ENG and MAT libraries of Matlab
|
||||||
# * ``MAIN_PROGRAM`` the Matlab binary program.
|
# * ``MAIN_PROGRAM`` the Matlab binary program.
|
||||||
#
|
#
|
||||||
# .. note::
|
# .. note::
|
||||||
|
@ -93,6 +93,9 @@
|
||||||
# ``Matlab_ENG_LIBRARY``
|
# ``Matlab_ENG_LIBRARY``
|
||||||
# Matlab engine library. Available only if the component ``ENG_LIBRARY``
|
# Matlab engine library. Available only if the component ``ENG_LIBRARY``
|
||||||
# is requested.
|
# is requested.
|
||||||
|
# ``Matlab_MAT_LIBRARY``
|
||||||
|
# Matlab matrix library. Available only if the component ``MAT_LIBRARY``
|
||||||
|
# is requested.
|
||||||
# ``Matlab_LIBRARIES``
|
# ``Matlab_LIBRARIES``
|
||||||
# the whole set of libraries of Matlab
|
# the whole set of libraries of Matlab
|
||||||
# ``Matlab_MEX_COMPILER``
|
# ``Matlab_MEX_COMPILER``
|
||||||
|
@ -1213,6 +1216,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
|
||||||
Matlab_MAIN_PROGRAM
|
Matlab_MAIN_PROGRAM
|
||||||
Matlab_MX_LIBRARY
|
Matlab_MX_LIBRARY
|
||||||
Matlab_ENG_LIBRARY
|
Matlab_ENG_LIBRARY
|
||||||
|
Matlab_MAT_LIBRARY
|
||||||
Matlab_MEX_EXTENSION
|
Matlab_MEX_EXTENSION
|
||||||
|
|
||||||
# internal
|
# internal
|
||||||
|
@ -1346,7 +1350,6 @@ _Matlab_find_library(
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
|
list(APPEND _matlab_required_variables Matlab_MEX_LIBRARY)
|
||||||
|
|
||||||
# the MEX extension is required
|
# the MEX extension is required
|
||||||
|
@ -1355,7 +1358,6 @@ list(APPEND _matlab_required_variables Matlab_MEX_EXTENSION)
|
||||||
# the matlab root is required
|
# the matlab root is required
|
||||||
list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
|
list(APPEND _matlab_required_variables Matlab_ROOT_DIR)
|
||||||
|
|
||||||
|
|
||||||
# component Mex Compiler
|
# component Mex Compiler
|
||||||
list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler)
|
list(FIND Matlab_FIND_COMPONENTS MEX_COMPILER _matlab_find_mex_compiler)
|
||||||
if(_matlab_find_mex_compiler GREATER -1)
|
if(_matlab_find_mex_compiler GREATER -1)
|
||||||
|
@ -1366,7 +1368,6 @@ if(_matlab_find_mex_compiler GREATER -1)
|
||||||
DOC "Matlab MEX compiler"
|
DOC "Matlab MEX compiler"
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
if(Matlab_MEX_COMPILER)
|
if(Matlab_MEX_COMPILER)
|
||||||
set(Matlab_MEX_COMPILER_FOUND TRUE)
|
set(Matlab_MEX_COMPILER_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -1376,7 +1377,6 @@ unset(_matlab_find_mex_compiler)
|
||||||
# component Matlab program
|
# component Matlab program
|
||||||
list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program)
|
list(FIND Matlab_FIND_COMPONENTS MAIN_PROGRAM _matlab_find_matlab_program)
|
||||||
if(_matlab_find_matlab_program GREATER -1)
|
if(_matlab_find_matlab_program GREATER -1)
|
||||||
|
|
||||||
find_program(
|
find_program(
|
||||||
Matlab_MAIN_PROGRAM
|
Matlab_MAIN_PROGRAM
|
||||||
matlab
|
matlab
|
||||||
|
@ -1384,11 +1384,9 @@ if(_matlab_find_matlab_program GREATER -1)
|
||||||
DOC "Matlab main program"
|
DOC "Matlab main program"
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
if(Matlab_MAIN_PROGRAM)
|
if(Matlab_MAIN_PROGRAM)
|
||||||
set(Matlab_MAIN_PROGRAM_FOUND TRUE)
|
set(Matlab_MAIN_PROGRAM_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
unset(_matlab_find_matlab_program)
|
unset(_matlab_find_matlab_program)
|
||||||
|
|
||||||
|
@ -1402,14 +1400,12 @@ if(_matlab_find_mx GREATER -1)
|
||||||
PATHS ${_matlab_lib_dir_for_search}
|
PATHS ${_matlab_lib_dir_for_search}
|
||||||
NO_DEFAULT_PATH
|
NO_DEFAULT_PATH
|
||||||
)
|
)
|
||||||
|
|
||||||
if(Matlab_MX_LIBRARY)
|
if(Matlab_MX_LIBRARY)
|
||||||
set(Matlab_MX_LIBRARY_FOUND TRUE)
|
set(Matlab_MX_LIBRARY_FOUND TRUE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
unset(_matlab_find_mx)
|
unset(_matlab_find_mx)
|
||||||
|
|
||||||
|
|
||||||
# Component ENG library
|
# Component ENG library
|
||||||
list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng)
|
list(FIND Matlab_FIND_COMPONENTS ENG_LIBRARY _matlab_find_eng)
|
||||||
if(_matlab_find_eng GREATER -1)
|
if(_matlab_find_eng GREATER -1)
|
||||||
|
@ -1426,15 +1422,26 @@ if(_matlab_find_eng GREATER -1)
|
||||||
endif()
|
endif()
|
||||||
unset(_matlab_find_eng)
|
unset(_matlab_find_eng)
|
||||||
|
|
||||||
|
# Component MAT library
|
||||||
|
list(FIND Matlab_FIND_COMPONENTS MAT_LIBRARY _matlab_find_mat)
|
||||||
|
if(_matlab_find_mat GREATER -1)
|
||||||
|
_Matlab_find_library(
|
||||||
|
${_matlab_lib_prefix_for_search}
|
||||||
|
Matlab_MAT_LIBRARY
|
||||||
|
mat
|
||||||
|
PATHS ${_matlab_lib_dir_for_search}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
if(Matlab_MAT_LIBRARY)
|
||||||
|
set(Matlab_MAT_LIBRARY_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
unset(_matlab_find_mat)
|
||||||
|
|
||||||
|
|
||||||
unset(_matlab_lib_dir_for_search)
|
unset(_matlab_lib_dir_for_search)
|
||||||
|
|
||||||
|
set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY})
|
||||||
set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY})
|
|
||||||
|
|
||||||
|
|
||||||
find_package_handle_standard_args(
|
find_package_handle_standard_args(
|
||||||
Matlab
|
Matlab
|
||||||
|
@ -1453,18 +1460,14 @@ unset(_matlab_lib_prefix_for_search)
|
||||||
|
|
||||||
if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES)
|
if(Matlab_INCLUDE_DIRS AND Matlab_LIBRARIES)
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
#Matlab_LIBRARIES
|
|
||||||
Matlab_MEX_LIBRARY
|
Matlab_MEX_LIBRARY
|
||||||
Matlab_MX_LIBRARY
|
Matlab_MX_LIBRARY
|
||||||
Matlab_ENG_LIBRARY
|
Matlab_ENG_LIBRARY
|
||||||
|
Matlab_MAT_LIBRARY
|
||||||
Matlab_INCLUDE_DIRS
|
Matlab_INCLUDE_DIRS
|
||||||
Matlab_FOUND
|
Matlab_FOUND
|
||||||
#Matlab_ROOT_DIR
|
|
||||||
#Matlab_VERSION_STRING
|
|
||||||
Matlab_MAIN_PROGRAM
|
Matlab_MAIN_PROGRAM
|
||||||
#Matlab_MEX_EXTENSION
|
|
||||||
Matlab_MEXEXTENSIONS_PROG
|
Matlab_MEXEXTENSIONS_PROG
|
||||||
Matlab_MEX_EXTENSION
|
Matlab_MEX_EXTENSION
|
||||||
#Matlab_BINARIES_DIR
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1413,6 +1413,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
||||||
if(CMake_TEST_FindMatlab)
|
if(CMake_TEST_FindMatlab)
|
||||||
ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
|
ADD_TEST_MACRO(FindMatlab.basic_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
|
||||||
ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
|
ADD_TEST_MACRO(FindMatlab.versions_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
|
||||||
|
ADD_TEST_MACRO(FindMatlab.components_checks ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(GTK2 QUIET)
|
find_package(GTK2 QUIET)
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
|
||||||
|
cmake_minimum_required (VERSION 2.8.12)
|
||||||
|
enable_testing()
|
||||||
|
project(component_checks)
|
||||||
|
|
||||||
|
set(MATLAB_FIND_DEBUG TRUE)
|
||||||
|
|
||||||
|
# the success of the following command is dependent on the current configuration:
|
||||||
|
# - on 32bits builds (cmake is building with 32 bits), it looks for 32 bits Matlab
|
||||||
|
# - on 64bits builds (cmake is building with 64 bits), it looks for 64 bits Matlab
|
||||||
|
find_package(Matlab REQUIRED COMPONENTS MX_LIBRARY ENG_LIBRARY MAT_LIBRARY MAIN_PROGRAM)
|
||||||
|
|
||||||
|
message(STATUS "FindMatlab libraries: ${Matlab_LIBRARIES}")
|
||||||
|
|
||||||
|
matlab_add_mex(
|
||||||
|
# target name
|
||||||
|
NAME cmake_matlab_test_wrapper1
|
||||||
|
# output name
|
||||||
|
OUTPUT_NAME cmake_matlab_mex1
|
||||||
|
SRC ${CMAKE_CURRENT_SOURCE_DIR}/../matlab_wrapper1.cpp
|
||||||
|
DOCUMENTATION ${CMAKE_CURRENT_SOURCE_DIR}/../help_text1.m.txt
|
||||||
|
LINK_TO ${Matlab_LIBRARIES}
|
||||||
|
)
|
Loading…
Reference in New Issue