summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2015-03-16 11:28:39 +0100
committerEric Laurent <elaurent@google.com>2015-04-24 13:39:11 -0700
commitd828b6a20d4996b2908ac085d8bda5599144be74 (patch)
tree9f75db5e6e47468bb148d17abfc1db91eaecf0eb
parent2ab333829c096fea3d062fac2f4c13e3aae6d1c5 (diff)
downloadexternal_parameter-framework-d828b6a20d4996b2908ac085d8bda5599144be74.zip
external_parameter-framework-d828b6a20d4996b2908ac085d8bda5599144be74.tar.gz
external_parameter-framework-d828b6a20d4996b2908ac085d8bda5599144be74.tar.bz2
python bindings: install modules to the dist-packages directory
Use python to get the OS's directory name for dist-packages. The python bindings (low-level shared library and python proxy class) are then installed to that path, prefixed by the cmake install prefix. Signed-off-by: David Wagner <david.wagner@intel.com>
-rw-r--r--bindings/python/CMakeLists.txt16
1 files changed, 14 insertions, 2 deletions
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 3fef435..907741d 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -49,7 +49,19 @@ swig_link_libraries(PyPfw parameter ${PYTHON_LIBRARIES})
# class/interface class and as such cannot be destroyed.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-variable -DSWIG_PYTHON_SILENT_MEMLEAK")
-install(TARGETS _PyPfw LIBRARY DESTINATION lib)
+
+# Find the python modules install path.
+# plat_specific is needed because we are installing a shared-library python
+# module and not only a pure python module.
+# prefix='' makes get_python_lib return a relative path.
+find_package(PythonInterp)
+execute_process(COMMAND
+ ${PYTHON_EXECUTABLE} -c
+ "from distutils import sysconfig;\\
+ print(sysconfig.get_python_lib(plat_specific=True, prefix=''))"
+ OUTPUT_VARIABLE PYTHON_MODULE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+install(TARGETS _PyPfw LIBRARY DESTINATION ${PYTHON_MODULE_PATH})
# install the generated Python file as well
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION lib)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/PyPfw.py DESTINATION ${PYTHON_MODULE_PATH})