Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into issue-2295
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed May 2, 2019
2 parents 6eaef96 + d865c04 commit dd7bb22
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions cmake/python.cmake
Expand Up @@ -4,27 +4,51 @@

#
# Version 3.12 has shiny new FindPython2 and FindPython3 scripts
# Version 3.14 introduces direct support for NumPy.
# When we require newer cmake versions, ditch the older support.
#
if (NOT (CMAKE_VERSION VERSION_LESS "3.12.0"))
if (NOT (CMAKE_VERSION VERSION_LESS "3.14.0"))
find_package(Python3 COMPONENTS Interpreter Development NumPy)
if (NOT Python3_FOUND)
find_package(Python2 2.7 REQUIRED EXACT
COMPONENTS Interpreter Development NumPy)

# Since we've required 2.7, these should all be valid
set(PYTHON_LIBRARY ${Python2_LIBRARIES}
CACHE FILEPATH "Python library")
CACHE FILEPATH "Python library")
set(PYTHON_INCLUDE_DIR ${Python2_INCLUDE_DIRS}
CACHE PATH "Location of Python include files")
set(PYTHON_NUMPY_INCLUDE_DIR ${Python2_NumPy_INCLUDE_DIRS}
CACHE PATH "Location of NumPy include files.")
else()
set(PYTHON_LIBRARY ${Python3_LIBRARIES}
CACHE FILEPATH "Python library")
CACHE FILEPATH "Python library")
set(PYTHON_INCLUDE_DIR ${Python3_INCLUDE_DIRS}
CACHE PATH "Location of Python include files.")
CACHE PATH "Location of Python include files.")
set(PYTHON_NUMPY_INCLUDE_DIR ${Python3_NumPy_INCLUDE_DIRS}
CACHE PATH "Location of NumPy include files.")
CACHE PATH "Location of NumPy include files.")
endif()
set(PDAL_HAVE_PYTHON 1)
elseif (NOT (CMAKE_VERSION VERSION_LESS "3.12.0"))
find_package(Python3 COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
find_package(Python2 2.7 REQUIRED EXACT
COMPONENTS Interpreter Development)

# Since we've required 2.7, these should all be valid
set(PYTHON_LIBRARY ${Python2_LIBRARIES}
CACHE FILEPATH "Python library")
set(PYTHON_INCLUDE_DIR ${Python2_INCLUDE_DIRS}
CACHE PATH "Location of Python include files")
set(PYTHON_EXECUTABLE ${Python2_EXECUTABLE})
find_package(NumPy 1.5 REQUIRED)
else()
set(PYTHON_LIBRARY ${Python3_LIBRARIES}
CACHE FILEPATH "Python library")
set(PYTHON_INCLUDE_DIR ${Python3_INCLUDE_DIRS}
CACHE PATH "Location of Python include files.")
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
find_package(NumPy 1.5 REQUIRED)
endif()
set(PDAL_HAVE_PYTHON 1)
else()
Expand Down

0 comments on commit dd7bb22

Please sign in to comment.