swig: add swig support for hmc5883l sensor
authorBrendan Le Foll <brendan.le.foll@intel.com>
Fri, 25 Apr 2014 14:33:26 +0000 (15:33 +0100)
committerBrendan Le Foll <brendan.le.foll@intel.com>
Fri, 25 Apr 2014 14:33:26 +0000 (15:33 +0100)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/hmc5883l/CMakeLists.txt
src/hmc5883l/jsupm_hmc5883l.i [new file with mode: 0644]
src/hmc5883l/pyupm_hmc5883l.i [new file with mode: 0644]

index 5baf427..398bb67 100644 (file)
@@ -3,3 +3,20 @@ add_library (hmc5883l SHARED hmc5883l.cxx)
 include_directories (${MAA_INCLUDE_DIR})
 
 target_link_libraries (hmc5883l ${MAA_LIBRARIES})
+
+find_package (PythonLibs)
+
+include_directories (
+  ${PYTHON_INCLUDE_PATH}
+  ${PYTHON_INCLUDE_DIRS}
+  ${MAA_INCLUDE_DIR}
+  .
+)
+
+set_source_files_properties (pyupm_hmc5883l.i PROPERTIES CPLUSPLUS ON)
+set_source_files_properties (jsupm_hmc5883l.i PROPERTIES CPLUSPLUS ON)
+
+swig_add_module (pyupm_hmc5883l python pyupm_hmc5883l.i hmc5883l.cxx)
+swig_add_module (jsupm_hmc5883l python jsupm_hmc5883l.i hmc5883l.cxx)
+swig_link_libraries (pyupm_hmc5883l ${PYTHON_LIBRARIES} ${MAA_LIBRARIES})
+swig_link_libraries (jsupm_hmc5883l ${PYTHON_LIBRARIES} ${MAA_LIBRARIES})
diff --git a/src/hmc5883l/jsupm_hmc5883l.i b/src/hmc5883l/jsupm_hmc5883l.i
new file mode 100644 (file)
index 0000000..25662d0
--- /dev/null
@@ -0,0 +1,7 @@
+%module jsupm_hmc5883l
+
+%{
+    #include "hmc5883l.h"
+%}
+
+%include "hmc5883l.h"
diff --git a/src/hmc5883l/pyupm_hmc5883l.i b/src/hmc5883l/pyupm_hmc5883l.i
new file mode 100644 (file)
index 0000000..ad55d2f
--- /dev/null
@@ -0,0 +1,7 @@
+%module pyupm_hmc5883l
+
+%{
+    #include "hmc5883l.h"
+%}
+
+%include "hmc5883l.h"