]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
SWIG wrapper for Events_Error:send() created.
authorsbh <sergey.belash@opencascade.com>
Wed, 24 Dec 2014 17:26:17 +0000 (20:26 +0300)
committersbh <sergey.belash@opencascade.com>
Wed, 24 Dec 2014 17:26:35 +0000 (20:26 +0300)
src/Events/CMakeLists.txt
src/Events/Events.i [new file with mode: 0644]

index 492f4374a6ade95f772222d4e2dce6cc3e471c49..2d7b6caf742ac445b9d3de5e0c9e785d6931cba8 100644 (file)
@@ -1,6 +1,9 @@
 ## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
 INCLUDE(Common)
+FIND_PACKAGE(SWIG REQUIRED)
+
+INCLUDE(${SWIG_USE_FILE})
 
 SET(PROJECT_HEADERS
     Events.h
@@ -24,6 +27,33 @@ SET(PROJECT_SOURCES
 ADD_DEFINITIONS(-DEVENTS_EXPORTS)
 ADD_LIBRARY(Events SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
 
+SET(CMAKE_SWIG_FLAGS -threads -Wall)
+
+SET_SOURCE_FILES_PROPERTIES(Events.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(Events.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+INCLUDE_DIRECTORIES(
+  ${CAS_INCLUDE_DIRS}
+)
+
 TARGET_LINK_LIBRARIES(Events ${PROJECT_LIBRARIES})
 
+SET(SWIG_SCRIPTS
+  ${CMAKE_CURRENT_BINARY_DIR}/EventsAPI.py
+)
+
+SET(SWIG_LINK_LIBRARIES
+  Events
+  ${PYTHON_LIBRARIES}
+)
+
+SWIG_ADD_MODULE(EventsAPI python Events.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(EventsAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+  SET_TARGET_PROPERTIES(_EventsAPI PROPERTIES DEBUG_OUTPUT_NAME _EventsAPI_d)
+ENDIF(WIN32)
+
 INSTALL(TARGETS Events DESTINATION bin)
+INSTALL(TARGETS _EventsAPI DESTINATION swig)
+INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION swig)
diff --git a/src/Events/Events.i b/src/Events/Events.i
new file mode 100644 (file)
index 0000000..005c057
--- /dev/null
@@ -0,0 +1,19 @@
+/* Events.i */
+%module EventsAPI
+%{
+  #include "Events.h"
+  #include "Events_Error.h"
+  #include "Events_Message.h"
+%}
+
+
+// to avoid error on this
+#define EVENTS_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_string.i"
+
+// all supported interfaces
+%include "Events_Message.h"
+%include "Events_Error.h"