Skip to content

Commit

Permalink
Merge pull request igfuw#278 from pdziekan/correct_python_module_path
Browse files Browse the repository at this point in the history
correct python module path
  • Loading branch information
trontrytel authored Sep 26, 2017
2 parents 90072f5 + 7ffaba6 commit b515709
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
29 changes: 12 additions & 17 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,25 +50,20 @@ else()
endif()
endif()

# ... where to find libclouph++
target_link_libraries(cloudphxx cloudphxx_lgrngn)

# installation (see http://www.cmake.org/pipermail/cmake/2013-March/054138.html)
execute_process (
COMMAND ${PYTHON_EXECUTABLE} -c
"import site, sys; sys.stdout.write(site.PREFIXES[-1])"
OUTPUT_VARIABLE PYTHON_PREFIX
)
file ( TO_CMAKE_PATH "${PYTHON_PREFIX}" PYTHON_PREFIX )
execute_process (
COMMAND ${PYTHON_EXECUTABLE} -c
"import site, sys; sys.stdout.write(site.getsitepackages()[-1])"
OUTPUT_VARIABLE PYTHON_SITE_DIR
)
file ( TO_CMAKE_PATH "${PYTHON_SITE_DIR}" PYTHON_SITE_DIR )
string ( REGEX REPLACE "^${PYTHON_PREFIX}/" ""
PYTHON_SITE_DIR "${PYTHON_SITE_DIR}"
)
#to retain rpath to libcloudphxx_lgrngn.so linked by libcloudphxx.so after installation
set_property(TARGET cloudphxx PROPERTY INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set_property(TARGET cloudphxx PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)

# where to install python modules (see http://stackoverflow.com/questions/1242904/finding-python-site-packages-directory-with-cmake)
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c "if True:
import sysconfig as sc
print(sc.get_path('platlib'))"
OUTPUT_VARIABLE PYTHON_SITE_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)


install ( TARGETS cloudphxx
LIBRARY
Expand Down
6 changes: 5 additions & 1 deletion libcloudph++-config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ cmake_minimum_required(VERSION 2.8.8)
# the policies we care about:
# - CMP0025 - make CMake distinguis between Apple and LLVM clang
# - CMP0042 - make CMake use RPATHs on OSX
# - CMP0060 - make CMake always keep absoult RPATHs, even if installing in implicit directory
if(CMAKE_VERSION VERSION_GREATER 2.9)
cmake_policy(VERSION 3.0)
endif()

set(CMAKE_MACOSX_RPATH ON) # explicit, since policy CMP0042 didn't work...

############################################################################################
# the following variables will be set:
set(libcloudphxx_FOUND False)
Expand Down Expand Up @@ -47,7 +50,8 @@ endif()
# Boost libraries
find_package(Boost)
if(Boost_FOUND)
set(libcloudphxx_LIBRARIES "${libcloudphxx_LIBRARIES};${Boost_LIBRARIES}")
#TODO: if boost is not linked in some program, link boost libs to libcloudphxx_lgrngn.so ?
# set(libcloudphxx_LIBRARIES "${libcloudphxx_LIBRARIES};${Boost_LIBRARIES}")
set(libcloudphxx_INCLUDE_DIRS "${libcloudphxx_INCLUDE_DIRS};${Boost_INCLUDE_DIRS}")
else()
#TODO: check separately for optional and mandatory components
Expand Down

0 comments on commit b515709

Please sign in to comment.