summaryrefslogtreecommitdiff
path: root/bindings/Makefile
diff options
context:
space:
mode:
authorJohn Fultz <jfultz@wolfram.com>2016-07-03 03:07:52 -0500
committerGitHub <noreply@github.com>2016-07-03 03:07:52 -0500
commit50c4a8cd619d0da78a1a4012d2f688dea4c7ec27 (patch)
treea40498693dc3b56005c96c35c7c38aa816782662 /bindings/Makefile
parentda2f20720facda706be06b5813ab20057d5b4de9 (diff)
parent147b22ae1225863cac9f07b3906415713afdcf02 (diff)
Merge pull request #35 from gokceneraslan/master
Generate Python, Lua and Go bindings through SWIG
Diffstat (limited to 'bindings/Makefile')
-rw-r--r--bindings/Makefile56
1 files changed, 56 insertions, 0 deletions
diff --git a/bindings/Makefile b/bindings/Makefile
new file mode 100644
index 0000000..9cdb6a3
--- /dev/null
+++ b/bindings/Makefile
@@ -0,0 +1,56 @@
+CC=g++
+
+QTFLAGS := $(shell pkg-config QtCore --cflags)
+QTLIBS := $(shell pkg-config QtCore --libs)
+PYTHONFLAGS := $(shell pkg-config python2 --cflags)
+PHPFLAGS := $(shell php-config --includes)
+PHPLIBS := $(shell php-config --libs)
+LUAFLAGS := $(shell pkg-config lua5.1 --cflags)
+
+INCLUDES=-I..
+QUACKLELIBS=../lib/release/libquackle.a ../quackleio/lib/release/libquackleio.a
+
+php/quackle_wrap.cxx:
+ @test -d php || mkdir php
+ swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -php quackle.i
+
+php/quackle_wrap.o: php/quackle_wrap.cxx
+ $(CC) -std=c++11 -fPIC $(QTFLAGS) $(PHPFLAGS) $(PHPLIBS) $(INCLUDES) -c $< -o $@
+
+php: php/quackle_wrap.o
+ $(CC) -std=c++11 -shared -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o php/quackle.so
+
+python/quackle_wrap.cxx:
+ @test -d python || mkdir python
+ swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -python quackle.i
+
+python/quackle_wrap.o: python/quackle_wrap.cxx
+ $(CC) -std=c++11 -fPIC $(QTFLAGS) $(PYTHONFLAGS) $(INCLUDES) -c $< -o $@
+
+python: python/quackle_wrap.o
+ $(CC) -std=c++11 -shared -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o python/_quackle.so
+
+go:
+ ln -sf ../quackle.i go/quackle.swigcxx
+ go build ./go/...
+
+lua/quackle_wrap.cxx:
+ @test -d lua || mkdir lua
+ swig -c++ -o $@ $(INCLUDES) $(QTFLAGS) -lua quackle.i
+
+lua/quackle_wrap.o: lua/quackle_wrap.cxx
+ $(CC) -std=c++11 -fPIC $(LUAFLAGS) $(QTFLAGS) $(INCLUDES) -c $< -o $@
+
+lua: lua/quackle_wrap.o
+ $(CC) -std=c++11 -shared $(LUAFLAGS) -Wl,--whole-archive $(QUACKLELIBS) -Wl,--no-whole-archive $(QTLIBS) $< -o lua/quackle.so
+
+.PHONY: clean go
+
+clean:
+ -rm -rf python/quackle.py
+ -rm -rf php/*php*
+ -rm -rf */*_wrap.cxx
+ -rm -rf */*.o
+ -rm -rf */*.so
+ -rm -rf */*.pyc
+ -rm -rf go/quackle.swigcxx