shiboken: fix python
Shiboken uses CMake and needs the same help as OpenCV and VTK in finding the Python Libraries and Headers. Add code to find them. Tested on Lion with clang and llvm from XCode-4.3.3 using System Python, Homebrew Framework and loose Python. Fixes Homebrew/homebrew#13563 Signed-off-by: Adam Vandenberg <flangy@gmail.com>master
parent
30a23c413c
commit
f08b6918ef
|
@ -15,10 +15,39 @@ class Shiboken < Formula
|
|||
mkdir 'macbuild' do
|
||||
args = std_cmake_args + %W[
|
||||
-DBUILD_TESTS=OFF
|
||||
..
|
||||
]
|
||||
|
||||
|
||||
python_prefix = `python-config --prefix`.strip
|
||||
# Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
|
||||
if File.exist? "#{python_prefix}/Python"
|
||||
# Python was compiled with --framework:
|
||||
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
|
||||
if !MacOS.clt_installed? and python_prefix.start_with? '/System/Library'
|
||||
# For Xcode-only systems, the headers of system's python are inside of Xcode
|
||||
args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'"
|
||||
else
|
||||
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
|
||||
end
|
||||
else
|
||||
python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0)
|
||||
python_lib = "#{python_prefix}/lib/libpython#{python_version}"
|
||||
if File.exists? "#{python_lib}.a"
|
||||
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
|
||||
else
|
||||
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
|
||||
end
|
||||
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'"
|
||||
end
|
||||
|
||||
|
||||
args << '..'
|
||||
system 'cmake', *args
|
||||
system "make install"
|
||||
end
|
||||
end
|
||||
|
||||
def which_python
|
||||
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue