Make the 'Forms' compatibility library 'fltk_forms' optional

This library is no longer needed in FLTK itself. There is only one
demo program (test/forms.cxx) that uses it if it is built. The demo
program displays a message if fltk_forms is not available.

The default is 'enabled' for backwards compatibility but this may
be changed to 'disabled' in a future version.
This commit is contained in:
Albrecht Schlosser 2023-12-20 16:56:29 +01:00
parent 9023648e6c
commit 5df5daf78e
11 changed files with 152 additions and 59 deletions

View File

@ -396,13 +396,21 @@ option (OPTION_BUILD_SHARED_LIBS
) )
####################################################################### #######################################################################
option (OPTION_PRINT_SUPPORT "allow print support" ON)
option (OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
option (FLTK_BUILD_FLUID "Build FLUID" ON) option (OPTION_PRINT_SUPPORT "allow print support" ON)
option (FLTK_BUILD_FLTK_OPTIONS "Build fltk-options" ON) option (OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF) option (FLTK_BUILD_FORMS "Build forms compatibility library" ON)
option (FLTK_BUILD_FLUID "Build FLUID" ON)
option (FLTK_BUILD_FLTK_OPTIONS "Build fltk-options" ON)
option (FLTK_BUILD_TEST "Build test/demo programs" ON)
option (FLTK_BUILD_EXAMPLES "Build example programs" OFF)
if (FLTK_BUILD_FORMS)
set (FLTK_HAVE_FORMS 1)
else ()
set (FLTK_HAVE_FORMS 0)
endif ()
if (DEFINED OPTION_BUILD_EXAMPLES) if (DEFINED OPTION_BUILD_EXAMPLES)
message (WARNING message (WARNING

View File

@ -219,34 +219,40 @@ message ("")
set (_descr "${PROJECT_NAME} ${FLTK_VERSION} generated by CMake ${CMAKE_VERSION}") set (_descr "${PROJECT_NAME} ${FLTK_VERSION} generated by CMake ${CMAKE_VERSION}")
feature_summary (WHAT ALL DESCRIPTION "Configuration Summary for ${_descr} --\n") feature_summary (WHAT ALL DESCRIPTION "Configuration Summary for ${_descr} --\n")
message (STATUS "Static libraries will be built in ${CMAKE_CURRENT_BINARY_DIR}/lib") message (STATUS "Static libraries will be built in ${CMAKE_CURRENT_BINARY_DIR}/lib")
if (OPTION_BUILD_SHARED_LIBS) if (OPTION_BUILD_SHARED_LIBS)
message (STATUS "Shared libraries will be built in ${CMAKE_CURRENT_BINARY_DIR}/lib") message (STATUS "Shared libraries will be built in ${CMAKE_CURRENT_BINARY_DIR}/lib")
else () else ()
message (STATUS "Shared libraries will not be built (set OPTION_BUILD_SHARED_LIBS=ON to build)") message (STATUS "Shared libraries will not be built (set OPTION_BUILD_SHARED_LIBS=ON to build)")
endif ()
if (FLTK_BUILD_FORMS)
message (STATUS "The forms library will be built in ${CMAKE_CURRENT_BINARY_DIR}/lib")
else ()
message (STATUS "The forms library will not be built (set FLTK_BUILD_FORMS=ON to build)")
endif () endif ()
if (FLTK_BUILD_FLUID) if (FLTK_BUILD_FLUID)
message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid") message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid")
else () else ()
message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)") message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)")
endif () endif ()
if (FLTK_BUILD_FLTK_OPTIONS) if (FLTK_BUILD_FLTK_OPTIONS)
message (STATUS "fltk-options will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-options") message (STATUS "fltk-options will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-options")
else () else ()
message (STATUS "fltk-options will not be built (set FLTK_BUILD_FLTK_OPTIONS=ON to build)") message (STATUS "fltk-options will not be built (set FLTK_BUILD_FLTK_OPTIONS=ON to build)")
endif () endif ()
if (FLTK_BUILD_TEST) if (FLTK_BUILD_TEST)
message (STATUS "Test programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/test") message (STATUS "Test programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/test")
endif () endif ()
if (FLTK_BUILD_EXAMPLES) if (FLTK_BUILD_EXAMPLES)
message (STATUS "Example programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/examples") message (STATUS "Example programs will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/examples")
else () else ()
message (STATUS "Example programs will not be built (set FLTK_BUILD_EXAMPLES=ON to build)") message (STATUS "Example programs will not be built (set FLTK_BUILD_EXAMPLES=ON to build)")
endif () endif ()
message (STATUS "") message (STATUS "")

View File

@ -1,7 +1,7 @@
// //
// Forms emulation header file for the Fast Light Tool Kit (FLTK). // Forms emulation header file for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2011 by Bill Spitzak and others. // Copyright 1998-2023 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // 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 // the file "COPYING" which should have been included with this file. If this
@ -47,7 +47,8 @@ typedef Fl_Window FL_FORM;
#define FL_CANCEL 0 #define FL_CANCEL 0
#define FL_INVALID 0 #define FL_INVALID 0
#define FL_IGNORE -1 #define FL_IGNORE -1
//#define FL_CLOSE -2 // this variable is never used in FLTK Forms. It is removed becaus it conflicts with the window FL_CLOSE event // #define FL_CLOSE -2 // this variable is never used in FLTK Forms. It is removed
// because it conflicts with the window FL_CLOSE event
#define FL_LCOL FL_BLACK #define FL_LCOL FL_BLACK
#define FL_COL1 FL_GRAY #define FL_COL1 FL_GRAY

View File

@ -93,7 +93,7 @@ AS_IF([test x$enable_cp936 = xyes], [
CFLAGS="$CFLAGS -DCP936" CFLAGS="$CFLAGS -DCP936"
]) ])
AC_ARG_ENABLE([cygwin], AS_HELP_STRING([--enable-cygwin], [use the Cygwin libraries (default=no)])) AC_ARG_ENABLE([cygwin], AS_HELP_STRING([--enable-cygwin], [use the Cygwin DLL (default=no)]))
AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging])) AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging]))
AS_IF([test x$enable_debug = xyes], [ AS_IF([test x$enable_debug = xyes], [
@ -102,6 +102,8 @@ AS_IF([test x$enable_debug = xyes], [
DEBUGFLAG="" DEBUGFLAG=""
]) ])
AC_ARG_ENABLE([forms], AS_HELP_STRING([--disable-forms], [build Forms compatibility library (default=yes)]))
AC_ARG_ENABLE([gl], AS_HELP_STRING([--disable-gl], [turn off OpenGL support])) AC_ARG_ENABLE([gl], AS_HELP_STRING([--disable-gl], [turn off OpenGL support]))
AC_ARG_ENABLE([localjpeg], AS_HELP_STRING([--enable-localjpeg], [use local JPEG library (default=auto)])) AC_ARG_ENABLE([localjpeg], AS_HELP_STRING([--enable-localjpeg], [use local JPEG library (default=auto)]))
@ -145,9 +147,9 @@ AC_ARG_ENABLE([xrender], AS_HELP_STRING([--disable-xrender], [turn off Xrender s
AC_ARG_ENABLE([fluid], AS_HELP_STRING([--disable-fluid], [turn off fluid building])) AC_ARG_ENABLE([fluid], AS_HELP_STRING([--disable-fluid], [turn off fluid building]))
AS_CASE([$host_os], [cygwin* | mingw*], [ AS_CASE([$host_os], [cygwin* | mingw*], [
AC_ARG_ENABLE([gdiplus], AS_HELP_STRING([--disable-gdiplus], [don't use GDI+ for antialiased graphics])) AC_ARG_ENABLE([gdiplus], AS_HELP_STRING([--disable-gdiplus], [don't use GDI+ for antialiased graphics]))
gdiplus_found=no gdiplus_found=no
AS_IF([test x$enable_gdiplus != xno], [ AS_IF([test x$enable_gdiplus != xno], [
AC_CHECK_HEADERS([wtypes.h gdiplus.h], [ AC_CHECK_HEADERS([wtypes.h gdiplus.h], [
AC_DEFINE([USE_GDIPLUS]) AC_DEFINE([USE_GDIPLUS])
@ -170,7 +172,6 @@ AS_IF([test "x$with_archflags" != x], [
CFLAGS="$CFLAGS $with_archflags" CFLAGS="$CFLAGS $with_archflags"
]) ])
dnl FLTK build options to be used in Makefiles (defined in makeinclude) dnl FLTK build options to be used in Makefiles (defined in makeinclude)
BUILD="" BUILD=""
@ -200,24 +201,37 @@ AS_CASE([$host_os], [cygwin*], [
dnl Define the libraries and link options we will need. dnl Define the libraries and link options we will need.
LINKFLTK="../lib/libfltk.a" LINKFLTK="../lib/libfltk.a"
LINKFLTKFORMS="../lib/libfltk_forms.a"
LINKFLTKGL="../lib/libfltk_gl.a" LINKFLTKGL="../lib/libfltk_gl.a"
LINKFLTKIMG="../lib/libfltk_images.a" LINKFLTKIMG="../lib/libfltk_images.a"
GLDEMOS="gldemos" GLDEMOS="gldemos"
LIBEXT=".a" LIBEXT=".a"
LIBNAME="../lib/libfltk.a" LIBNAME="../lib/libfltk.a"
FLLIBNAME="../lib/libfltk_forms.a"
GLLIBNAME="../lib/libfltk_gl.a" GLLIBNAME="../lib/libfltk_gl.a"
IMGLIBNAME="../lib/libfltk_images.a" IMGLIBNAME="../lib/libfltk_images.a"
CAIROLIBNAME="../lib/libfltk_cairo.a" CAIROLIBNAME="../lib/libfltk_cairo.a"
LIBBASENAME="libfltk.a" LIBBASENAME="libfltk.a"
FLLIBBASENAME="libfltk_forms.a"
GLLIBBASENAME="libfltk_gl.a" GLLIBBASENAME="libfltk_gl.a"
IMGLIBBASENAME="libfltk_images.a" IMGLIBBASENAME="libfltk_images.a"
CAIROLIBBASENAME="libfltk_cairo.a" CAIROLIBBASENAME="libfltk_cairo.a"
dnl set library names etc. for the optional forms library and set 'build_forms'
dnl to make conditional code independent of the default value of 'enable_forms'
dnl which is 'yes' (enabled) in 1.4.0 (default may be changed later)
AS_IF([test x$enable_forms != xno], [
build_forms="yes"
LINKFLTKFORMS="../lib/libfltk_forms.a"
FLLIBNAME="../lib/libfltk_forms.a"
FLLIBBASENAME="libfltk_forms.a"
AC_DEFINE([FLTK_HAVE_FORMS])
], [
build_forms="no"
LINKFLTKFORMS=""
FLLIBNAME=""
FLLIBBASENAME=""
])
dnl Check for Cairo library unless disabled... dnl Check for Cairo library unless disabled...
CAIRODIR="" CAIRODIR=""
@ -261,7 +275,6 @@ AC_SUBST(CAIROLIBS)
AC_SUBST(LINKFLTKCAIRO) AC_SUBST(LINKFLTKCAIRO)
AC_SUBST(FLTKCAIROOPTION) AC_SUBST(FLTKCAIROOPTION)
AC_SUBST(FLLIBNAME)
AC_SUBST(GLDEMOS) AC_SUBST(GLDEMOS)
AC_SUBST(GLLIBNAME) AC_SUBST(GLLIBNAME)
AC_SUBST(IMGLIBNAME) AC_SUBST(IMGLIBNAME)
@ -269,12 +282,10 @@ AC_SUBST(CAIROLIBNAME)
AC_SUBST(LIBEXT) AC_SUBST(LIBEXT)
AC_SUBST(LIBNAME) AC_SUBST(LIBNAME)
AC_SUBST(LINKFLTK) AC_SUBST(LINKFLTK)
AC_SUBST(LINKFLTKFORMS)
AC_SUBST(LINKFLTKGL) AC_SUBST(LINKFLTKGL)
AC_SUBST(LINKFLTKIMG) AC_SUBST(LINKFLTKIMG)
AC_SUBST(LIBBASENAME) AC_SUBST(LIBBASENAME)
AC_SUBST(FLLIBBASENAME)
AC_SUBST(GLLIBBASENAME) AC_SUBST(GLLIBBASENAME)
AC_SUBST(IMGLIBBASENAME) AC_SUBST(IMGLIBBASENAME)
AC_SUBST(CAIROLIBBASENAME) AC_SUBST(CAIROLIBBASENAME)
@ -432,7 +443,7 @@ AS_IF([test "x$enable_shared" = xyes], [
DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o" DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
]) ])
LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX" LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
], [ ], [
DSOCOMMAND="echo" DSOCOMMAND="echo"
DSOLINK="" DSOLINK=""
@ -445,9 +456,21 @@ AS_IF([test "x$enable_shared" = xyes], [
SHAREDSUFFIX="" SHAREDSUFFIX=""
FLUID="fluid" FLUID="fluid"
FLTK_OPTIONS="fltk-options" FLTK_OPTIONS="fltk-options"
LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a" LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk.a"
]) ])
dnl reset FLDSONAME if the Forms compatibility library is disabled (not built):
dnl overwrite the variable because this is easier than adding conditional code above
AS_IF([test x$build_forms = xno], [
FLDSONAME=""
])
AC_SUBST([FLLIBNAME])
AC_SUBST([FLLIBBASENAME])
AC_SUBST([FLDSONAME])
AC_SUBST([LINKFLTKFORMS])
AC_SUBST([LINKSHARED])
dnl Define the fluid executable used when building the test programs. dnl Define the fluid executable used when building the test programs.
dnl In a native build we use the fluid executable created during the build, dnl In a native build we use the fluid executable created during the build,
@ -463,12 +486,10 @@ AC_SUBST([DSOCOMMAND])
AC_SUBST([DSOFLAGS]) AC_SUBST([DSOFLAGS])
AC_SUBST([DSOLINK]) AC_SUBST([DSOLINK])
AC_SUBST([DSONAME]) AC_SUBST([DSONAME])
AC_SUBST([FLDSONAME])
AC_SUBST([GLDSONAME]) AC_SUBST([GLDSONAME])
AC_SUBST([IMGDSONAME]) AC_SUBST([IMGDSONAME])
AC_SUBST([CAIRODSONAME]) AC_SUBST([CAIRODSONAME])
AC_SUBST([SHAREDSUFFIX]) AC_SUBST([SHAREDSUFFIX])
AC_SUBST([LINKSHARED])
AC_SUBST([FLUID]) AC_SUBST([FLUID])
AC_SUBST([FLUID_BUILD]) AC_SUBST([FLUID_BUILD])
AC_SUBST([FLTK_OPTIONS]) AC_SUBST([FLTK_OPTIONS])
@ -1791,12 +1812,13 @@ AS_IF([test x$enable_fluid != xno], [
echo " Build fluid: NO" echo " Build fluid: NO"
]) ])
dnl
echo "Cross-compiling: $fltk_cross_compiling"
AS_IF([test "$fltk_cross_compiling" = "yes"], [ AS_IF([test "$fltk_cross_compiling" = "yes"], [
echo "Cross-compiling: YES"
echo " Build: $build -> Host: $host" echo " Build: $build -> Host: $host"
], [
echo "Cross-compiling: NO"
]) ])
dnl
echo " Graphics: $graphics" echo " Graphics: $graphics"
dnl dnl
AS_IF([test x$JPEG = x], [ AS_IF([test x$JPEG = x], [
@ -1814,6 +1836,13 @@ AS_IF([test x$ZLIB = x], [
], [ ], [
echo " ZLIB=Builtin" echo " ZLIB=Builtin"
]) ])
AS_IF([test x$build_forms = xyes], [
echo "Forms library: YES"
], [
echo "Forms library: NO"
])
AS_IF([test x$enable_cairo = xyes], [ AS_IF([test x$enable_cairo = xyes], [
echo " CAIRO=lib" echo " CAIRO=lib"
]) ])

View File

@ -2,7 +2,7 @@
/* /*
* Build configuration file for the Fast Light Tool Kit (FLTK). * Build configuration file for the Fast Light Tool Kit (FLTK).
* *
* Copyright 1998-2021 by Bill Spitzak and others. * Copyright 1998-2023 by Bill Spitzak and others.
* *
* This library is free software. Distribution and use rights are outlined in * 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 * the file "COPYING" which should have been included with this file. If this
@ -46,6 +46,15 @@
#cmakedefine FLTK_HAVE_CAIROEXT 1 #cmakedefine FLTK_HAVE_CAIROEXT 1
/*
* FLTK_HAVE_FORMS
*
* Do we have the Forms compatibility library available?
*/
#cmakedefine FLTK_HAVE_FORMS 1
/* /*
* FLTK_USE_X11 * FLTK_USE_X11
* *

View File

@ -1,7 +1,7 @@
/* /*
* Build configuration file for the Fast Light Tool Kit (FLTK). * Build configuration file for the Fast Light Tool Kit (FLTK).
* *
* Copyright 1998-2021 by Bill Spitzak and others. * Copyright 1998-2023 by Bill Spitzak and others.
* *
* This library is free software. Distribution and use rights are outlined in * 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 * the file "COPYING" which should have been included with this file. If this
@ -45,6 +45,15 @@
#undef FLTK_HAVE_CAIROEXT #undef FLTK_HAVE_CAIROEXT
/*
* FLTK_HAVE_FORMS
*
* Do we have the Forms compatibility library available?
*/
#undef FLTK_HAVE_FORMS
/* /*
* FLTK_USE_X11 * FLTK_USE_X11
* *

View File

@ -25,7 +25,7 @@ OBJECTS = $(CPPFILES:.cxx=.o)
all: $(FLTK_OPTIONS) fltk-options$(EXEEXT) all: $(FLTK_OPTIONS) fltk-options$(EXEEXT)
fltk-options$(EXEEXT): $(OBJECTS) $(LIBNAME) $(FLLIBNAME) fltk-options$(EXEEXT): $(OBJECTS) $(LIBNAME)
echo Linking $@... echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKFLTKIMG) $(LDFLAGS) $(LDLIBS) $(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKFLTKIMG) $(LDFLAGS) $(LDLIBS)
$(OSX_ONLY) $(RM) -r -f fltk-options.app $(OSX_ONLY) $(RM) -r -f fltk-options.app
@ -34,7 +34,7 @@ fltk-options$(EXEEXT): $(OBJECTS) $(LIBNAME) $(FLLIBNAME)
$(OSX_ONLY) $(INSTALL) icons/fltk-options.icns fltk-options.app/Contents/Resources $(OSX_ONLY) $(INSTALL) icons/fltk-options.icns fltk-options.app/Contents/Resources
$(OSX_ONLY) $(INSTALL) fltk-options.plist fltk-options.app/Contents/Info.plist $(OSX_ONLY) $(INSTALL) fltk-options.plist fltk-options.app/Contents/Info.plist
fltk-options-shared$(EXEEXT): $(OBJECTS) ../src/$(DSONAME) ../src/$(FLDSONAME) fltk-options-shared$(EXEEXT): $(OBJECTS) ../src/$(DSONAME)
echo Linking $@... echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKSHARED) $(LDFLAGS) $(LDLIBS) $(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKSHARED) $(LDFLAGS) $(LDLIBS)

View File

@ -66,8 +66,7 @@ OBJECTS = $(CPPFILES:.cxx=.o)
all: $(FLUID) fluid$(EXEEXT) all: $(FLUID) fluid$(EXEEXT)
fluid$(EXEEXT): $(OBJECTS) $(LIBNAME) $(FLLIBNAME) \ fluid$(EXEEXT): $(OBJECTS) $(LIBNAME) $(IMGLIBNAME)
$(IMGLIBNAME)
echo Linking $@... echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKFLTKIMG) $(LDFLAGS) $(LDLIBS) $(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKFLTKIMG) $(LDFLAGS) $(LDLIBS)
$(OSX_ONLY) $(RM) -r -f fluid.app $(OSX_ONLY) $(RM) -r -f fluid.app
@ -76,8 +75,7 @@ fluid$(EXEEXT): $(OBJECTS) $(LIBNAME) $(FLLIBNAME) \
$(OSX_ONLY) $(INSTALL) icons/fluid.icns fluid.app/Contents/Resources $(OSX_ONLY) $(INSTALL) icons/fluid.icns fluid.app/Contents/Resources
$(OSX_ONLY) $(INSTALL) fluid.plist fluid.app/Contents/Info.plist $(OSX_ONLY) $(INSTALL) fluid.plist fluid.app/Contents/Info.plist
fluid-shared$(EXEEXT): $(OBJECTS) ../src/$(DSONAME) ../src/$(FLDSONAME) \ fluid-shared$(EXEEXT): $(OBJECTS) ../src/$(DSONAME) ../src/$(IMGDSONAME)
../src/$(IMGDSONAME)
echo Linking $@... echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKSHARED) $(LDFLAGS) $(LDLIBS) $(CXX) $(ARCHFLAGS) $(CXXFLAGS) -o $@ $(OBJECTS) $(LINKSHARED) $(LDFLAGS) $(LDLIBS)

View File

@ -406,14 +406,18 @@ set (CPPFILES
${DRIVER_FILES} ${DRIVER_FILES}
) )
set (FORMS_FILES if (FLTK_BUILD_FORMS)
forms_compatibility.cxx set (FORMS_FILES
forms_bitmap.cxx forms_compatibility.cxx
forms_free.cxx forms_bitmap.cxx
forms_fselect.cxx forms_free.cxx
forms_pixmap.cxx forms_fselect.cxx
forms_timer.cxx forms_pixmap.cxx
) forms_timer.cxx
)
else ()
set (FORMS_FILES "")
endif ()
set (GLCPPFILES set (GLCPPFILES
Fl_Gl_Choice.cxx Fl_Gl_Choice.cxx
@ -759,8 +763,10 @@ endif()
####################################################################### #######################################################################
FL_ADD_LIBRARY (fltk_forms STATIC "${FORMS_FILES}") if (FLTK_BUILD_FORMS)
target_link_libraries (fltk_forms fltk) FL_ADD_LIBRARY (fltk_forms STATIC "${FORMS_FILES}")
target_link_libraries (fltk_forms fltk)
endif ()
####################################################################### #######################################################################
@ -806,8 +812,10 @@ if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
################################################################### ###################################################################
FL_ADD_LIBRARY (fltk_forms SHARED "${FORMS_FILES}") if (FLTK_BUILD_FORMS)
target_link_libraries (fltk_forms_SHARED fltk_SHARED) FL_ADD_LIBRARY (fltk_forms SHARED "${FORMS_FILES}")
target_link_libraries (fltk_forms_SHARED fltk_SHARED)
endif ()
################################################################### ###################################################################

View File

@ -75,6 +75,14 @@ else ()
set (GLDEMO_SHARED fltk_SHARED) set (GLDEMO_SHARED fltk_SHARED)
endif () endif ()
# Similar approach for the 'forms' demo (shared lib not supported)
if (FLTK_BUILD_FORMS)
set (FORMS_LIBS fltk_forms) # implies 'fltk' as well
else ()
set (FORMS_LIBS fltk)
endif ()
####################################################################### #######################################################################
CREATE_EXAMPLE (adjuster adjuster.cxx fltk) CREATE_EXAMPLE (adjuster adjuster.cxx fltk)
@ -106,7 +114,7 @@ CREATE_EXAMPLE (flex_demo flex_demo.cxx fltk)
CREATE_EXAMPLE (flex_login flex_login.cxx fltk) CREATE_EXAMPLE (flex_login flex_login.cxx fltk)
CREATE_EXAMPLE (fltk-versions fltk-versions.cxx fltk) CREATE_EXAMPLE (fltk-versions fltk-versions.cxx fltk)
CREATE_EXAMPLE (fonts fonts.cxx fltk) CREATE_EXAMPLE (fonts fonts.cxx fltk)
CREATE_EXAMPLE (forms forms.cxx "fltk_forms;fltk") CREATE_EXAMPLE (forms forms.cxx "${FORMS_LIBS}")
CREATE_EXAMPLE (fullscreen fullscreen.cxx "${GLDEMO_LIBS}") CREATE_EXAMPLE (fullscreen fullscreen.cxx "${GLDEMO_LIBS}")
CREATE_EXAMPLE (grid_alignment grid_alignment.cxx fltk) CREATE_EXAMPLE (grid_alignment grid_alignment.cxx fltk)
CREATE_EXAMPLE (grid_buttons grid_buttons.cxx fltk) CREATE_EXAMPLE (grid_buttons grid_buttons.cxx fltk)

View File

@ -19,10 +19,13 @@
// https://www.fltk.org/bugs.php // https://www.fltk.org/bugs.php
// //
#include <FL/forms.H> // changed for FLTK #include <FL/Fl.H> // FLTK: includes <FL/fl_config.h>
#ifdef FLTK_HAVE_FORMS // FLTK: defined in <FL/fl_config.h> since FLTK 1.4.0
static int border = 1; // changed from FL_TRANSIENT for FLTK #include <FL/forms.H> // changed for FLTK
// (this is so the close box and Esc work to close the window)
static int border = 1; // changed from FL_TRANSIENT for FLTK
// (this is so the close box and Esc work to close the window)
typedef struct { Fl_Boxtype val; const char *name; } VN_struct; typedef struct { Fl_Boxtype val; const char *name; } VN_struct;
@ -173,4 +176,18 @@ int main(int argc, char *argv[]) {
; ;
return 0; return 0;
} }
#else // (!FLTK_HAVE_FORMS)
#include <FL/fl_ask.H>
int main(int argc, char **argv) {
fl_message_title("This program needs the Forms compatibility library");
fl_message(
"Please configure FLTK with Forms enabled (--enable-forms)\n"
"or the CMake option FLTK_BUILD_FORMS=ON.");
return 0;
}
#endif // (FLTK_HAVE_FORMS)