From f64001a35df62dcabea2bf7b7bbc68b7b1d16296 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 22 May 2010 22:22:54 +0000 Subject: [PATCH] * ./vlsisapd: - Change: New cmake to find the python site packages directory. Install python modules in that library. --- vlsisapd/CMakeLists.txt | 3 +- vlsisapd/cmake_modules/CMakeLists.txt | 3 +- .../FindPythonSitePackages.cmake | 37 +++++++++++++++++++ vlsisapd/dtr/src/CMakeLists.txt | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 vlsisapd/cmake_modules/FindPythonSitePackages.cmake diff --git a/vlsisapd/CMakeLists.txt b/vlsisapd/CMakeLists.txt index 7d00322d..82ae0166 100644 --- a/vlsisapd/CMakeLists.txt +++ b/vlsisapd/CMakeLists.txt @@ -2,9 +2,10 @@ PROJECT(VLSISAPD) CMAKE_MINIMUM_REQUIRED(VERSION 2.4.0) -LIST(INSERT CMAKE_MODULE_PATH 0 "${VLSISAPD_SOURCE_DIR}/cmake/Modules/") +LIST(INSERT CMAKE_MODULE_PATH 0 "${VLSISAPD_SOURCE_DIR}/cmake_modules") FIND_PACKAGE(LibXml2 REQUIRED) +FIND_PACKAGE(PythonSitePackages REQUIRED) ADD_SUBDIRECTORY(agds) ADD_SUBDIRECTORY(cif) diff --git a/vlsisapd/cmake_modules/CMakeLists.txt b/vlsisapd/cmake_modules/CMakeLists.txt index 9a8e8cfb..bb06a2fd 100644 --- a/vlsisapd/cmake_modules/CMakeLists.txt +++ b/vlsisapd/cmake_modules/CMakeLists.txt @@ -1 +1,2 @@ -install(FILES FindVLSISAPD.cmake DESTINATION share/cmake/Modules) +install(FILES FindVLSISAPD.cmake + FindPythonSitePackages.cmake DESTINATION share/cmake/Modules) diff --git a/vlsisapd/cmake_modules/FindPythonSitePackages.cmake b/vlsisapd/cmake_modules/FindPythonSitePackages.cmake new file mode 100644 index 00000000..8b662bb0 --- /dev/null +++ b/vlsisapd/cmake_modules/FindPythonSitePackages.cmake @@ -0,0 +1,37 @@ + +if ( UNIX ) + + execute_process ( COMMAND python + -c +" +import os.path +import distutils.sysconfig + +pathes = distutils.sysconfig.get_python_lib().split('/') +print os.path.join ( pathes[-2], pathes[-1] ) +" + OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE + RESULT_VARIABLE RCODE) + if ( RCODE EQUAL 0 ) + set ( FindPythonSitePackages_FOUND TRUE ) + else ( RCODE EQUAL 0 ) + set ( FindPythonSitePackages_FOUND FALSE ) + endif ( RCODE EQUAL 0 ) + + set ( PYTHON_SITE_PACKAGES "lib${LIB_SUFFIX}/${PYTHON_SITE_PACKAGES}" + CACHE STRING "Python site packages directory." FORCE ) + mark_as_advanced ( PYTHON_SITE_PACKAGES ) + + if ( FindPythonSitePackages_FOUND ) + if ( NOT FindPythonSitePackages_FIND_QUIETLY ) + if ( FindPythonSitePackages_FOUND ) + message ( STATUS "Found FindPythonSitePackages : ${PYTHON_SITE_PACKAGES}" ) + endif ( FindPythonSitePackages_FOUND ) + endif ( NOT FindPythonSitePackages_FIND_QUIETLY ) + else ( FindPythonSitePackages_FOUND ) + #if ( FindPythonSitePackages_FIND_REQUIRED ) + message ( FATAL_ERROR "Python site packages directory was not found (pythonV.R/site-packages/)." ) + #endif ( FindPythonSitePackages_FIND_REQUIRED ) + endif ( FindPythonSitePackages_FOUND ) + +endif ( UNIX ) diff --git a/vlsisapd/dtr/src/CMakeLists.txt b/vlsisapd/dtr/src/CMakeLists.txt index 0b552f6d..1e886ab6 100644 --- a/vlsisapd/dtr/src/CMakeLists.txt +++ b/vlsisapd/dtr/src/CMakeLists.txt @@ -30,7 +30,7 @@ SET_TARGET_PROPERTIES(pyDTR PROPERTIES PREFIX "" ) TARGET_LINK_LIBRARIES(pyDTR dtr ${LIBXML2_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}) -INSTALL(TARGETS pyDTR DESTINATION lib${LIB_SUFFIX}/python) +INSTALL(TARGETS pyDTR DESTINATION ${PYTHON_SITE_PACKAGES}) ENDIF(Boost_FOUND) INSTALL(FILES ${hpps} DESTINATION include/vlsisapd/dtr)