Text archives Help
- From: bigler@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r364 - in swig: . SwigInterface
- Date: Fri, 3 Jun 2005 20:40:34 -0600 (MDT)
Author: bigler
Date: Fri Jun 3 20:40:33 2005
New Revision: 364
Added:
swig/SwigInterface/
swig/SwigInterface/CMakeLists.txt
swig/SwigInterface/example.cc
swig/SwigInterface/example.i
swig/SwigInterface/manta.i
Modified:
swig/CMakeLists.txt
Log:
Initial version of swig interface that allows you to create a RTRT engine and
camera. Doesn't do much outside of that yet.
Modified: swig/CMakeLists.txt
==============================================================================
--- swig/CMakeLists.txt (original)
+++ swig/CMakeLists.txt Fri Jun 3 20:40:33 2005
@@ -46,15 +46,26 @@
${CMAKE_SOURCE_DIR}/SCIRun
${CMAKE_SOURCE_DIR}/SCIRun/include)
-SUBDIRS( SCIRun/Core
- Core
- Interface
- Image
- Model
- UserInterface
- Engine
- StandAlone
- Readers
- scenes )
+SET(MAIN_SUBDIRS
+ SCIRun/Core
+ Core
+ Interface
+ Image
+ Model
+ UserInterface
+ Engine
+ StandAlone
+ Readers
+ scenes
+ )
+
+# Only process the swig directory if we have swig stuff
+FIND_PACKAGE(SWIG)
+IF (SWIG_FOUND)
+ SET(MAIN_SUBDIRS ${MAIN_SUBDIRS} SwigInterface)
+ENDIF (SWIG_FOUND)
+
+SUBDIRS( ${MAIN_SUBDIRS} )
+
Added: swig/SwigInterface/CMakeLists.txt
==============================================================================
--- (empty file)
+++ swig/SwigInterface/CMakeLists.txt Fri Jun 3 20:40:33 2005
@@ -0,0 +1,34 @@
+
+INCLUDE(${SWIG_USE_FILE})
+
+FIND_PACKAGE(PythonLibs)
+INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
+
+SET(CMAKE_SWIG_FLAGS "")
+
+SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(example.i PROPERTIES SWIG_FLAGS "-includeall")
+SWIG_ADD_MODULE(example python
+ example.i example.cc)
+SWIG_LINK_LIBRARIES(example ${PYTHON_LIBRARIES})
+
+SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES CPLUSPLUS ON)
+#SET_SOURCE_FILES_PROPERTIES(manta.i PROPERTIES SWIG_FLAGS "-includeall")
+
+SWIG_ADD_MODULE(manta python manta.i)
+
+SWIG_LINK_LIBRARIES(manta
+ ${PYTHON_LIBRARIES}
+ Manta_Engine
+ Manta_UserInterface
+ Manta_Model
+ Manta_Image
+ Manta_Interface
+ Manta_Core
+ SCIRun_Core
+ ${CMAKE_THREAD_LIBS_INIT}
+ ${OPENGL_LIBRARIES}
+ ${X11_LIBRARIES}
+ -lm)
Added: swig/SwigInterface/example.cc
==============================================================================
--- (empty file)
+++ swig/SwigInterface/example.cc Fri Jun 3 20:40:33 2005
@@ -0,0 +1,24 @@
+/* File : example.c */
+
+#include <time.h>
+
+double My_variable = 3.0;
+
+int fact(int n) {
+ if (n <= 1) return 1;
+ else return n*fact(n-1);
+}
+
+int my_mod(int x, int y) {
+ return (x%y);
+}
+
+char *get_time()
+{
+ time_t ltime;
+ time(<ime);
+ return ctime(<ime);
+}
+
+
+
Added: swig/SwigInterface/example.i
==============================================================================
--- (empty file)
+++ swig/SwigInterface/example.i Fri Jun 3 20:40:33 2005
@@ -0,0 +1,12 @@
+ /* example.i */
+ %module example
+ %{
+ /* Put header files here (optional) */
+ %}
+
+ extern double My_variable;
+ extern int fact(int n);
+ extern int my_mod(int x, int y);
+ extern char *get_time();
+
+
Added: swig/SwigInterface/manta.i
==============================================================================
--- (empty file)
+++ swig/SwigInterface/manta.i Fri Jun 3 20:40:33 2005
@@ -0,0 +1,32 @@
+/* manta.i */
+%module manta
+%include "std_string.i"
+%include "std_vector.i"
+%{
+#include <Interface/RTRTInterface.h>
+%}
+
+namespace std {
+ %template(vectorStr) vector<string>;
+};
+
+namespace Manta {
+ using namespace std;
+
+ class Camera;
+
+ class RTRTInterface {
+ public:
+ virtual void setScenePath(const string& path) = 0;
+ virtual void changeNumWorkers(int new_num_procs) = 0;
+ virtual Camera* createCamera(const string& spec) = 0;
+ };
+
+ class RTRTInterface: public RTRTInterface {
+ virtual void setScenePath(const string& path);
+ virtual void changeNumWorkers(int new_num_procs);
+ virtual Camera* createCamera(const string& spec);
+ };
+
+ RTRTInterface* createRTRT();
+}
- [MANTA] r364 - in swig: . SwigInterface, bigler, 06/03/2005
Archive powered by MHonArc 2.6.16.