Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-05-19 08:56:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-05-19 09:44:19 +0300
commite698299e4f2aade0f526dbeb5ea9f7a3a5117527 (patch)
tree27f1e9154269b6e780928ec85cecf775c7b26cf0 /build_files
parentd5a85f87b0bab4476dc4e0e945444262fd5d3ff9 (diff)
CMake: install Python executable when its bundled
Diffstat (limited to 'build_files')
-rw-r--r--build_files/cmake/Modules/FindPythonLibsUnix.cmake35
1 files changed, 25 insertions, 10 deletions
diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
index 555ca4cf0a0..e4236fb4c24 100644
--- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake
+++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake
@@ -66,6 +66,14 @@ IF(DEFINED PYTHON_LIBPATH)
SET(_IS_LIB_PATH_DEF ON)
ENDIF()
+STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
+
+SET(_python_SEARCH_DIRS
+ ${PYTHON_ROOT_DIR}
+ "$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
+ "/opt/py${_PYTHON_VERSION_NO_DOTS}"
+ "/opt/lib/python-${PYTHON_VERSION}"
+)
# only search for the dirs if we havn't already
IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_LIB_PATH_DEF))
@@ -75,14 +83,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
"dm;dmu;du;d" # debug
)
- STRING(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
- SET(_python_SEARCH_DIRS
- ${PYTHON_ROOT_DIR}
- "$ENV{HOME}/py${_PYTHON_VERSION_NO_DOTS}"
- "/opt/py${_PYTHON_VERSION_NO_DOTS}"
- "/opt/lib/python-${PYTHON_VERSION}"
- )
FOREACH(_CURRENT_ABI_FLAGS ${_python_ABI_FLAGS})
#IF(CMAKE_BUILD_TYPE STREQUAL Debug)
@@ -147,6 +148,7 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
ENDIF()
IF(PYTHON_LIBRARY AND PYTHON_LIBPATH AND PYTHON_INCLUDE_DIR AND PYTHON_INCLUDE_CONFIG_DIR)
+ SET(_PYTHON_ABI_FLAGS "${_CURRENT_ABI_FLAGS}")
break()
ELSE()
# ensure we dont find values from 2 different ABI versions
@@ -169,7 +171,6 @@ IF((NOT _IS_INC_DEF) OR (NOT _IS_INC_CONF_DEF) OR (NOT _IS_LIB_DEF) OR (NOT _IS_
UNSET(_CURRENT_PATH)
UNSET(_python_ABI_FLAGS)
- UNSET(_python_SEARCH_DIRS)
ENDIF()
UNSET(_IS_INC_DEF)
@@ -201,14 +202,28 @@ IF(PYTHONLIBSUNIX_FOUND)
# XXX No more valid with debian-like py3.4 packages...
# GET_FILENAME_COMPONENT(PYTHON_LIBPATH ${PYTHON_LIBRARY} PATH)
- # not used
- # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "")
+ # not required for build, just used when bundling Python.
+ FIND_PROGRAM(
+ PYTHON_EXECUTABLE
+ NAMES
+ "python${PYTHON_VERSION}${_PYTHON_ABI_FLAGS}"
+ "python${PYTHON_VERSION}"
+ "python"
+ HINTS
+ ${_python_SEARCH_DIRS}
+ PATH_SUFFIXES bin
+ )
ENDIF()
+UNSET(_PYTHON_VERSION_NO_DOTS)
+UNSET(_PYTHON_ABI_FLAGS)
+UNSET(_python_SEARCH_DIRS)
+
MARK_AS_ADVANCED(
PYTHON_INCLUDE_DIR
PYTHON_INCLUDE_CONFIG_DIR
PYTHON_LIBRARY
PYTHON_LIBPATH
PYTHON_SITE_PACKAGES
+ PYTHON_EXECUTABLE
)