diff options
Diffstat (limited to 'Tests/Wrapping')
-rw-r--r-- | Tests/Wrapping/CMakeLists.txt | 108 | ||||
-rw-r--r-- | Tests/Wrapping/Wrap.c | 19 | ||||
-rw-r--r-- | Tests/Wrapping/dummy | 0 | ||||
-rw-r--r-- | Tests/Wrapping/fakefluid.cxx | 17 | ||||
-rw-r--r-- | Tests/Wrapping/fltk1.fl | 0 | ||||
-rw-r--r-- | Tests/Wrapping/fltk2.fl | 0 | ||||
-rw-r--r-- | Tests/Wrapping/foo.ui.in | 44 | ||||
-rw-r--r-- | Tests/Wrapping/hints | 0 | ||||
-rw-r--r-- | Tests/Wrapping/itkWrapperConfig.cxx | 0 | ||||
-rw-r--r-- | Tests/Wrapping/qtnoqtmain.cxx | 4 | ||||
-rw-r--r-- | Tests/Wrapping/qtwrapping.ui | 44 | ||||
-rw-r--r-- | Tests/Wrapping/qtwrappingmain.cxx | 27 | ||||
-rw-r--r-- | Tests/Wrapping/vtkExcluded.cxx | 0 | ||||
-rw-r--r-- | Tests/Wrapping/vtkExcluded.h | 2 | ||||
-rw-r--r-- | Tests/Wrapping/vtkIncluded.cxx | 0 | ||||
-rw-r--r-- | Tests/Wrapping/vtkIncluded.h | 2 | ||||
-rw-r--r-- | Tests/Wrapping/vtkTestMoc.h | 8 | ||||
-rw-r--r-- | Tests/Wrapping/wrapFLTK.cxx | 4 | ||||
-rw-r--r-- | Tests/Wrapping/wrapping.cxx | 4 |
19 files changed, 283 insertions, 0 deletions
diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt new file mode 100644 index 0000000..7d9a4c6 --- /dev/null +++ b/Tests/Wrapping/CMakeLists.txt @@ -0,0 +1,108 @@ +# +# 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 () + set (CXX_TEST_PATH .) +endif () + +# +# Add exe +# +add_executable (wrapping wrapping.cxx) + +add_executable (Wrap Wrap.c) +if(WIN32) + set(EXE_EXT ".exe") +endif() +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) + + 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 () + add_executable (qtwrapping qtnoqtmain.cxx) +endif () + +# +# 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. +# +add_executable(fakefluid fakefluid.cxx) +set (FLTK_WRAP_UI "On") +set (FLTK_FLUID_EXECUTABLE fakefluid) +fltk_wrap_ui (wraplibFLTK fltk1.fl) +add_library(wraplibFLTK ${wraplibFLTK_FLTK_UI_SRCS}) +add_dependencies(wraplibFLTK fakefluid) +add_dependencies(fakefluid Wrap) +fltk_wrap_ui (wrapFLTK fltk2.fl) +add_executable(wrapFLTK wrapFLTK.cxx ${wrapFLTK_FLTK_UI_SRCS}) +target_link_libraries(wrapFLTK wraplibFLTK) +add_dependencies(wrapFLTK fakefluid) + +# +# Mangled Mesa +# +configure_file( + ${Wrapping_SOURCE_DIR}/dummy + ${Wrapping_BINARY_DIR}/gl.h + COPYONLY) +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 0000000..e8fb8a5 --- /dev/null +++ b/Tests/Wrapping/Wrap.c @@ -0,0 +1,19 @@ +#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 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/dummy diff --git a/Tests/Wrapping/fakefluid.cxx b/Tests/Wrapping/fakefluid.cxx new file mode 100644 index 0000000..f5fb3fb --- /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, + "// Solaris needs non-empty content so ensure\n" + "// we have at least one symbol\n" + "int Solaris_requires_a_symbol_here = 0;\n"); + fclose(file); + } + } + return 0; +} diff --git a/Tests/Wrapping/fltk1.fl b/Tests/Wrapping/fltk1.fl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/fltk1.fl diff --git a/Tests/Wrapping/fltk2.fl b/Tests/Wrapping/fltk2.fl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/fltk2.fl diff --git a/Tests/Wrapping/foo.ui.in b/Tests/Wrapping/foo.ui.in new file mode 100644 index 0000000..4f57b5d --- /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 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/hints diff --git a/Tests/Wrapping/itkWrapperConfig.cxx b/Tests/Wrapping/itkWrapperConfig.cxx new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/itkWrapperConfig.cxx diff --git a/Tests/Wrapping/qtnoqtmain.cxx b/Tests/Wrapping/qtnoqtmain.cxx new file mode 100644 index 0000000..e94a125 --- /dev/null +++ b/Tests/Wrapping/qtnoqtmain.cxx @@ -0,0 +1,4 @@ +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 0000000..67dcb9f --- /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 0000000..d4951ee --- /dev/null +++ b/Tests/Wrapping/qtwrappingmain.cxx @@ -0,0 +1,27 @@ +#include "qtwrapping.h" +#include <qapplication.h> + +#ifndef _WIN32 +# include <stdio.h> +# include <stdlib.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 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/vtkExcluded.cxx diff --git a/Tests/Wrapping/vtkExcluded.h b/Tests/Wrapping/vtkExcluded.h new file mode 100644 index 0000000..835f61a --- /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 0000000..e69de29 --- /dev/null +++ b/Tests/Wrapping/vtkIncluded.cxx diff --git a/Tests/Wrapping/vtkIncluded.h b/Tests/Wrapping/vtkIncluded.h new file mode 100644 index 0000000..a1c4aba --- /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 0000000..f11a927 --- /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/wrapFLTK.cxx b/Tests/Wrapping/wrapFLTK.cxx new file mode 100644 index 0000000..8488f4e --- /dev/null +++ b/Tests/Wrapping/wrapFLTK.cxx @@ -0,0 +1,4 @@ +int main(void) +{ + return 0; +} diff --git a/Tests/Wrapping/wrapping.cxx b/Tests/Wrapping/wrapping.cxx new file mode 100644 index 0000000..f8b643a --- /dev/null +++ b/Tests/Wrapping/wrapping.cxx @@ -0,0 +1,4 @@ +int main() +{ + return 0; +} |