This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/cmake/python.cmake

52 lines
2.2 KiB
CMake
Raw Normal View History

2017-07-03 21:18:01 +01:00
set (Python_ADDITIONAL_VERSIONS 3.7 3.6 ) #3.5 3.6 3.4 )
2016-12-10 07:02:46 +00:00
2017-05-14 11:36:09 +01:00
# PYTHONLIBS_FOUND - have the Python libs been found
# PYTHON_LIBRARIES - path to the python library
# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
2017-05-14 11:36:09 +01:00
##
#
# ensure the script is in your cmake module path
if (WIN32)
2017-06-13 13:34:17 +01:00
set (PYTHONLIBS_FOUND YES CACHE BOOL "MINGW/MSYS2" FORCE )
2017-11-11 22:48:09 +00:00
set (PYTHON_LIBRARY C:/msys64/mingw64/lib/libpython3.6m.dll.a CACHE FILEPATH "MINGW/MSYS2" FORCE )
2017-06-13 13:34:17 +01:00
set (PYTHON_LIBRARIES C:/msys64/mingw64/lib/libpython3.5m.dll.a CACHE FILEPATH "MINGW/MSYS2" FORCE )
set (PYTHON_INCLUDE_PATH C:/msys64/mingw64/include/python3.5m CACHE PATH "MINGW/MSYS2" FORCE )
set (PYTHON_INCLUDE_DIRS C:/msys64/mingw64/include/python3.5m CACHE PATH "MINGW/MSYS2" FORCE )
set (PYTHON_EXECUTABLE C:/msys64/mingw64/bin/python3.exe CACHE FILEPATH "MINGW/MSYS2" FORCE )
set (PYTHONLIBS_VERSION_STRING 3.5 CACHE STRING "MINGW/MSYS2" FORCE )
2017-05-08 18:51:29 +01:00
elseif ($ENV{CONDA_BUILD}x STREQUAL "1x")
2017-06-13 13:34:17 +01:00
set (PYTHONLIBS_FOUND YES CACHE BOOL "MINGW/MSYS2" FORCE )
set( PYTHON_EXECUTABLE $ENV{PYTHON} CACHE FILEPATH "MINGW/MSYS2" FORCE )
set( PYTHON_LIBRARIES $ENV{PYTHON_LIBRARIES} CACHE FILEPATH "MINGW/MSYS2" FORCE )
set( PYTHON_INCLUDE_PATH $ENV{PYTHON_INCLUDE_DIRS} CACHE PATH "MINGW/MSYS2" FORCE )
set( PYTHON_INCLUDE_DIRS $ENV{PYTHON_INCLUDE_DIRS} CACHE PATH "MINGW/MSYS2" FORCE )
set (PYTHONLIBS_VERSION_STRING $ENV{PY_VER} CACHE STRING "MINGW/MSYS2" FORCE )
list (APPEND CMAKE_REQUIRED_INCLUDES
${PYTHON_INCLUDE_PATH})
else()
find_package(PythonInterp)
2018-02-21 13:17:35 +00:00
find_package(PythonLibs)
2018-02-21 13:17:35 +00:00
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; sysconfig.get_paths()['include']"
OUTPUT_VARIABLE PYTHON_INCLUDE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE)
list (APPEND CMAKE_REQUIRED_INCLUDES
${PYTHON_INCLUDE_PATH})
2017-11-11 22:48:09 +00:00
endif()
2017-05-08 18:51:29 +01:00
2016-10-16 23:18:51 +01:00
2017-05-08 18:51:29 +01:00
IF (PYTHONLIBS_FOUND)
add_subDIRECTORY (packages/python)
2018-02-21 13:17:35 +00:00
ENDIF()
2018-03-26 11:03:08 +01:00
IF (CMAKE_INSTALL_PREFIX MATCHES $ENV{HOME}.* )
set (PYTHON_USER_INSTALL --user)
ENDIF()