diff options
| author | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
| commit | f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (patch) | |
| tree | d8de60fc7e17edeb6f0921726c038ee54b281445 /cmake/modules/FindPython.cmake | |
| parent | ae08c8b7221bc965ac40d70e53fc8fcddb050c46 (diff) | |
| download | kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.gz kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.bz2 kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.zip | |
sync with upstream
Diffstat (limited to 'cmake/modules/FindPython.cmake')
| -rw-r--r-- | cmake/modules/FindPython.cmake | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/modules/FindPython.cmake b/cmake/modules/FindPython.cmake new file mode 100644 index 0000000..213b17c --- /dev/null +++ b/cmake/modules/FindPython.cmake | |||
| @@ -0,0 +1,39 @@ | |||
| 1 | # - Try to find python | ||
| 2 | # Once done this will define | ||
| 3 | # | ||
| 4 | # PYTHON_FOUND - system has PYTHON | ||
| 5 | # PYTHON_INCLUDE_DIRS - the python include directory | ||
| 6 | # PYTHON_LIBRARIES - The python libraries | ||
| 7 | |||
| 8 | if(PKG_CONFIG_FOUND) | ||
| 9 | pkg_check_modules(PC_PYTHON python>=2.7 QUIET) | ||
| 10 | endif() | ||
| 11 | |||
| 12 | find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH) | ||
| 13 | find_library(PYTHON_LIBRARY NAMES python2.7 PATHS ${PC_PYTHON_LIBDIR}) | ||
| 14 | find_path(PYTHON_INCLUDE_DIR NAMES Python.h PATHS ${PC_PYTHON_INCLUDE_DIRS} ${DEPENDS_PATH}/include/python2.7) | ||
| 15 | |||
| 16 | if(KODI_DEPENDSBUILD) | ||
| 17 | find_library(FFI_LIBRARY ffi REQUIRED) | ||
| 18 | find_library(EXPAT_LIBRARY expat REQUIRED) | ||
| 19 | find_library(INTL_LIBRARY intl REQUIRED) | ||
| 20 | find_library(GMP_LIBRARY gmp REQUIRED) | ||
| 21 | |||
| 22 | if(NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 23 | set(PYTHON_DEP_LIBRARIES pthread dl util) | ||
| 24 | endif() | ||
| 25 | |||
| 26 | set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${GMP_LIBRARY} ${PYTHON_DEP_LIBRARIES}) | ||
| 27 | else() | ||
| 28 | find_package(PythonLibs 2.7 REQUIRED) | ||
| 29 | list(APPEND PYTHON_LIBRARIES ${PC_PYTHON_STATIC_LIBRARIES}) | ||
| 30 | endif() | ||
| 31 | |||
| 32 | include(FindPackageHandleStandardArgs) | ||
| 33 | find_package_handle_standard_args(Python REQUIRED_VARS PYTHON_INCLUDE_DIR PYTHON_LIBRARY PYTHON_LIBRARIES) | ||
| 34 | if(PYTHON_FOUND) | ||
| 35 | set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR}) | ||
| 36 | list(APPEND PYTHON_DEFINITIONS -DHAS_PYTHON=1) | ||
| 37 | endif() | ||
| 38 | |||
| 39 | mark_as_advanced(PYTHON_EXECUTABLE PYTHON_INCLUDE_DIRS PYTHON_INCLUDE_DIR PYTHON_LIBRARY PYTHON_LIBRARIES PYTHON_LDFLAGS FFI_LIBRARY EXPAT_LIBRARY INTL_LIBRARY GMP_LIBRARY) | ||
