Warning, /graphics/kst-plot/cmake/modules/FindSciPy.cmake is written in an unsupported language. File is not indexed.
0001 #
0002 # Based on http://numexpr.googlecode.com/hg/FindSciPy.cmake
0003 #
0004 # - Find the SciPy libraries
0005 # This module finds if SciPy is installed, and sets the following variables
0006 # indicating where it is.
0007 #
0008 # TODO: Update to provide the libraries and paths for linking npymath lib.
0009 #
0010 # SCIPY_FOUND - was SciPy found
0011 # SCIPY_VERSION - the version of SciPy found as a string
0012 # SCIPY_VERSION_MAJOR - the major version number of SciPy
0013 # SCIPY_VERSION_MINOR - the minor version number of SciPy
0014 # SCIPY_VERSION_PATCH - the patch version number of SciPy
0015 # SCIPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601
0016 # SCIPY_INCLUDE_DIRS - path to the SciPy include files
0017
0018 #============================================================================
0019 # Copyright 2012 Continuum Analytics, Inc.
0020 #
0021 # MIT License
0022 #
0023 # Permission is hereby granted, free of charge, to any person obtaining
0024 # a copy of this software and associated documentation files
0025 # (the "Software"), to deal in the Software without restriction, including
0026 # without limitation the rights to use, copy, modify, merge, publish,
0027 # distribute, sublicense, and/or sell copies of the Software, and to permit
0028 # persons to whom the Software is furnished to do so, subject to
0029 # the following conditions:
0030 #
0031 # The above copyright notice and this permission notice shall be included
0032 # in all copies or substantial portions of the Software.
0033 #
0034 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0035 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0036 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
0037 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0038 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0039 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0040 # OTHER DEALINGS IN THE SOFTWARE.
0041 #
0042 #============================================================================
0043
0044 # Finding SciPy involves calling the Python interpreter
0045 if(SCIPY_FIND_REQUIRED)
0046 find_package(PythonInterp REQUIRED)
0047 else()
0048 find_package(PythonInterp)
0049 endif()
0050
0051 if(PYTHONINTERP_FOUND)
0052 execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c"
0053 "import scipy as n; print(n.__version__); print(n.get_include());"
0054 RESULT_VARIABLE _SCIPY_SEARCH_SUCCESS
0055 OUTPUT_VARIABLE _SCIPY_VALUES
0056 ERROR_VARIABLE _SCIPY_ERROR_VALUE
0057 OUTPUT_STRIP_TRAILING_WHITESPACE)
0058
0059 if(_SCIPY_SEARCH_SUCCESS MATCHES 0)
0060 set(SCIPY_FOUND TRUE)
0061
0062 # Convert the process output into a list
0063 string(REGEX REPLACE ";" "\\\\;" _SCIPY_VALUES ${_SCIPY_VALUES})
0064 string(REGEX REPLACE "\n" ";" _SCIPY_VALUES ${_SCIPY_VALUES})
0065 list(GET _SCIPY_VALUES 0 SCIPY_VERSION)
0066 list(GET _SCIPY_VALUES 1 SCIPY_INCLUDE_DIRS)
0067
0068 # Make sure all directory separators are '/'
0069 string(REGEX REPLACE "\\\\" "/" SCIPY_INCLUDE_DIRS ${SCIPY_INCLUDE_DIRS})
0070
0071 # Get the major and minor version numbers
0072 string(REGEX REPLACE "\\." ";" _SCIPY_VERSION_LIST ${SCIPY_VERSION})
0073 list(GET _SCIPY_VERSION_LIST 0 SCIPY_VERSION_MAJOR)
0074 list(GET _SCIPY_VERSION_LIST 1 SCIPY_VERSION_MINOR)
0075 list(GET _SCIPY_VERSION_LIST 2 SCIPY_VERSION_PATCH)
0076 math(EXPR SCIPY_VERSION_DECIMAL
0077 "(${SCIPY_VERSION_MAJOR} * 10000) + (${SCIPY_VERSION_MINOR} * 100) + ${SCIPY_VERSION_PATCH}")
0078
0079 find_package_message(SciPy
0080 "Found SciPy: version \"${SCIPY_VERSION}\" ${SCIPY_INCLUDE_DIRS}"
0081 "${SCIPY_INCLUDE_DIRS}${SCIPY_VERSION}")
0082 else()
0083 if(SCIPY_FIND_REQUIRED)
0084 message(FATAL_ERROR
0085 "SciPy import failure:\n${_SCIPY_ERROR_VALUE}")
0086 endif()
0087 set(SCIPY_FOUND FALSE)
0088 endif()
0089 else()
0090 set(SCIPY_FOUND FALSE)
0091 endif()