Merge branch 'master' into next

This commit is contained in:
Paul Sutton 2017-03-06 16:13:18 +00:00
commit 631c5b18e2
2 changed files with 0 additions and 358 deletions

View File

@ -1,220 +0,0 @@
# - this module looks for Matlab
# Defines:
# MATLAB_INCLUDE_DIR: include path for mex.h, engine.h
# MATLAB_LIBRARIES: required libraries: libmex, etc
# MATLAB_MEX_LIBRARY: path to libmex.lib
# MATLAB_MX_LIBRARY: path to libmx.lib
# MATLAB_MAT_LIBRARY: path to libmat.lib # added
# MATLAB_ENG_LIBRARY: path to libeng.lib
# MATLAB_ROOT: path to Matlab's root directory
# This file is part of Gerardus
#
# This is a derivative work of file FindMatlab.cmake released with
# CMake v2.8, because the original seems to be a bit outdated and
# doesn't work with my Windows XP and Visual Studio 10 install
#
# (Note that the original file does work for Ubuntu Natty)
#
# Author: Ramon Casero <rcasero at gmail.com>, Tom Doel
# Version: 0.2.3
# $Rev$
# $Date$
#
# The original file was copied from an Ubuntu Linux install
# /usr/share/cmake-2.8/Modules/FindMatlab.cmake
set(MATLAB_FOUND FALSE)
if(WIN32)
# Search for a version of Matlab available, starting from the most modern one to older versions
foreach(MATVER "7.14" "7.11" "7.10" "7.9" "7.8" "7.7" "7.6" "7.5" "7.4")
if((NOT DEFINED MATLAB_ROOT)
OR ("${MATLAB_ROOT}" STREQUAL "")
OR ("${MATLAB_ROOT}" STREQUAL "/registry"))
get_filename_component(MATLAB_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\${MATVER};MATLABROOT]"
ABSOLUTE)
set(MATLAB_VERSION ${MATVER})
endif()
endforeach()
# Directory name depending on whether the Windows architecture is 32
# bit or 64 bit
set(CMAKE_SIZEOF_VOID_P 8) # Note: For some wierd reason this variable is undefined in my system...
if(CMAKE_SIZEOF_VOID_P MATCHES "4")
set(WINDIR "win32")
elseif(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(WINDIR "win64")
else()
message(FATAL_ERROR "CMAKE_SIZEOF_VOID_P (${CMAKE_SIZEOF_VOID_P}) doesn't indicate a valid platform")
endif()
# Folder where the MEX libraries are, depending of the Windows compiler
if(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/msvc60")
elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio 7")
# Assume people are generally using Visual Studio 7.1,
# if using 7.0 need to link to: ../extern/lib/${WINDIR}/microsoft/msvc70
set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/msvc71")
# set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/msvc70")
elseif(${CMAKE_GENERATOR} MATCHES "Borland")
# Assume people are generally using Borland 5.4,
# if using 7.0 need to link to ../extern/lib/${WINDIR}/microsoft/msvc70
set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/bcc54")
# set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/bcc50")
# set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/bcc51")
elseif(${CMAKE_GENERATOR} MATCHES "Visual Studio*")
# If the compiler is Visual Studio, but not any of the specific
# versions above, we try our luck with the microsoft directory
set(MATLAB_LIBRARIES_DIR "${MATLAB_ROOT}/extern/lib/${WINDIR}/microsoft/")
else()
message(FATAL_ERROR "Generator not compatible: ${CMAKE_GENERATOR}")
endif()
# Get paths to the Matlab MEX libraries
find_library(MATLAB_MEX_LIBRARY libmex ${MATLAB_LIBRARIES_DIR} )
find_library(MATLAB_MX_LIBRARY libm ${MATLAB_LIBRARIES_DIR} )
find_library(MATLAB_MAT_LIBRARY libmat ${MATLAB_LIBRARIES_DIR} )
find_library(MATLAB_ENG_LIBRARY libeng ${MATLAB_LIBRARIES_DIR} )
# Get path to the include directory
find_path(MATLAB_INCLUDE_DIR "mex.h" "${MATLAB_ROOT}/extern/include" )
else()
if((NOT DEFINED MATLAB_ROOT)
OR ("${MATLAB_ROOT}" STREQUAL ""))
# get path to the Matlab root directory
execute_process(
COMMAND which matlab
OUTPUT_VARIABLE MATLAB_BIN_EXISTS
)
IF (MATLAB_BIN_EXISTS)
execute_process(
COMMAND which matlab
COMMAND xargs realpath
COMMAND xargs dirname
COMMAND xargs dirname
COMMAND xargs echo -n
OUTPUT_VARIABLE MATLAB_ROOT
)
ENDIF (MATLAB_BIN_EXISTS)
endif()
# Check if this is a Mac
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(LIBRARY_EXTENSION .dylib)
# If this is a Mac and the attempts to find MATLAB_ROOT have so far failed,
# we look in the applications folder
if((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL ""))
# Search for a version of Matlab available, starting from the most modern one to older versions
foreach(MATVER "R2013b" "R2013a" "R2012b" "R2012a" "R2011b" "R2011a" "R2010b" "R2010a" "R2009b" "R2009a" "R2008b")
if((NOT DEFINED MATLAB_ROOT) OR ("${MATLAB_ROOT}" STREQUAL ""))
if(EXISTS /Applications/MATLAB_${MATVER}.app)
set(MATLAB_ROOT /Applications/MATLAB_${MATVER}.app)
endif()
endif()
endforeach()
endif()
else()
set(LIBRARY_EXTENSION .so)
endif()
# Get path to the MEX libraries
execute_process(
#COMMAND find "${MATLAB_ROOT}/extern/lib" -name libmex${LIBRARY_EXTENSION} # Peter
COMMAND find "${MATLAB_ROOT}/bin" -name libmex${LIBRARY_EXTENSION} # standard
COMMAND xargs echo -n
OUTPUT_VARIABLE MATLAB_MEX_LIBRARY
)
execute_process(
#COMMAND find "${MATLAB_ROOT}/extern/lib" -name libmx${LIBRARY_EXTENSION} # Peter
COMMAND find "${MATLAB_ROOT}/bin" -name libmx${LIBRARY_EXTENSION} # Standard
COMMAND xargs echo -n
OUTPUT_VARIABLE MATLAB_MX_LIBRARY
)
execute_process(
#COMMAND find "${MATLAB_ROOT}/extern/lib" -name libmat${LIBRARY_EXTENSION} # Peter
COMMAND find "${MATLAB_ROOT}/bin" -name libmat${LIBRARY_EXTENSION} # Standard
COMMAND xargs echo -n
OUTPUT_VARIABLE MATLAB_MAT_LIBRARY
)
execute_process(
#COMMAND find "${MATLAB_ROOT}/extern/lib" -name libeng${LIBRARY_EXTENSION} # Peter
COMMAND find "${MATLAB_ROOT}/bin" -name libeng${LIBRARY_EXTENSION} # Standard
COMMAND xargs echo -n
OUTPUT_VARIABLE MATLAB_ENG_LIBRARY
)
# Get path to the include directory
find_path(MATLAB_INCLUDE_DIR
"mex.h"
PATHS "${MATLAB_ROOT}/extern/include"
)
find_program( MATLAB_MEX_PATH mex
HINTS ${MATLAB_ROOT}/bin
PATHS ${MATLAB_ROOT}/bin
DOC "The mex program path"
)
find_program( MATLAB_MEXEXT_PATH mexext
HINTS ${MATLAB_ROOT}/bin
PATHS ${MATLAB_ROOT}/bin
DOC "The mexext program path"
)
execute_process(
COMMAND ${MATLAB_MEXEXT_PATH}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE MATLAB_MEX_EXT
)
endif()
# This is common to UNIX and Win32:
set(MATLAB_LIBRARIES
${MATLAB_MEX_LIBRARY}
${MATLAB_MX_LIBRARY}
${MATLAB_ENG_LIBRARY}
)
if(MATLAB_INCLUDE_DIR AND MATLAB_LIBRARIES)
set(MATLAB_FOUND TRUE)
endif()
# 32-bit or 64-bit mex
if(WIN32)
if (CMAKE_CL_64)
SET(MATLAB_MEX_EXTENSION .mexw64)
else(CMAKE_CL_64)
SET(MATLAB_MEX_EXTENSION .mexw32)
endif(CMAKE_CL_64)
else(WIN32)
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
SET(MATLAB_MEX_EXTENSION .mexa64)
else(CMAKE_SIZEOF_VOID_P MATCHES "8")
SET(MATLAB_MEX_EXTENSION .mexglx)
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
endif(WIN32)
SET(MATLAB_MEX_CFLAGS "-DMATLAB_MEX_FILE -DMX_COMPAT_32")
mark_as_advanced(
MATLAB_LIBRARIES
MATLAB_MEX_LIBRARY
MATLAB_MX_LIBRARY
MATLAB_ENG_LIBRARY
MATLAB_INCLUDE_DIR
MATLAB_FOUND
MATLAB_ROOT
MATLAB_MEX_PATH
MATLAB_MEXEXT_PATH
MATLAB_MEX_EXT
)

View File

@ -1,138 +0,0 @@
# - Try to find a version of Octave and headers/library required by the
# used compiler. It determines the right MEX-File extension and add
# a macro to help the build of MEX-functions.
#
# This module defines:
# OCTAVE_INCLUDE_DIR: include path for mex.h, mexproto.h
# OCTAVE_OCTINTERP_LIBRARY: path to the library octinterp
# OCTAVE_OCTAVE_LIBRARY: path to the library octave
# OCTAVE_CRUFT_LIBRARY: path to the library cruft
# OCTAVE_LIBRARIES: required libraries: octinterp, octave, cruft
# OCTAVE_CREATE_MEX: macro to build a MEX-file
#
# The macro OCTAVE_CREATE_MEX requires in this order:
# - function's name which will be called in Octave;
# - C/C++ source files;
# - third libraries required.
# Copyright (c) 2009-2013 Arnaud Barré <arnaud.barre@gmail.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF(OCTAVE_ROOT AND OCTAVE_INCLUDE_DIR AND OCTAVE_LIBRARIES)
STRING(COMPARE NOTEQUAL "${OCTAVE_ROOT}" "${OCTAVE_ROOT_LAST}" OCTAVE_CHANGED)
IF(OCTAVE_CHANGED)
SET(OCTAVE_USE_MINGW32 OCTAVE_USE_MINGW32-NOTFOUND CACHE INTERNAL "")
SET(OCTAVE_OCTAVE_LIBRARY OCTAVE_OCTAVE_LIBRARY-NOTFOUND CACHE INTERNAL "")
SET(OCTAVE_INCLUDE_DIR OCTAVE_INCLUDE_DIR-NOTFOUND CACHE INTERNAL "")
ELSE(OCTAVE_CHANGED)
# in cache already
SET(Octave_FIND_QUIETLY TRUE)
ENDIF(OCTAVE_CHANGED)
ENDIF(OCTAVE_ROOT AND OCTAVE_INCLUDE_DIR AND OCTAVE_LIBRARIES)
SET(OCTAVE_MEXFILE_EXT mex)
IF(WIN32)
SET(OCTAVE_PATHS_L1 )
SET(OCTAVE_PATHS_L2 )
# Level 0
FILE(GLOB OCTAVE_PATHS_L0 "c:/Octave*")
# Level 1
FOREACH(_file_ ${OCTAVE_PATHS_L0})
FILE(GLOB OCTAVE_PATHS_TEMP "${_file_}/*")
SET(OCTAVE_PATHS_L1 ${OCTAVE_PATHS_L1};${OCTAVE_PATHS_TEMP})
ENDFOREACH(_file_ OCTAVE_PATHS_L0)
# Level 2
FOREACH(_file_ ${OCTAVE_PATHS_L1})
FILE(GLOB OCTAVE_PATHS_TEMP "${_file_}/*")
SET(OCTAVE_PATHS_L2 ${OCTAVE_PATHS_L2};${OCTAVE_PATHS_TEMP})
ENDFOREACH(_file_ OCTAVE_PATHS_L1)
# Merge levels
SET(OCTAVE_PATHS ${OCTAVE_PATHS_L0} ${OCTAVE_PATHS_L1} ${OCTAVE_PATHS_L2})
FIND_PATH(OCTAVE_ROOT "bin/octave.exe" ${OCTAVE_PATHS})
FIND_PATH(OCTAVE_USE_MINGW32 "bin/mingw32-make.exe" "${OCTAVE_ROOT}/mingw32")
IF(MSVC AND OCTAVE_USE_MINGW32)
MESSAGE(FATAL_ERROR
"You must use the generator \"MinGW Makefiles\" as the "
"version of Octave installed on your computer was compiled "
"with MinGW. You should also specify the native compiler "
"(GCC, G++ and GFortan) and add the path of MinGW in the "
"environment variable PATH. Contact the developers of the "
"project for more details")
ENDIF(MSVC AND OCTAVE_USE_MINGW32)
FILE(GLOB OCTAVE_INCLUDE_PATHS "${OCTAVE_ROOT}/include/octave-*/octave")
FILE(GLOB OCTAVE_LIBRARIES_PATHS "${OCTAVE_ROOT}/lib/octave-*")
IF (NOT OCTAVE_LIBRARIES_PATHS)
FILE(GLOB OCTAVE_LIBRARIES_PATHS "${OCTAVE_ROOT}/lib/octave/*")
ENDIF (NOT OCTAVE_LIBRARIES_PATHS)
# LIBOCTINTERP, LIBOCTAVE, LIBCRUFT names
SET(LIBOCTAVE "liboctave")
ELSE(WIN32)
IF(APPLE)
FILE(GLOB OCTAVE_PATHS "/Applications/Octave*")
FIND_PATH(OCTAVE_ROOT "Contents/Resources/bin/octave" ${OCTAVE_PATHS})
FILE(GLOB OCTAVE_INCLUDE_PATHS "${OCTAVE_ROOT}/Contents/Resources/include/octave-*/octave")
FILE(GLOB OCTAVE_LIBRARIES_PATHS "${OCTAVE_ROOT}/Contents/Resources/lib/octave-*")
SET(LIBOCTAVE "liboctave.dylib")
ELSE(APPLE)
FILE(GLOB OCTAVE_LOCAL_PATHS "/usr/local/lib/octave-*")
FILE(GLOB OCTAVE_USR_PATHS "/usr/lib/octave-*")
FILE(GLOB OCTAVE_INCLUDE_PATHS "/usr/include/octave-*")
SET (OCTAVE_INCLUDE_PATHS
"/usr/local/include"
"/usr/local/include/octave"
"/usr/include"
"${OCTAVE_INCLUDE_PATHS}"
"${OCTAVE_INCLUDE_PATHS}/octave")
SET (OCTAVE_LIBRARIES_PATHS
"/usr/local/lib"
"/usr/local/lib/octave"
${OCTAVE_LOCAL_PATHS}
"/usr/lib"
"/usr/lib/octave"
${OCTAVE_USR_PATHS})
SET (LIBOCTAVE "octave")
ENDIF(APPLE)
ENDIF(WIN32)
FIND_LIBRARY(OCTAVE_OCTAVE_LIBRARY
${LIBOCTAVE}
${OCTAVE_LIBRARIES_PATHS}
)
FIND_PATH(OCTAVE_INCLUDE_DIR
"mex.h"
${OCTAVE_INCLUDE_PATHS}
)
SET(OCTAVE_ROOT_LAST "${OCTAVE_ROOT}" CACHE INTERNAL "" FORCE)
# This is common to UNIX and Win32:
SET(OCTAVE_LIBRARIES
${OCTAVE_OCTAVE_LIBRARY}
CACHE INTERNAL "Octave libraries" FORCE
)
INCLUDE(FindPackageHandleStandardArgs)
# The variable OCTAVE_ROOT is only relevant for WIN32
IF(WIN32)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Octave DEFAULT_MSG OCTAVE_ROOT OCTAVE_INCLUDE_DIR OCTAVE_OCTAVE_LIBRARY )
ELSE(WIN32)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Octave DEFAULT_MSG OCTAVE_INCLUDE_DIR OCTAVE_OCTAVE_LIBRARY )
ENDIF(WIN32)
MARK_AS_ADVANCED(
OCTAVE_OCTAVE_LIBRARY
OCTAVE_LIBRARIES
OCTAVE_INCLUDE_DIR
)