summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-04-14 09:22:25 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-04-14 09:22:25 +0000
commitb6fbe2815e082eeb27109b71cb51d2173bc67ba4 (patch)
treed2a5ed731ac710bfbcd8aeeb74309f85192b6ec5
parent387a5af3ee1b664346eb9686f00c986e9f7a1e3e (diff)
parentcb7937f8000fb509486432f66f319e33a9d85400 (diff)
Fix cython find issue on Windows
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2350 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: b539887838ff48d211ee65f8fddaf53500eb84ea
-rw-r--r--src/cmake/modules/FindCython.cmake44
-rw-r--r--src/cmake/modules/GUDHI_third_party_libraries.txt19
-rw-r--r--src/cython/CMakeLists.txt6
3 files changed, 52 insertions, 17 deletions
diff --git a/src/cmake/modules/FindCython.cmake b/src/cmake/modules/FindCython.cmake
new file mode 100644
index 00000000..04aed1f8
--- /dev/null
+++ b/src/cmake/modules/FindCython.cmake
@@ -0,0 +1,44 @@
+# Find the Cython compiler.
+#
+# This code sets the following variables:
+#
+# CYTHON_EXECUTABLE
+#
+# See also UseCython.cmake
+
+#=============================================================================
+# Copyright 2011 Kitware, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#=============================================================================
+
+# Use the Cython executable that lives next to the Python executable
+# if it is a local installation.
+find_package( PythonInterp )
+if( PYTHONINTERP_FOUND )
+ get_filename_component( _python_path ${PYTHON_EXECUTABLE} PATH )
+ find_program( CYTHON_EXECUTABLE
+ NAMES cython cython.bat cython3
+ HINTS ${_python_path}
+ )
+else()
+ find_program( CYTHON_EXECUTABLE
+ NAMES cython cython.bat cython3
+ )
+endif()
+
+
+include( FindPackageHandleStandardArgs )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS( Cython REQUIRED_VARS CYTHON_EXECUTABLE )
+
+mark_as_advanced( CYTHON_EXECUTABLE )
diff --git a/src/cmake/modules/GUDHI_third_party_libraries.txt b/src/cmake/modules/GUDHI_third_party_libraries.txt
index 2ddc9f1f..5f84c602 100644
--- a/src/cmake/modules/GUDHI_third_party_libraries.txt
+++ b/src/cmake/modules/GUDHI_third_party_libraries.txt
@@ -121,33 +121,24 @@ endmacro( find_the_lib )
# Find the correct Python interpreter.
# Can be set with -DPYTHON_EXECUTABLE=/usr/bin/python3 or -DPython_ADDITIONAL_VERSIONS=3 for instance.
-if(PYTHON_EXECUTABLE)
- if(NOT EXISTS "${PYTHON_EXECUTABLE}")
- message(FATAL_ERROR "ERROR: ${PYTHON_EXECUTABLE} does not exist.")
- endif(NOT EXISTS "${PYTHON_EXECUTABLE}")
-endif(PYTHON_EXECUTABLE)
-find_package(PythonInterp)
+find_package(Cython)
if(NOT GUDHI_CYTHON_PATH)
message(FATAL_ERROR "ERROR: GUDHI_CYTHON_PATH is not valid.")
endif(NOT GUDHI_CYTHON_PATH)
-if(PYTHONINTERP_FOUND)
+if(PYTHONINTERP_FOUND AND CYTHON_FOUND)
+ # Unitary tests are available through py.test
+ find_program( PYTEST_PATH py.test )
# Default found version 2
if(PYTHON_VERSION_MAJOR EQUAL 2)
- FIND_PROGRAM(CYTHON_PATH cython)
- # Unitary tests are available through py.test
- find_program( PYTEST_PATH py.test )
# Documentation generation is available through sphinx
find_program( SPHINX_PATH sphinx-build )
elseif(PYTHON_VERSION_MAJOR EQUAL 3)
- FIND_PROGRAM(CYTHON_PATH cython3)
- # Unitary tests are available through py.test
- find_program( PYTEST_PATH py.test )
# Documentation generation is available through sphinx
set(SPHINX_PATH "${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/doc/python3-sphinx-build")
else()
message(FATAL_ERROR "ERROR: Try to compile the Cython interface. Python version ${PYTHON_VERSION_STRING} is not valid.")
endif(PYTHON_VERSION_MAJOR EQUAL 2)
-endif(PYTHONINTERP_FOUND)
+endif(PYTHONINTERP_FOUND AND CYTHON_FOUND)
diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt
index 51c208aa..96c2acb3 100644
--- a/src/cython/CMakeLists.txt
+++ b/src/cython/CMakeLists.txt
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 2.8)
project(Cython)
-if(CYTHON_PATH)
- message("${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_PATH} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}")
+if(CYTHON_FOUND)
+ message("++ ${PYTHON_EXECUTABLE} v.${PYTHON_VERSION_STRING} - Cython is ${CYTHON_EXECUTABLE} - py.test is ${PYTEST_PATH} - Sphinx is ${SPHINX_PATH}")
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ")
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ")
@@ -281,4 +281,4 @@ if(CYTHON_PATH)
COMMAND make.bat html doctest)
endif (UNIX)
endif(SPHINX_PATH)
-endif(CYTHON_PATH)
+endif(CYTHON_FOUND)