mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 09:51:14 +03:00
JAVA: Remove library source compile from JAVA packages
Previously the JAVA packages re-compile UPM library source files. This was a work-around for compiling JAVA-specific functionality from the UPM source into the SWIG'ed JAVA pacakges. This commit removes the source from the JAVA SWIG compile and provides an example on how to add the JAVA-specific code with a swig extend call. * Added _upm.i file for %import (not %include) * Added macros to _upm.i; 1 which performs the loadLibrary, and one which adds the java installISR runnable. * Updated the src/CMakeLists.txt file to NOT build library src into pacakges. * Updated the a110x library with examples on how to use the macros. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -57,13 +57,6 @@ bool A110X::magnetDetected()
|
||||
return (!mraa_gpio_read(m_gpio) ? true : false);
|
||||
}
|
||||
|
||||
#ifdef JAVACALLBACK
|
||||
void A110X::installISR(jobject runnable)
|
||||
{
|
||||
installISR(mraa_java_isr_callback, runnable);
|
||||
}
|
||||
#endif
|
||||
|
||||
void A110X::installISR(void (*isr)(void *), void *arg)
|
||||
{
|
||||
if (m_isrInstalled)
|
||||
|
@ -85,11 +85,8 @@ namespace upm {
|
||||
* @param arg Pointer to an object to be supplied as an
|
||||
* argument to the ISR.
|
||||
*/
|
||||
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
|
||||
void installISR(jobject runnable);
|
||||
#else
|
||||
void installISR(void (*isr)(void *), void *arg);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Uninstalls the previously installed ISR
|
||||
*
|
||||
@ -97,9 +94,6 @@ namespace upm {
|
||||
void uninstallISR();
|
||||
|
||||
private:
|
||||
#if defined(SWIGJAVA) || defined(JAVACALLBACK)
|
||||
void installISR(void (*isr)(void *), void *arg);
|
||||
#endif
|
||||
|
||||
bool m_isrInstalled;
|
||||
mraa_gpio_context m_gpio;
|
||||
|
6
src/a110x/common.i
Normal file
6
src/a110x/common.i
Normal file
@ -0,0 +1,6 @@
|
||||
%include "../upm.i"
|
||||
|
||||
%{
|
||||
#include "a110x.hpp"
|
||||
%}
|
||||
%include "a110x.hpp"
|
@ -1,20 +1,11 @@
|
||||
%module javaupm_a110x
|
||||
%include "../upm.i"
|
||||
%include "stdint.i"
|
||||
%include "typemaps.i"
|
||||
|
||||
%{
|
||||
#include "a110x.hpp"
|
||||
%}
|
||||
%include "a110x.hpp"
|
||||
%include "common.i"
|
||||
|
||||
%pragma(java) jniclasscode=%{
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("javaupm_a110x");
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
System.err.println("Native code library failed to load. \n" + e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
%}
|
||||
/* Macro for loading javaupm_a110x */
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_a110x)
|
||||
|
||||
/* Macro adding an installisr call w/JAVA runnable to A110X */
|
||||
JAVA_ADD_INSTALLISR(upm::A110X)
|
||||
|
@ -1,8 +1,3 @@
|
||||
%module jsupm_a110x
|
||||
%include "../upm.i"
|
||||
|
||||
%{
|
||||
#include "a110x.hpp"
|
||||
%}
|
||||
|
||||
%include "a110x.hpp"
|
||||
%include "common.i"
|
||||
|
@ -1,9 +1,4 @@
|
||||
// Include doxygen-generated documentation
|
||||
%include "pyupm_doxy2swig.i"
|
||||
%module pyupm_a110x
|
||||
%include "../upm.i"
|
||||
|
||||
%include "a110x.hpp"
|
||||
%{
|
||||
#include "a110x.hpp"
|
||||
%}
|
||||
%include "common.i"
|
||||
|
Reference in New Issue
Block a user