You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2017/04/03 22:08:11 UTC

arrow git commit: ARROW-763: C++: Use to find libpythonX.X.dylib

Repository: arrow
Updated Branches:
  refs/heads/master f05b7c62c -> d0cd03d78


ARROW-763: C++: Use  to find libpythonX.X.dylib

Author: Uwe L. Korn <uw...@xhochy.com>

Closes #485 from xhochy/ARROW-763 and squashes the following commits:

d5a475f [Uwe L. Korn] ARROW-763: C++: Use  to find libpythonX.X.dylib


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/d0cd03d7
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/d0cd03d7
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/d0cd03d7

Branch: refs/heads/master
Commit: d0cd03d78547b12aaeb5e50d8c52ace60a973d4e
Parents: f05b7c6
Author: Uwe L. Korn <uw...@xhochy.com>
Authored: Mon Apr 3 18:08:06 2017 -0400
Committer: Wes McKinney <we...@twosigma.com>
Committed: Mon Apr 3 18:08:06 2017 -0400

----------------------------------------------------------------------
 cpp/cmake_modules/FindPythonLibsNew.cmake | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/d0cd03d7/cpp/cmake_modules/FindPythonLibsNew.cmake
----------------------------------------------------------------------
diff --git a/cpp/cmake_modules/FindPythonLibsNew.cmake b/cpp/cmake_modules/FindPythonLibsNew.cmake
index 3e248a9..dfe5661 100644
--- a/cpp/cmake_modules/FindPythonLibsNew.cmake
+++ b/cpp/cmake_modules/FindPythonLibsNew.cmake
@@ -148,10 +148,20 @@ if(CMAKE_HOST_WIN32)
         set(PYTHON_LIBRARY "${PYTHON_PREFIX}/libs/libpython${PYTHON_LIBRARY_SUFFIX}.a")
     endif()
 elseif(APPLE)
-  # In Python C extensions on OS X, the flag "-undefined dynamic_lookup" can
-  # avoid certain kinds of dynamic linking issues with portable binaries, so
-  # you should avoid targeting libpython at link time if at all possible
-  set(PYTHON_LIBRARY "${PYTHON_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib")
+  # In some cases libpythonX.X.dylib is not part of the PYTHON_PREFIX and we
+  # need to call `python-config --prefix` to determine the correct location.
+
+  find_program(PYTHON_CONFIG python-config
+      NO_CMAKE_SYSTEM_PATH)
+  if (PYTHON_CONFIG)
+    execute_process(
+        COMMAND "${PYTHON_CONFIG}" "--prefix"
+        OUTPUT_VARIABLE PYTHON_CONFIG_PREFIX
+        OUTPUT_STRIP_TRAILING_WHITESPACE)
+    set(PYTHON_LIBRARY "${PYTHON_CONFIG_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib")
+  else()
+    set(PYTHON_LIBRARY "${PYTHON_PREFIX}/lib/libpython${PYTHON_LIBRARY_SUFFIX}.dylib")
+  endif()
 else()
     if(${PYTHON_SIZEOF_VOID_P} MATCHES 8)
         set(_PYTHON_LIBS_SEARCH "${PYTHON_PREFIX}/lib64" "${PYTHON_PREFIX}/lib" "${PYTHON_LIBRARY_PATH}")