diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-09-08 23:26:39 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2012-09-08 23:26:39 (GMT) |
commit | aa6c3a1257a29cc5bcf8b94893732ee553f27582 (patch) | |
tree | 625adb1a353a17ffed2c7e0bac686d705aaec93f /src/bindings | |
download | uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.zip uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.gz uscxml-aa6c3a1257a29cc5bcf8b94893732ee553f27582.tar.bz2 |
Initial upload
Still somewhat quirky to build but fairly feature complete
Diffstat (limited to 'src/bindings')
-rw-r--r-- | src/bindings/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/bindings/swig/java/CMakeLists.txt | 31 | ||||
-rw-r--r-- | src/bindings/swig/java/uscxml.i | 40 |
3 files changed, 83 insertions, 0 deletions
diff --git a/src/bindings/CMakeLists.txt b/src/bindings/CMakeLists.txt new file mode 100644 index 0000000..deac396 --- /dev/null +++ b/src/bindings/CMakeLists.txt @@ -0,0 +1,12 @@ +find_package(SWIG) +if (SWIG_FOUND) + if(SWIG_VERSION VERSION_GREATER 2.0.4) + MARK_AS_ADVANCED(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION) + INCLUDE(${SWIG_USE_FILE}) + add_subdirectory(swig/java) + else() + message("SWIG version 2.0.5 is required, found ${SWIG_VERSION} - skipping java wrapper generation") + endif() +else() + message("SWIG not found - skipping wrapper generation") +endif() diff --git a/src/bindings/swig/java/CMakeLists.txt b/src/bindings/swig/java/CMakeLists.txt new file mode 100644 index 0000000..a729b8e --- /dev/null +++ b/src/bindings/swig/java/CMakeLists.txt @@ -0,0 +1,31 @@ +# generate JNI library and create a jar +# Make from within Eclipse fails miserably with the whole thing + +find_package(JNI) +if(JNI_FOUND) + include_directories(${JNI_INCLUDE_DIRS}) +else() + message(STATUS "No JNI libraries found - not building Java wrappers") + return() +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +SET(CMAKE_SWIG_FLAGS "") +SET(SCXMLPL_JAVA_PACKAGE "org.uscxml") +SET(SCXMLPL_JAVA_DIR "org/uscxml") + +# we need ; to produce a space with the package .. weird +SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES SWIG_FLAGS "-package;${SCXMLPL_JAVA_PACKAGE}") +SET_SOURCE_FILES_PROPERTIES(uscxml.i PROPERTIES CPLUSPLUS ON) +SET(CMAKE_SWIG_OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/${SCXMLPL_JAVA_DIR}") + +SWIG_ADD_MODULE(uscxmlNativeJava java uscxml.i) +foreach(JNI_LIBRARY ${JNI_LIBRARIES}) + if (NOT ${JNI_LIBRARY} MATCHES ".*jawt.*") + SWIG_LINK_LIBRARIES(uscxmlNativeJava ${JNI_LIBRARY}) + endif() +endforeach() +set_target_properties(uscxmlNativeJava PROPERTIES FOLDER "Bindings") + +swig_link_libraries(uscxmlNativeJava uscxml) diff --git a/src/bindings/swig/java/uscxml.i b/src/bindings/swig/java/uscxml.i new file mode 100644 index 0000000..ccd6fe0 --- /dev/null +++ b/src/bindings/swig/java/uscxml.i @@ -0,0 +1,40 @@ +%module(directors="1", allprotected="1") uscxmlNativeJava + +// import swig typemaps +//%include <arrays_java.i> +//%include <inttypes.i> +%include <boost_shared_ptr.i> + +// disable warning related to unknown base class +#pragma SWIG nowarn=401 +//%ignore boost::enable_shared_from_this; + +%javaconst(1); + +# %shared_ptr(uscxml::dom::Element); +# %shared_ptr(uscxml::dom::Executable); + + +//************************************************** +// This ends up in the generated wrapper code +//************************************************** + +%{ + +#include "../../../uscxml/Message.h" +#include "../../../uscxml/Interpreter.h" + +using namespace uscxml; + +%} + +%rename(toString) operator<<; + + +//*********************************************** +// Parse the header file to generate wrappers +//*********************************************** + +%include "../../../uscxml/Message.h" +%include "../../../uscxml/Interpreter.h" + |