2020-08-13 21:32:56 +03:00
|
|
|
#
|
|
|
|
# CMakeLists.txt used to build example apps by the CMake build system
|
|
|
|
#
|
2023-10-16 23:11:33 +03:00
|
|
|
# Copyright 2020-2023 by Bill Spitzak and others.
|
2020-08-13 21:32:56 +03:00
|
|
|
#
|
|
|
|
# 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 (../CMake/fl_create_example.cmake)
|
2022-11-19 13:55:45 +03:00
|
|
|
include (../CMake/FLTK-Functions.cmake)
|
2020-08-13 21:32:56 +03:00
|
|
|
|
|
|
|
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin/examples)
|
|
|
|
file (MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
# create separate lists of all source (.cxx) files
|
|
|
|
# depending on the required FLTK and system libraries
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
# simple examples w/o extra libs
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
set (SIMPLE_SOURCES
|
|
|
|
browser-simple
|
2023-10-16 23:11:33 +03:00
|
|
|
callbacks
|
|
|
|
chart-simple
|
2020-08-13 21:32:56 +03:00
|
|
|
draggable-group
|
2023-10-16 23:11:33 +03:00
|
|
|
grid-simple
|
2020-08-13 21:32:56 +03:00
|
|
|
howto-add_fd-and-popen
|
|
|
|
howto-browser-with-icons
|
|
|
|
howto-drag-and-drop
|
|
|
|
howto-draw-an-x
|
2022-08-07 19:01:59 +03:00
|
|
|
howto-flex-simple
|
2020-08-13 21:32:56 +03:00
|
|
|
howto-menu-with-images
|
|
|
|
howto-parse-args
|
|
|
|
howto-remap-numpad-keyboard-keys
|
|
|
|
howto-text-over-image-button
|
|
|
|
menubar-add
|
|
|
|
nativefilechooser-simple
|
2023-10-16 23:11:33 +03:00
|
|
|
nativefilechooser-simple-app
|
2020-08-13 21:32:56 +03:00
|
|
|
progress-simple
|
|
|
|
shapedwindow
|
|
|
|
simple-terminal
|
|
|
|
table-as-container
|
|
|
|
table-simple
|
|
|
|
table-sort
|
|
|
|
table-spreadsheet
|
|
|
|
table-spreadsheet-with-keyboard-nav
|
|
|
|
table-with-keynav
|
|
|
|
table-with-right-column-stretch-fit
|
2023-12-16 11:07:33 +03:00
|
|
|
table-with-right-click-menu
|
2020-08-13 21:32:56 +03:00
|
|
|
tabs-simple
|
|
|
|
textdisplay-with-colors
|
|
|
|
texteditor-simple
|
|
|
|
texteditor-with-dynamic-colors
|
|
|
|
tree-as-container
|
|
|
|
tree-custom-draw-items
|
|
|
|
tree-custom-sort
|
|
|
|
tree-of-tables
|
|
|
|
tree-simple
|
|
|
|
wizard-simple
|
|
|
|
)
|
|
|
|
|
2021-03-18 17:52:33 +03:00
|
|
|
############################################################
|
|
|
|
# simple FLUID examples w/o extra libs
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
set (FLUID_SOURCES
|
|
|
|
fluid-callback
|
|
|
|
)
|
|
|
|
|
2020-08-13 21:32:56 +03:00
|
|
|
############################################################
|
|
|
|
# examples requiring fltk_images
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
set (IMAGE_SOURCES
|
2023-01-21 19:27:58 +03:00
|
|
|
animgifimage
|
|
|
|
animgifimage-play
|
|
|
|
animgifimage-resize
|
|
|
|
animgifimage-simple
|
2020-08-13 21:32:56 +03:00
|
|
|
howto-simple-svg
|
|
|
|
)
|
|
|
|
|
2022-01-17 02:42:23 +03:00
|
|
|
############################################################
|
|
|
|
# examples requiring cairo
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
set (CAIRO_SOURCES
|
|
|
|
cairo-draw-x
|
|
|
|
)
|
|
|
|
|
2020-08-13 21:32:56 +03:00
|
|
|
############################################################
|
|
|
|
# examples requiring OpenGL + libGLEW
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
set (OPENGL_SOURCES
|
|
|
|
OpenGL3-glut-test
|
|
|
|
OpenGL3test
|
|
|
|
)
|
|
|
|
|
|
|
|
############################################################
|
|
|
|
# create simple example programs
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
foreach (src ${SIMPLE_SOURCES})
|
|
|
|
CREATE_EXAMPLE (${src} ${src}.cxx fltk)
|
|
|
|
endforeach (src)
|
|
|
|
|
2021-03-18 17:52:33 +03:00
|
|
|
############################################################
|
|
|
|
# create FLUID example programs
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
foreach (src ${FLUID_SOURCES})
|
|
|
|
CREATE_EXAMPLE (${src} ${src}.fl fltk)
|
|
|
|
endforeach (src)
|
|
|
|
|
2020-08-13 21:32:56 +03:00
|
|
|
############################################################
|
|
|
|
# create example programs with fltk_images library
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
foreach (src ${IMAGE_SOURCES})
|
|
|
|
CREATE_EXAMPLE (${src} ${src}.cxx "fltk_images;fltk")
|
|
|
|
endforeach (src)
|
|
|
|
|
2022-01-17 02:42:23 +03:00
|
|
|
############################################################
|
|
|
|
# create example programs requiring cairo
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
if (FLTK_HAVE_CAIRO)
|
|
|
|
set (cairo_libs "fltk;cairo")
|
|
|
|
if (TARGET fltk_cairo)
|
|
|
|
set (cairo_libs fltk_cairo ${cairo_libs})
|
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
set(cairo_libs "fltk")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
foreach (src ${CAIRO_SOURCES})
|
|
|
|
CREATE_EXAMPLE (${src} ${src}.cxx "${cairo_libs}")
|
|
|
|
endforeach (src)
|
|
|
|
|
2020-08-13 21:32:56 +03:00
|
|
|
############################################################
|
|
|
|
# create example programs with OpenGL + libGLEW
|
|
|
|
############################################################
|
|
|
|
|
|
|
|
# Note: macOS does not need libGLEW
|
|
|
|
|
2022-01-23 03:33:47 +03:00
|
|
|
if (APPLE AND (NOT OPTION_APPLE_X11))
|
2020-08-13 21:32:56 +03:00
|
|
|
if (NOT LIB_GLEW)
|
|
|
|
set (LIB_GLEW TRUE)
|
|
|
|
endif ()
|
|
|
|
set (REQUIRED_LIBS fltk_gl fltk ${OPENGL_LIBRARIES})
|
|
|
|
else ()
|
2022-03-10 00:38:05 +03:00
|
|
|
set (REQUIRED_LIBS fltk_gl fltk ${LIB_GLEW} ${OPENGL_LIBRARIES})
|
2020-08-13 21:32:56 +03:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (OPENGL_FOUND AND LIB_GLEW)
|
|
|
|
foreach (src ${OPENGL_SOURCES})
|
|
|
|
CREATE_EXAMPLE (${src} ${src}.cxx "${REQUIRED_LIBS}")
|
|
|
|
endforeach (src)
|
|
|
|
else ()
|
|
|
|
message (STATUS
|
|
|
|
"OpenGL or libGLEW not present: OpenGL example programs will not be built.")
|
|
|
|
fl_debug_var (OPENGL_FOUND)
|
|
|
|
fl_debug_var (LIB_GLEW)
|
|
|
|
message ("")
|
|
|
|
endif (OPENGL_FOUND AND LIB_GLEW)
|
|
|
|
|
|
|
|
unset (REQUIRED_LIBS)
|