File: FindMatlabMex.cmake

package info (click to toggle)
vtk6 6.3.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,880 kB
  • sloc: cpp: 1,442,792; ansic: 113,395; python: 72,383; tcl: 46,998; xml: 8,119; yacc: 4,525; java: 4,239; perl: 3,108; lex: 1,694; sh: 1,093; asm: 154; makefile: 103; objc: 17
file content (71 lines) | stat: -rw-r--r-- 2,308 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

# - This module locates the Matlab Engine and Matlab mex.
# Defines the following:
# MATLAB_ROOT_DIR - Matlab installation directory
# MATLAB_INCLUDE_DIR - Path to Matlab include directory
# MATLAB_LIB_DIR - Path to Matlab library directory
# MATLAB_MEX_EXECUTABLE - Path to mex compiler executable
# MATLAB_EXECUTABLE - Path to the matlab executable

# Determine platform

IF(UNIX)
  IF(APPLE)
   SET(MATLAB_ROOT_SEARCH "/Applications")
   IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
    SET(MATLAB_DIR_PREFIX "maci")
   ELSE()
    SET(MATLAB_DIR_PREFIX "maci64")
   ENDIF()
  ELSE()
   SET(MATLAB_ROOT_SEARCH "/usr/local/")
   IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
    SET(MATLAB_DIR_PREFIX "glnx86")
   ELSE()
    SET(MATLAB_DIR_PREFIX "glnxa64")
   ENDIF()
  ENDIF()
ELSE()
   SET(MATLAB_ROOT_SEARCH "C:/PROGRA~1/")
   IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
    SET(MATLAB_DIR_PREFIX "win32")
   ELSE()
    SET(MATLAB_DIR_PREFIX "win64")
   ENDIF()
ENDIF()
FIND_PROGRAM(MATLAB_EXECUTABLE matlab PATHS ${MATLAB_ROOT_SEARCH})

IF(NOT MATLAB_EXECUTABLE)
  MESSAGE( FATAL_ERROR "Matlab program not found, please specify MATLAB_EXECUTABLE" )
ENDIF()

GET_FILENAME_COMPONENT(MATLAB_ROOT_DIR_WORK ${MATLAB_EXECUTABLE} PATH)

IF("${MATLAB_ROOT_DIR_WORK}" MATCHES "/${MATLAB_DIR_PREFIX}$")
  GET_FILENAME_COMPONENT(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_WORK} PATH CACHE)
ENDIF()

IF("${MATLAB_ROOT_DIR_WORK}" MATCHES "/bin$")
  GET_FILENAME_COMPONENT(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_WORK} PATH CACHE)
ENDIF()

FIND_PATH(MATLAB_INCLUDE_DIR NAMES mex.h PATHS ${MATLAB_ROOT_DIR}/extern/include CACHE DOCSTRING)

#Find Library directory
IF(NOT WIN32)
  FIND_LIBRARY(MATLAB_LIB_DIR_WORK mex ${MATLAB_ROOT_DIR}/bin/${MATLAB_DIR_PREFIX})
ELSE()
  FIND_LIBRARY(MATLAB_LIB_DIR_WORK mex ${MATLAB_ROOT_DIR}/extern/lib/${MATLAB_DIR_PREFIX}/microsoft)
ENDIF()
GET_FILENAME_COMPONENT(MATLAB_LIB_DIR ${MATLAB_LIB_DIR_WORK} PATH CACHE)
UNSET(MATLAB_LIB_DIR_WORK CACHE)

# Find mex executable
IF(NOT WIN32)
  FIND_PROGRAM(MATLAB_MEX_EXECUTABLE NAMES mex PATHS ${MATLAB_ROOT_DIR} ${MATLAB_ROOT_DIR_WORK}  DOC "Path to Matlab mex compiler")
ELSE()
  FIND_FILE(MATLAB_MEX_EXECUTABLE NAMES mex.bat PATHS ${MATLAB_ROOT_DIR} ${MATLAB_ROOT_DIR_WORK} DOC "Path to Matlab mex compiler")
ENDIF()

SET(MATLAB_MEX_USE_FILE ${VTK_SOURCE_DIR}/CMake/UseMatlabMex.cmake)