diff options
author | David Robillard <d@drobilla.net> | 2008-02-17 03:44:47 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-02-17 03:44:47 +0000 |
commit | af851c8032f8dd4e65edf9664700c2c8b35906a3 (patch) | |
tree | f30f33b8c76315f70cd73c8d8a6e2fee6609d094 /swig | |
parent | 8528011e19f061258f1723645d7202305b529f0e (diff) | |
download | lilv-af851c8032f8dd4e65edf9664700c2c8b35906a3.tar.gz lilv-af851c8032f8dd4e65edf9664700c2c8b35906a3.tar.bz2 lilv-af851c8032f8dd4e65edf9664700c2c8b35906a3.zip |
Check for Python properly before attempting to build bindings.
Preliminary scheme (chicken/mzscheme) bindings (not working).
git-svn-id: http://svn.drobilla.net/lad/slv2@1146 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'swig')
-rw-r--r-- | swig/Makefile.am | 29 | ||||
-rw-r--r-- | swig/slv2.i | 54 | ||||
-rw-r--r-- | swig/slv2.setup | 2 |
3 files changed, 55 insertions, 30 deletions
diff --git a/swig/Makefile.am b/swig/Makefile.am index b6c5564..9ac6d84 100644 --- a/swig/Makefile.am +++ b/swig/Makefile.am @@ -1,15 +1,36 @@ -EXTRA_DIST = slv2.i lv2_list.py +EXTRA_DIST = slv2.i lv2_list.py slv2.setup if WITH_SWIG +all: python mzscheme chicken + if WITH_PYTHON -all: - swig -Wall -python slv2.i +python: + swig -DPYTHON -Wall -python -I.. -o slv2_python.c -oh slv2_python.h slv2.i gcc -fPIC -shared $(PYTHON_CPPFLAGS) $(PYTHON_EXTRA_LDFLAGS) \ $(PYTHON_EXTRA_LIBS) $(PYTHON_EXTRA_LDFLAGS) \ - -I/usr/include/python2.4 slv2_wrap.c ../src/.libs/libslv2.so -o _slv2.so + slv2_python.c ../src/.libs/libslv2.so -o _slv2.so +else +python: + endif # WITH_PYTHON +if WITH_MZSCHEME +mzscheme: + swig -DMZSCHEME -Wall -mzscheme -I.. -o slv2_mzscheme.c -oh slv2_mzscheme.h slv2.i + gcc -fPIC -shared -Iplt \ + -I/usr/include/plt slv2_mzscheme.c ../src/.libs/libslv2.so -o libslv2_mzscheme.so +endif # WITH_MZSCHEME + +if WITH_CHICKEN +chicken: + rm -rf eggs + mkdir -p eggs + swig -DCHICKEN -Wall -chicken -proxy -nounit -I.. -o slv2_wrap.c -oh slv2_wrap.h slv2.i + tar -czf eggs/slv2.egg slv2.setup slv2.scm slv2_wrap.c + rm -f slv2.scm slv2_wrap.c +endif # WITH_CHICKEN + endif # WITH_SWIG clean-local: diff --git a/swig/slv2.i b/swig/slv2.i index 593411e..210da6e 100644 --- a/swig/slv2.i +++ b/swig/slv2.i @@ -1,37 +1,37 @@ %module slv2 %{ -#include "../slv2/plugin.h" -#include "../slv2/pluginclass.h" -#include "../slv2/pluginclasses.h" -#include "../slv2/plugininstance.h" -#include "../slv2/plugins.h" -#include "../slv2/port.h" -#include "../slv2/slv2.h" -#include "../slv2/types.h" -#include "../slv2/value.h" -#include "../slv2/values.h" -#include "../slv2/world.h" +#include "slv2/plugin.h" +#include "slv2/pluginclass.h" +#include "slv2/pluginclasses.h" +#include "slv2/plugininstance.h" +#include "slv2/plugins.h" +#include "slv2/port.h" +#include "slv2/slv2.h" +#include "slv2/types.h" +#include "slv2/value.h" +#include "slv2/values.h" +#include "slv2/world.h" typedef struct { SLV2World me; } World; typedef struct { SLV2World world; SLV2Plugins me; } Plugins; typedef struct { SLV2World world; SLV2Plugin me; } Plugin; %} -%include "../slv2/plugin.h" -%include "../slv2/pluginclass.h" -%include "../slv2/pluginclasses.h" -%include "../slv2/plugininstance.h" -%include "../slv2/plugins.h" -%include "../slv2/port.h" -%include "../slv2/slv2.h" -%include "../slv2/types.h" -%include "../slv2/value.h" -%include "../slv2/values.h" -%include "../slv2/world.h" +%include "slv2/plugin.h" +%include "slv2/pluginclass.h" +%include "slv2/pluginclasses.h" +%include "slv2/plugininstance.h" +%include "slv2/plugins.h" +%include "slv2/port.h" +%include "slv2/slv2.h" +%include "slv2/types.h" +%include "slv2/value.h" +%include "slv2/values.h" +%include "slv2/world.h" typedef struct { SLV2Plugin me; } Plugin; %extend Plugin { Plugin(SLV2Plugin p) { - Plugin* ret = malloc(sizeof(Plugin)); + Plugin* ret = (Plugin*)malloc(sizeof(Plugin)); ret->me = p; return ret; } @@ -55,7 +55,7 @@ typedef struct { SLV2Plugin me; } Plugin; typedef struct { SLV2World world; SLV2Plugins me; } Plugins; %extend Plugins { Plugins(SLV2World w, SLV2Plugins p) { - Plugins* ret = malloc(sizeof(Plugins)); + Plugins* ret = (Plugins*)malloc(sizeof(Plugins)); ret->world = w; ret->me = p; return ret; @@ -76,6 +76,7 @@ typedef struct { SLV2World world; SLV2Plugins me; } Plugins; return NULL; } +#ifdef PYTHON %pythoncode %{ def __iter__(self): class Iterator(object): @@ -92,12 +93,13 @@ typedef struct { SLV2World world; SLV2Plugins me; } Plugins; return Iterator(self) %} +#endif }; typedef struct { SLV2World me; } World; %extend World { World() { - World* ret = malloc(sizeof(World)); + World* ret = (World*)malloc(sizeof(World)); ret->me = slv2_world_new(); return ret; } @@ -109,7 +111,7 @@ typedef struct { SLV2World me; } World; void load_all() { slv2_world_load_all($self->me); } void load_bundle(const char* uri) { - SLV2Value bundle_uri = slv2_value_new_uri($self->me, (const unsigned char*)uri); + SLV2Value bundle_uri = slv2_value_new_uri($self->me, uri); slv2_world_load_bundle($self->me, bundle_uri); slv2_value_free(bundle_uri); } diff --git a/swig/slv2.setup b/swig/slv2.setup new file mode 100644 index 0000000..4a8fbb4 --- /dev/null +++ b/swig/slv2.setup @@ -0,0 +1,2 @@ +(run (csc -s -o slv2.so slv2.scm slv2_wrap.c)) +(install-extension 'slv2 '("slv2.so")) |