Skip to content

Commit

Permalink
python: add FIND_SCIPY
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Jan 22, 2024
1 parent 24abb74 commit eeb6303
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion python.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2008-2021 LAAS-CNRS, JRL AIST-CNRS, INRIA.
# Copyright (C) 2008-2024 LAAS-CNRS, JRL AIST-CNRS, INRIA.
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -529,4 +529,30 @@ macro(FIND_NUMPY)
endif()
endmacro()

# .rst: .. command:: FIND_SCIPY()
#
# Detect scipy module.
#
macro(FIND_SCIPY)
# Detect numpy.
message(STATUS "Checking for SciPy")
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "-c" "import scipy; print (True)"
OUTPUT_VARIABLE IS_SCIPY
ERROR_QUIET)

if(NOT IS_SCIPY)
message(FATAL_ERROR "Failed to detect scipy")
else()
# Retrive SCIPY_VERSION
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "-c"
"import scipy; print (scipy.__version__)"
OUTPUT_VARIABLE SCIPY_VERSION
ERROR_QUIET)
string(REGEX REPLACE "\n$" "" SCIPY_VERSION "${SCIPY_VERSION}")
message(STATUS " SCIPY_VERSION=${SCIPY_VERSION}")
endif()
endmacro()

include(${CMAKE_CURRENT_LIST_DIR}/python-helpers.cmake)

0 comments on commit eeb6303

Please sign in to comment.