aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/FindPython.cmake
diff options
context:
space:
mode:
authorh.udo <hudokkow@gmail.com>2016-09-08 18:15:54 +0100
committerh.udo <hudokkow@gmail.com>2016-12-21 10:04:18 +0000
commita18701e7b2fe03780f90502d5d51e09cdc3ad718 (patch)
treea9d2c2cca8599a18a78c6b1345f42e48e76ddb27 /cmake/modules/FindPython.cmake
parentf2b31fda391d3364b7307ab9f9216fa0ee7164c7 (diff)
[cmake] Move to root folder: Move files
Diffstat (limited to 'cmake/modules/FindPython.cmake')
-rw-r--r--cmake/modules/FindPython.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/modules/FindPython.cmake b/cmake/modules/FindPython.cmake
new file mode 100644
index 0000000000..75dcd6cfbb
--- /dev/null
+++ b/cmake/modules/FindPython.cmake
@@ -0,0 +1,39 @@
+# - Try to find python
+# Once done this will define
+#
+# PYTHON_FOUND - system has PYTHON
+# PYTHON_INCLUDE_DIRS - the python include directory
+# PYTHON_LIBRARIES - The python libraries
+
+if(PKG_CONFIG_FOUND)
+ pkg_check_modules(PC_PYTHON python>=2.7 QUIET)
+endif()
+
+find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH)
+find_library(PYTHON_LIBRARY NAMES python2.7 PATHS ${PC_PYTHON_LIBDIR})
+find_path(PYTHON_INCLUDE_DIR NAMES Python.h PATHS ${PC_PYTHON_INCLUDE_DIRS} ${DEPENDS_PATH}/include/python2.7)
+
+if(KODI_DEPENDSBUILD)
+ find_library(FFI_LIBRARY ffi REQUIRED)
+ find_library(EXPAT_LIBRARY expat REQUIRED)
+ find_library(INTL_LIBRARY intl REQUIRED)
+ find_library(GMP_LIBRARY gmp REQUIRED)
+
+ if(NOT CORE_SYSTEM_NAME STREQUAL android)
+ set(PYTHON_DEP_LIBRARIES pthread dl util)
+ endif()
+
+ set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${GMP_LIBRARY} ${PYTHON_DEP_LIBRARIES})
+else()
+ find_package(PythonLibs 2.7 REQUIRED)
+ list(APPEND PYTHON_LIBRARIES ${PC_PYTHON_STATIC_LIBRARIES})
+endif()
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(PYTHON REQUIRED_VARS PYTHON_INCLUDE_DIR PYTHON_LIBRARY PYTHON_LIBRARIES)
+if(PYTHON_FOUND)
+ set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIR})
+endif()
+
+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)