Просмотр исходного кода

FindMatlab: Add component to find MCC, the Matlab compiler

Add component `MCC_COMPILER` to request searching for the Matlab
compiler.  Report it in `Matlab_MCC_COMPILER` if it is found.

Issue: #18183
Jason Heeris 7 лет назад
Родитель
Сommit
f34f6eb3d1
2 измененных файлов с 27 добавлено и 1 удалено
  1. 5 0
      Help/release/dev/FindMatlab-mcc.rst
  2. 22 1
      Modules/FindMatlab.cmake

+ 5 - 0
Help/release/dev/FindMatlab-mcc.rst

@@ -0,0 +1,5 @@
+FindMatlab-mcc
+--------------
+
+* The :module:`FindMatlab` module gained a new ``MCC_COMPILER``
+  component to request finding the Matlab Compiler add-on.

+ 22 - 1
Modules/FindMatlab.cmake

@@ -25,6 +25,7 @@
 #   available on the MCR version, and will yield an error if the MCR is found
 #   instead of the regular Matlab installation.
 # * ``MEX_COMPILER`` the MEX compiler.
+# * ``MCC_COMPILER`` the MCC compiler, included with the Matlab Compiler add-on.
 # * ``SIMULINK`` the Simulink environment.
 #
 # .. note::
@@ -110,7 +111,10 @@
 #   the whole set of libraries of Matlab
 # ``Matlab_MEX_COMPILER``
 #   the mex compiler of Matlab. Currently not used.
-#   Available only if the component ``MEX_COMPILER`` is asked
+#   Available only if the component ``MEX_COMPILER`` is requested.
+# ``Matlab_MCC_COMPILER``
+#   the mcc compiler of Matlab. Included with the Matlab Compiler add-on.
+#   Available only if the component ``MCC_COMPILER`` is requested.
 #
 # Cached variables
 # """"""""""""""""
@@ -1420,6 +1424,7 @@ if(DEFINED Matlab_ROOT_DIR_LAST_CACHED)
         Matlab_INCLUDE_DIRS
         Matlab_MEX_LIBRARY
         Matlab_MEX_COMPILER
+        Matlab_MCC_COMPILER
         Matlab_MAIN_PROGRAM
         Matlab_MX_LIBRARY
         Matlab_ENG_LIBRARY
@@ -1660,6 +1665,22 @@ if(_matlab_find_simulink GREATER -1)
 endif()
 unset(_matlab_find_simulink)
 
+# component MCC Compiler
+list(FIND Matlab_FIND_COMPONENTS MCC_COMPILER _matlab_find_mcc_compiler)
+if(_matlab_find_mcc_compiler GREATER -1)
+  find_program(
+    Matlab_MCC_COMPILER
+    "mcc"
+    PATHS ${Matlab_BINARIES_DIR}
+    DOC "Matlab MCC compiler"
+    NO_DEFAULT_PATH
+  )
+  if(Matlab_MCC_COMPILER)
+    set(Matlab_MCC_COMPILER_FOUND TRUE)
+  endif()
+endif()
+unset(_matlab_find_mcc_compiler)
+
 unset(_matlab_lib_dir_for_search)
 
 set(Matlab_LIBRARIES ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY} ${Matlab_ENG_LIBRARY} ${Matlab_MAT_LIBRARY})