mirror of
https://github.com/BlackLight/leap-sdk-python3.git
synced 2024-11-24 04:35:12 +01:00
Made installation more portable and robust against different name of the swig executable
This commit is contained in:
parent
97c784b3f7
commit
9c2194d1b0
2 changed files with 20 additions and 9 deletions
10
Makefile
10
Makefile
|
@ -1,18 +1,10 @@
|
||||||
PREFIX := $(if $(PREFIX),$(PREFIX),/usr)
|
PREFIX := $(if $(PREFIX),$(PREFIX),/usr)
|
||||||
PYTHON3_VERSION := $(shell python3 --version | cut -d' ' -f 2 | cut -d. -f 1,2)
|
PYTHON3_VERSION := $(shell python3 --version | cut -d' ' -f 2 | cut -d. -f 1,2)
|
||||||
ARCH := $(shell uname -m | sed -e 's/x86_64/x64/')
|
ARCH := $(shell uname -m | sed -e 's/x86_64/x64/')
|
||||||
|
|
||||||
SDK_PATH=./leap/LeapSDK
|
SDK_PATH=./leap/LeapSDK
|
||||||
|
|
||||||
all:
|
all:
|
||||||
[ -f ./LeapSDK.tar.gz ] || wget -O LeapSDK.tar.gz http://warehouse.leapmotion.com/apps/4185/download/
|
@./build.sh
|
||||||
mkdir -p leap
|
|
||||||
tar xvf LeapSDK.tar.gz -C leap --strip-components 1
|
|
||||||
cp -r $(SDK_PATH)/include ./include
|
|
||||||
wget http://tinyurl.com/leap-i-patch -O Leap.i.diff
|
|
||||||
patch -p0 < Leap.i.diff
|
|
||||||
swig-3 -c++ -python -o LeapPython.cpp -interface LeapPython ./include/Leap.i
|
|
||||||
g++ -fPIC -I/usr/include/python$(PYTHON3_VERSION)m -I/usr/include/python$(PYTHON3_VERSION) -I$(SDK_PATH)/include LeapPython.cpp $(SDK_PATH)/lib/$(ARCH)/libLeap.so -shared -o LeapPython.so
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf __pycache__
|
rm -rf __pycache__
|
||||||
|
|
19
build.sh
Executable file
19
build.sh
Executable file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
SDK_PATH=./leap/LeapSDK
|
||||||
|
ARCH=$(uname -m | sed -e 's/x86_64/x64/')
|
||||||
|
SWIG=swig
|
||||||
|
|
||||||
|
[ -f ./LeapSDK.tar.gz ] || wget -O LeapSDK.tar.gz http://warehouse.leapmotion.com/apps/4185/download/
|
||||||
|
mkdir -p leap
|
||||||
|
tar xvf LeapSDK.tar.gz -C leap --strip-components 1
|
||||||
|
cp -r ${SDK_PATH}/include ./include
|
||||||
|
wget http://tinyurl.com/leap-i-patch -O Leap.i.diff
|
||||||
|
patch -p0 < Leap.i.diff
|
||||||
|
[ ! -z "$(type -p "swig-3")" ] && SWIG=swig-3
|
||||||
|
[ ! -z "$(type -p "swig3.0")" ] && SWIG=swig3.0
|
||||||
|
|
||||||
|
${SWIG} -c++ -python -o LeapPython.cpp -interface LeapPython ./include/Leap.i
|
||||||
|
g++ -fPIC $(pkg-config --cflags --libs python3) -I${SDK_PATH}/include LeapPython.cpp ${SDK_PATH}/lib/${ARCH}/libLeap.so -shared -o LeapPython.so
|
||||||
|
|
Loading…
Reference in a new issue