summaryrefslogtreecommitdiff
path: root/Tests/Wrapping
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/Wrapping')
-rw-r--r--Tests/Wrapping/CMakeLists.txt107
-rw-r--r--Tests/Wrapping/Wrap.c23
-rw-r--r--Tests/Wrapping/dummy0
-rw-r--r--Tests/Wrapping/fakefluid.cxx17
-rw-r--r--Tests/Wrapping/fltk1.fl0
-rw-r--r--Tests/Wrapping/foo.ui.in44
-rw-r--r--Tests/Wrapping/hints0
-rw-r--r--Tests/Wrapping/itkWrapperConfig.cxx0
-rw-r--r--Tests/Wrapping/qtnoqtmain.cxx5
-rw-r--r--Tests/Wrapping/qtwrapping.ui44
-rw-r--r--Tests/Wrapping/qtwrappingmain.cxx29
-rw-r--r--Tests/Wrapping/vtkExcluded.cxx0
-rw-r--r--Tests/Wrapping/vtkExcluded.h2
-rw-r--r--Tests/Wrapping/vtkIncluded.cxx0
-rw-r--r--Tests/Wrapping/vtkIncluded.h2
-rw-r--r--Tests/Wrapping/vtkTestMoc.h8
-rw-r--r--Tests/Wrapping/wrapping.cxx4
17 files changed, 285 insertions, 0 deletions
diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt
new file mode 100644
index 000000000..c84dedc47
--- /dev/null
+++ b/Tests/Wrapping/CMakeLists.txt
@@ -0,0 +1,107 @@
+#
+# Wrapping
+#
+cmake_minimum_required (VERSION 2.6)
+PROJECT (Wrapping)
+
+# Disable cleaning of custom command outputs to preserve the hacks
+# used to generate the files using CONFIGURE_FILE.
+SET_DIRECTORY_PROPERTIES(PROPERTIES CLEAN_NO_CUSTOM 1)
+
+#
+# Lib and exe path
+#
+SET (LIBRARY_OUTPUT_PATH
+ ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
+ "Single output directory for building all libraries.")
+
+SET (EXECUTABLE_OUTPUT_PATH
+ ${Wrapping_BINARY_DIR}/bin/ CACHE INTERNAL
+ "Single output directory for building all executables.")
+
+#
+# Where will executable tests be written ?
+#
+IF (EXECUTABLE_OUTPUT_PATH)
+ SET (CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
+ELSE (EXECUTABLE_OUTPUT_PATH)
+ SET (CXX_TEST_PATH .)
+ENDIF (EXECUTABLE_OUTPUT_PATH)
+
+#
+# Add exe
+#
+ADD_EXECUTABLE (wrapping wrapping.cxx)
+
+ADD_EXECUTABLE (Wrap Wrap.c)
+IF(WIN32)
+ SET(EXE_EXT ".exe")
+ENDIF(WIN32)
+SET(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT})
+
+#
+# QT Wrappers
+#
+
+SET (QT_WRAP_CPP "On")
+SET (QT_MOC_EXE "echo")
+INCLUDE( FindQt3 )
+
+IF (QT_FOUND AND QT_WRAP_UI)
+ message("found qt 3 test it...")
+ INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
+ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
+
+
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/foo.ui.in
+ ${CMAKE_CURRENT_BINARY_DIR}/foo.ui IMMEDIATE)
+
+ SET (QT_WRAP_UI "On")
+ SET (QT_UIC_EXE "${QT_UIC_EXECUTABLE}")
+
+
+ SET (QTUI_SRCS
+ qtwrapping.ui
+ ${CMAKE_CURRENT_BINARY_DIR}/foo.ui
+ )
+ QT_WRAP_UI (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS})
+ QT_WRAP_CPP (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h)
+
+ MESSAGE("QT files are ${QTUI_S_SRCS}")
+ MESSAGE("QT other files are ${QTUI_H_SRCS}")
+ ADD_DEFINITIONS(${QT_DEFINITIONS})
+ ADD_LIBRARY(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS})
+ ADD_EXECUTABLE (qtwrapping qtwrappingmain.cxx)
+ TARGET_LINK_LIBRARIES(qtwrapping myqtlib)
+
+ TARGET_LINK_LIBRARIES( qtwrapping ${QT_LIBRARIES} )
+ELSE (QT_FOUND AND QT_WRAP_UI)
+ ADD_EXECUTABLE (qtwrapping qtnoqtmain.cxx)
+ENDIF (QT_FOUND AND QT_WRAP_UI)
+
+#
+# FLTK Wrappers
+#
+# Since FLTK_FLUID_EXE is supposed to create a .cxx/.h from a .fl/.fld,
+# create an empty one so that the dependencies can be met.
+#
+SET (FLTK_SRCS
+ fltk1.fl
+ )
+ADD_EXECUTABLE(fakefluid fakefluid.cxx)
+GET_TARGET_PROPERTY(FLUID_LOC fakefluid LOCATION)
+SET (FLTK_WRAP_UI "On")
+SET (FLTK_FLUID_EXECUTABLE "${FLUID_LOC}")
+FLTK_WRAP_UI (wraplibFLTK ${FLTK_SRCS})
+ADD_LIBRARY(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS})
+ADD_DEPENDENCIES(wraplibFLTK fakefluid)
+ADD_DEPENDENCIES(fakefluid Wrap)
+#
+# Mangled Mesa
+#
+CONFIGURE_FILE(
+ ${Wrapping_SOURCE_DIR}/dummy
+ ${Wrapping_BINARY_DIR}/gl.h
+ COPYONLY IMMEDIATE)
+USE_MANGLED_MESA (${Wrapping_BINARY_DIR} ${Wrapping_BINARY_DIR}/mangled_mesa)
+
diff --git a/Tests/Wrapping/Wrap.c b/Tests/Wrapping/Wrap.c
new file mode 100644
index 000000000..0a1ff501e
--- /dev/null
+++ b/Tests/Wrapping/Wrap.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#ifdef __CLASSIC_C__
+int main(argc, argv)
+ int argc;
+ char ** argv;
+#else
+int main(int argc, const char* argv[])
+#endif
+{
+ FILE* fout = fopen(argv[argc-1], "w");
+ printf("Wrap creating \"%s\"\n", argv[argc-1]);
+ if(fout)
+ {
+ fprintf(fout, "int foo() { return 0; }\n");
+ fclose(fout);
+ }
+ else
+ {
+ return -1;
+ }
+ return 0;
+}
diff --git a/Tests/Wrapping/dummy b/Tests/Wrapping/dummy
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/Wrapping/dummy
diff --git a/Tests/Wrapping/fakefluid.cxx b/Tests/Wrapping/fakefluid.cxx
new file mode 100644
index 000000000..af4467997
--- /dev/null
+++ b/Tests/Wrapping/fakefluid.cxx
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <string.h>
+int main(int ac, char** av)
+{
+ for(int i =0; i < ac; ++i)
+ {
+ if(strcmp(av[i], "-o") == 0 ||
+ strcmp(av[i], "-h") == 0)
+ {
+ fprintf(stdout, "fakefluid is creating file \"%s\"\n", av[i+1]);
+ FILE* file = fopen(av[i+1], "w");
+ fprintf(file, "// hello\n");
+ fclose(file);
+ }
+ }
+ return 0;
+}
diff --git a/Tests/Wrapping/fltk1.fl b/Tests/Wrapping/fltk1.fl
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/Wrapping/fltk1.fl
diff --git a/Tests/Wrapping/foo.ui.in b/Tests/Wrapping/foo.ui.in
new file mode 100644
index 000000000..4f57b5db1
--- /dev/null
+++ b/Tests/Wrapping/foo.ui.in
@@ -0,0 +1,44 @@
+<!DOCTYPE UI><UI>
+<class>foo</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>qtwrapping</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>229</width>
+ <height>38</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>QTWrapUI Test program</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>This is a test for QTWrapUI.</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+</UI>
diff --git a/Tests/Wrapping/hints b/Tests/Wrapping/hints
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/Wrapping/hints
diff --git a/Tests/Wrapping/itkWrapperConfig.cxx b/Tests/Wrapping/itkWrapperConfig.cxx
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/Wrapping/itkWrapperConfig.cxx
diff --git a/Tests/Wrapping/qtnoqtmain.cxx b/Tests/Wrapping/qtnoqtmain.cxx
new file mode 100644
index 000000000..8b7334a18
--- /dev/null
+++ b/Tests/Wrapping/qtnoqtmain.cxx
@@ -0,0 +1,5 @@
+int main(int ac, char** av)
+{
+ return 0;
+}
+
diff --git a/Tests/Wrapping/qtwrapping.ui b/Tests/Wrapping/qtwrapping.ui
new file mode 100644
index 000000000..67dcb9fbc
--- /dev/null
+++ b/Tests/Wrapping/qtwrapping.ui
@@ -0,0 +1,44 @@
+<!DOCTYPE UI><UI>
+<class>qtwrapping</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>qtwrapping</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>229</width>
+ <height>38</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>QTWrapUI Test program</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>This is a test for QTWrapUI.</string>
+ </property>
+ </widget>
+ </vbox>
+</widget>
+</UI>
diff --git a/Tests/Wrapping/qtwrappingmain.cxx b/Tests/Wrapping/qtwrappingmain.cxx
new file mode 100644
index 000000000..fabecfc72
--- /dev/null
+++ b/Tests/Wrapping/qtwrappingmain.cxx
@@ -0,0 +1,29 @@
+#include <qapplication.h>
+#include "qtwrapping.h"
+
+#ifndef _WIN32
+# include <stdlib.h>
+# include <stdio.h>
+#endif
+
+int main(int argc, char *argv[])
+{
+#ifndef _WIN32
+ const char* display = getenv("DISPLAY");
+ if ( display && strlen(display)>0 )
+ {
+#endif
+ QApplication app(argc,argv);
+
+ qtwrapping qtw;
+ app.setMainWidget(&qtw);
+#ifndef _WIN32
+ }
+ else
+ {
+ printf("Environment variable DISPLAY is not set. I will pretend like the test passed, but you should really set it.\n");
+ }
+#endif
+
+ return 0;
+}
diff --git a/Tests/Wrapping/vtkExcluded.cxx b/Tests/Wrapping/vtkExcluded.cxx
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/Wrapping/vtkExcluded.cxx
diff --git a/Tests/Wrapping/vtkExcluded.h b/Tests/Wrapping/vtkExcluded.h
new file mode 100644
index 000000000..835f61a3e
--- /dev/null
+++ b/Tests/Wrapping/vtkExcluded.h
@@ -0,0 +1,2 @@
+// A comment
+// Another comment
diff --git a/Tests/Wrapping/vtkIncluded.cxx b/Tests/Wrapping/vtkIncluded.cxx
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Tests/Wrapping/vtkIncluded.cxx
diff --git a/Tests/Wrapping/vtkIncluded.h b/Tests/Wrapping/vtkIncluded.h
new file mode 100644
index 000000000..a1c4aba26
--- /dev/null
+++ b/Tests/Wrapping/vtkIncluded.h
@@ -0,0 +1,2 @@
+// A comment
+// Another comment (force coverage)
diff --git a/Tests/Wrapping/vtkTestMoc.h b/Tests/Wrapping/vtkTestMoc.h
new file mode 100644
index 000000000..f11a927f0
--- /dev/null
+++ b/Tests/Wrapping/vtkTestMoc.h
@@ -0,0 +1,8 @@
+#include <qapplication.h>
+
+class Foo : public QApplication
+{
+ Q_OBJECT
+public:
+ Foo();
+};
diff --git a/Tests/Wrapping/wrapping.cxx b/Tests/Wrapping/wrapping.cxx
new file mode 100644
index 000000000..1482f27e5
--- /dev/null
+++ b/Tests/Wrapping/wrapping.cxx
@@ -0,0 +1,4 @@
+int main ()
+{
+ return 0;
+}