diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-08-13 20:32:56 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-08-21 18:55:12 +0200 |
| commit | 3b9a04ae2eeed139717c8b368b2e99c495394706 (patch) | |
| tree | b56e10d8f498415379f7ae28739ef93f22eb9fb4 /test | |
| parent | d91160a9e06bd4ee341ca93509dbce9393d9168a (diff) | |
CMake: add examples folder to build (optional)
- replace misnamed option 'OPTION_BUILD_EXAMPLES' with 'FLTK_BUILD_TEST'
- add option 'FLTK_BUILD_EXAMPLES' to build apps in examples folder
- move examples/fltk-versions.cxx to test/fltk-versions.cxx
- [Travis-CI] enable option 'FLTK_BUILD_EXAMPLES' for automatic builds
Diffstat (limited to 'test')
| -rw-r--r-- | test/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | test/fltk-versions.cxx | 78 |
2 files changed, 80 insertions, 2 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index deb6a74cd..be95c25c3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -37,6 +37,7 @@ elseif (HAVE_ALSA_ASOUNDLIB_H) if (LIB_asound) set (AUDIOLIBS ${LIB_asound}) endif (LIB_asound) + mark_as_advanced (LIB_asound) endif (WIN32) ####################################################################### @@ -73,6 +74,7 @@ CREATE_EXAMPLE (doublebuffer doublebuffer.cxx fltk ANDROID_OK) CREATE_EXAMPLE (editor "editor.cxx;editor-Info.plist" fltk ANDROID_OK) CREATE_EXAMPLE (fast_slow fast_slow.fl fltk ANDROID_OK) CREATE_EXAMPLE (file_chooser file_chooser.cxx "fltk_images;fltk") +CREATE_EXAMPLE (fltk-versions fltk-versions.cxx fltk) CREATE_EXAMPLE (fonts fonts.cxx fltk) CREATE_EXAMPLE (forms forms.cxx "fltk_forms;fltk") CREATE_EXAMPLE (hello hello.cxx fltk) @@ -127,8 +129,6 @@ CREATE_EXAMPLE (valuators valuators.fl fltk) CREATE_EXAMPLE (unittests unittests.cxx fltk) CREATE_EXAMPLE (windowfocus windowfocus.cxx fltk) -CREATE_EXAMPLE (fltk-versions ../examples/fltk-versions.cxx fltk) - # OpenGL demos... if (OPENGL_FOUND) CREATE_EXAMPLE (CubeView "CubeMain.cxx;CubeView.cxx;CubeViewUI.fl" "fltk_gl;fltk") diff --git a/test/fltk-versions.cxx b/test/fltk-versions.cxx new file mode 100644 index 000000000..ed80c7b1f --- /dev/null +++ b/test/fltk-versions.cxx @@ -0,0 +1,78 @@ +// +// Library version test program for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2017 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +#include <FL/Fl.H> +#include <FL/Fl_Window.H> +#include <FL/Fl_Box.H> +#include <FL/fl_ask.H> + +#include <stdio.h> + +static char version[8][80] = { "","","","","","","","" }; + +int main(int argc, char **argv) { + + int versions = 0; + + sprintf(version[versions++],"FL_VERSION = %6.4f",FL_VERSION); + sprintf(version[versions++],"Fl::version() = %6.4f %s",Fl::version(), + (FL_VERSION == Fl::version()) ? "" : "***"); + +#ifdef FL_API_VERSION + sprintf(version[versions++],"FL_API_VERSION = %6d",FL_API_VERSION); + sprintf(version[versions++],"Fl::api_version() = %6d %s",Fl::api_version(), + (FL_API_VERSION == Fl::api_version()) ? "" : "***"); +#endif + +#ifdef FL_ABI_VERSION + sprintf(version[versions++],"FL_ABI_VERSION = %6d",FL_ABI_VERSION); + sprintf(version[versions++],"Fl::abi_version() = %6d %s",Fl::abi_version(), + (FL_ABI_VERSION == Fl::abi_version()) ? "" : "***"); +#endif + + for (int i=0; i<versions; i++) { + printf("%s\n",version[i]); + } + fflush(stdout); + +#ifdef FL_ABI_VERSION + if (FL_ABI_VERSION != Fl::abi_version()) { + printf("*** FLTK ABI version mismatch: headers = %d, lib = %d ***\n", + FL_ABI_VERSION, Fl::abi_version()); + fflush(stdout); + fl_message("*** FLTK ABI version mismatch: headers = %d, lib = %d ***", + FL_ABI_VERSION, Fl::abi_version()); + // exit(1); + } +#endif + + Fl_Window *window = new Fl_Window(670,300); + + Fl_Box *box[8]; + for (int i=0; i<4; i++) { + box[2*i] = new Fl_Box( 10,40+40*i,320,30,version[2*i]); + box[2*i+1] = new Fl_Box(340,40+40*i,320,30,version[2*i+1]); + } + + for (int i=0; i<8; i++) { + box[i]->labelfont(FL_COURIER); + box[i]->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE); + } + + window->end(); + window->show(argc, argv); + return Fl::run(); +} |
