Commit Graph

98 Commits

Author SHA1 Message Date
Matthias Melcher
f5e7d62f90 Generate code block documentation using FLTK (#1353)
The Doxygen-to-pdf toolchain can not easily generate
pdf's with Japanese and Chinese characters. This patch
generates code blocks by rendering them in FLTK.
2025-12-28 21:37:30 +01:00
ManoloFLTK
b371c1185c Add build option FLTK_USE_DBUS to allow build w/o dbus (PR #1252)
Thanks to @lanodan for most of the source code.
2025-06-03 16:19:27 +02:00
Albrecht Schlosser
3bc379bc4e Fix usage of FLTK_BACKEND_WAYLAND and FLTK_USE_WAYLAND
- Do not change or remove the cache variable FLTK_BACKEND_WAYLAND:
  this is an option set (and must only be changed) by the user.
- CMake/options.cmake: check Wayland availability if option
  FLTK_BACKEND_WAYLAND is ON and set the result variable
  FLTK_USE_WAYLAND accordingly.
- Replace FLTK_BACKEND_WAYLAND with FLTK_USE_WAYLAND everywhere
  else, except as noted above: in options.cmake.
2025-05-28 21:13:10 +02:00
Albrecht Schlosser
0bc621bc00 Enable CPack support to build binary packages and installers
This minimal implementation works and enables basic (mostly default)
CPack support to build binary packages of FLTK (RPM, TGZ, NSIS, ...).

Users need the required tools like `rpmbuild` to build a particular
type of package or installer.

Using EPM or rpmbuild directly with a provided "list" file has
been discontinued: fltk.list.in (EPM) and fltk.spec.in (RPM) have
consequently been deleted.

README.CPack.txt: basic documentation
2025-05-24 15:42:47 +02:00
Albrecht Schlosser
53491f2ca0 Remove hardcoded version numbers: part 1
The goal is to change the version number for a new release only in
CMakeLists.txt. This is the first step.

Details:

- CMake/gen_config.cmake: this new file is included to generate the
  header files config.h (private, root directory), and FL/fl_config.h
  (public, can be installed). This file implements also ABI version
  checks (removed from FL/Enumerations.H and with more checks).
  Warnings are issued if the chosen ABI version is invalid.
- CMake/export.cmake: code to generate 'config.h' was moved to
  CMake/gen_config.cmake.
- CMake/options.cmake: set default of FLTK_BUILD_FORMS=OFF + comments
- CMakeLists.txt: move generation of FL/fl_config.h to gen_config.cmake,
  add API and ABI versions to CMake summary,
- FL/Enumerations.H: remove most of the version number details which
  are now included in FL/fl_config.h. This needed also some doxygen
  related changes.
- README.CMake.txt: improve docs of FL_ABI_VERSION and some more.
  Reflect the new default of CMake option FLTK_BUILD_FORMS (OFF).
- documentation/Doxyfile.in: add FL/fl_config.h to file list. This
  file is created in the build tree (and may be "installed").
- fl_config.h.in: add version number details that have been moved here
  from Enumerations.H (used to generate FL/fl_config.h).
2025-05-06 19:25:53 +02:00
Albrecht Schlosser
9ba11949ca Rename config header input files to better names
Up to FLTK 1.4 we had two distinct input files for each header file:
one for configure and one for CMake. Since 1.5 we have only one input
file for each header which can now have a more appropriate name.

1) configh.cmake.in   -> config.h.in
2) fl_config.cmake.in -> fl_config.h.in
2025-05-05 14:52:02 +02:00
Albrecht Schlosser
e0802889d4 macOS: disable automatic code signing when using Xcode
This is the default. Users can still override this if they have
  a valid certificate.
2025-04-28 18:36:09 +02:00
Albrecht Schlosser
1066b69c8e Fix "fully support ... own shared libraries" (#1238)
- If shared libraries are built, then fluid, fltk-options, and the
  "games" are linked against the shared FLTK libraries. On some
  platforms the static and the shared versions of fluid and
  fltk-options are built. The games are only built if
  FLTK_BUILD_TEST is enabled.

- The CMake 'install' target now installs the games (if built)
  and their man pages on all platforms (no matter if that is
  useful, for instance on Windows).

- On macOS 'CMAKE_INSTALL_RPATH' is set so *installed* programs
  automatically find their shared FLTK libraries. The "shared"
  versions of fluid and fltk-options got their own '.plist' files.
  This works for both the executables themselves as well as those
  included in bundles. There may be more to do on the macOS platform.
2025-04-21 19:50:12 +02:00
Albrecht Schlosser
8424af743b Disallow in-source builds
Rationale:

1. Building in-source creates a lot of untracked files in the source
   tree. We need to take care not to commit any of them, hence we
   have to maintain .gitignore files in several directories.

2. Tests reveal that there are even files in git that are modified
   in the source tree when building docs etc. which means e.g.
   that builds can't be "repeated" after upgrading the sources, and
   that those files could be committed by accident. To avoid this
   we'd have to reorganize the build procedure and make it even more
   complex rather than simplifying it.

3. With autoconf/configure/make we didn't have a choice, i.e. we had
   to allow in-source builds with configure/Makefiles anyway. This
   is no longer true since we removed configure/make support.

Note, todo: if this commit doesn't introduce unexpected issues, then
   we can remove a lot of stuff from the .gitignore files, but this
   is left for a later commit.
2025-03-25 18:55:21 +01:00
Albrecht Schlosser
1ccafa83b2 Remove obsolete build option 'FLTK_OPTION_STD'
This option is no longer needed since FLTK 1.5 always requires C++11.
2025-03-19 14:44:16 +01:00
Albrecht Schlosser
b252e5e45c Remove libfltk_cairo (fltk::cairo)
This library is no longer needed and was "empty" for backwards
compatibility since FLTK 1.4.0.
2025-03-16 00:10:53 +01:00
Albrecht Schlosser
c18c39071a CMake: improve setting C++ standard and configuration summary
CMake/fl_add_library.cmake: set target_compile_features(.. cxx_std_NN)
  which is inherited by consumers of the library.
  This prevents CMake user projects from failing if they would
  otherwise compile with an older C++ standard.

CMake/fl_debug_var.cmake: add INTERFACE_COMPILE_FEATURES to fl_debug_target()

CMake/fl_summary.cmake: update summary format for longer variable names

CMakeLists.txt:
  - check CMAKE_CXX_STANDARD given by the user (commandline)
    and set C++ standard related CMake variables in the CMake cache.
    The latter is experimental: setting in the cache may be reverted.
  - add C++ standard related info to configure summary.
2025-03-13 18:46:02 +01:00
Albrecht Schlosser
42a04c064d Improve setting minimal compiler standard (C++11)
... so the user can override all settings.

This may need more tweaks in the future.
2025-03-07 15:17:56 +01:00
Matthias Melcher
3068c7a0af Fl_String is now just an alias for std::string.
All mentions of Fl_String will be replaced with std::string
and the Fl_String implementation will be removed.
2025-03-07 00:12:40 +01:00
Albrecht Schlosser
191b33e0de Update version numbers to 1.5.0 2025-03-06 18:16:03 +01:00
Albrecht Schlosser
02af6a57eb Bump version numbers to 1.4.2 2025-02-21 16:25:39 +01:00
Albrecht Schlosser
99a6286288 Bump version numbers for release 1.4.1
To do: update CHANGES.txt with real info.
2024-12-09 20:46:01 +01:00
Albrecht Schlosser
fe7560fe61 CMake: add FLTKConfigVersion.cmake
This file enables consumers to search for a particular FLTK version.
2024-08-09 18:23:22 +02:00
Albrecht Schlosser
43ab34df05 CMake build summary: output libdecor location if found
Wayland only: output either the libdecor location or "Bundled".
2024-04-20 19:49:04 +02:00
Albrecht Schlosser
7601eea772 CMake: add installation prefix to Configuration Summary 2024-04-19 20:46:32 +02:00
Albrecht Schlosser
265e5cd77b Improve CMake build configuration summary
- simplify and unify build option output
- alignment can be changed in only 2 macros in CMake/fl_summary.cmake
- output system library location of image libraries if applicable
2024-04-08 18:56:40 +02:00
ManoloFLTK
69df45d38b CMake-based build under Linux shows whether X11 is used 2024-03-13 09:26:55 +01:00
Albrecht Schlosser
bddcecd28a CMake: set FLTK_VERSION and FLTK_FLUID_EXECUTABLE in the cache
This is useful if FLTK is built as a subproject, for instance by
using FetchContent.
2024-02-12 16:53:20 +01:00
Albrecht Schlosser
fd5cd80935 Introduce "Modern CMake" in FLTK
This is a big commit and there are too many changes to list them all.
The main changes are:

- rename all CMake build options to 'FLTK_*'
- export library targets with namespace (prefix) 'fltk::'
- standardize shared library target names with suffix '-shared'
- set public build properties on libraries for consumers
- document library names and aliases in README.CMake.txt
- document changes in "Migrating Code from FLTK 1.3 to 1.4"
- partial backwards compatibility for old user projects

Included but not directly related changes:

- fix Windows (Visual Studio) DLL build
- add CMake function fl_debug_target() to show target properties
- don't build test programs if FLTK is a subproject
- internal: reformat CMake code: remove space before '('

Thanks to Matthias and Manolo for their help, testing, and feeback.
2024-02-07 18:37:34 +01:00
Albrecht Schlosser
d237d186ae CMake: add missing configuration output statement 2024-01-01 19:14:26 +01:00
Albrecht Schlosser
5df5daf78e 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.
2023-12-20 17:33:37 +01:00
ManoloFLTK
f72748bb45 Wayland: make OPTION_USE_SYSTEM_LIBDECOR ON by default
This commit makes the default FLTK build setting use libdecor
as packaged in Linux when the build system contains packages
libdecor-0-dev and libdecor-0-plugin-1-gtk in version ≥ 0.2.0.
Otherwise, FLTK uses the bundled version of libdecor.
This includes situations where package libdecor-0-dev is
present in an earlier version.
2023-12-02 09:28:08 +01:00
Albrecht Schlosser
d446059766 Output build configuration in CMake report (#838) 2023-11-17 19:44:29 +01:00
Albrecht Schlosser
6f021d4830 CMake: Raise cmake_minimum_required from 3.12 to 3.15
Remove code that checks CMake versions lower than 3.15
2023-11-15 21:30:12 +01:00
Albrecht Schlosser
1209e9dcd7 Make Fl_String and Fl_Int_Vector private (#789)
- add CMake option 'OPTION_USE_STD'
- add configure option '--enable-use_std'
- move FL/Fl_String.H to src/Fl_String.H
- move FL/Fl_Int_Vector.H to src/Fl_Int_Vector.H
- remove Fl_String from demo program examples/callbacks.cxx
- remove Fl_Int_Vector from public header FL/Fl_Table.H
- some methods of Fl_Table are no longer inline
- add CMake option OPTION_USE_STD to allow std::string in some
  selected functions and methods

Experimental, may be removed before release:

- use either Fl_Int_Vector or std::vector in Fl_Table depending
  on CMake OPTION_USE_STD or configure --enable-use_std

Move all fl_filename* functions that use Fl_String to fluid

Main changes in fluid:
 - add fluid_filename.h and .cxx
 - include "fluid_filename.h" rather than <FL/filename.H>

Update fl_input(), fl_password() and test/ask

- add maxchar parameter to fl_input() and fl_password()
- fl_input_str() and fl_password_str() are optional and return
  std::string if enabled (FLTK_USE_STD)
2023-10-22 19:35:17 +02:00
Albrecht Schlosser
0f1492bba6 Update 'cmake_minimum_required' version to 3.12.0
Linking against OBJECT libraries as done in fluid since May 2023
and in shared library builds using MSVC even much earlier
requires at least CMake 3.12.

This commit adds the requirement explicitly to abort the build early.
2023-08-26 18:07:54 +02:00
Albrecht Schlosser
5175192755 CMake: build shared libs with OPTION_CAIROEXT (issue #250)
- remove separate libfltk_cairo to avoid cyclic dependencies, but
- keep a dummy libfltk_cairo in 1.4.0 for backwards compatibility
- move cairo/Fl_Cairo.cxx to src/Fl_Cairo.cxx
- add preliminary Cairo support for Visual Studio (MSVC)

Static linking is not affected by this change, but users building
with hand-made Makefiles will have to remove libfltk_cairo starting
with FLTK 1.4.0. The dummy library can be linked for backwards
compatibility but it will be removed later (in 1.4.x or 1.5.0).

The shared FLTK library libfltk.{so|dylib|dll|..} depends on libcairo
if and only if FLTK is built with one of the Cairo options. This has
always been the case for OPTION_CAIROEXT but is now also true if only
OPTION_CAIRO is selected, i.e. FLTK programs linked with a Cairo
enabled shared FLTK library will also be linked with libcairo. The same
is true for configure options --enable-cairo and --enable-cairoext,
respectively.

Preliminary Cairo support for MSVC now detects a Cairo installation
using the CMake variable FLTK_CAIRO_DIR which must be set by the user.
Note that this feature is temporary and may be changed in the future
for a better and more comfortable version.
2023-03-09 17:34:05 +01:00
Matthias Melcher
1fc269b0d4
Move global FLTK options into new app fltk-admin (#560) 2023-01-21 17:14:41 +01:00
ManoloFLTK
82bee7fa33 CMake: fix informative messages sent under macOS 2022-11-18 10:55:14 +01:00
Matthias Melcher
edf7510dda
Make building Fluid optional. (#539) 2022-11-13 20:16:54 +01:00
ManoloFLTK
c720aae515 Make hybrid Wayland/X11 platform. 2022-08-29 12:15:32 +02:00
Albrecht Schlosser
bed6027cf0 CMake: Improve configuration summary, add fl_debug_pkg macro
fl_debug_pkg(...) can be used to display CMake variables set by
  executing pkg_check_modules(). This is for CMake debugging only.

The CMake configuration summary displays configuration options
  of Wayland, Pango, Xft, and Cairo configuration.
2022-03-13 21:56:05 +01:00
Albrecht Schlosser
ec98dc113f CMake: Fix image libraries build if fallback is used
The CMake instructions would use the wrong image libs (png, jpeg, zlib)
if the fallback was active (OPTION_USE_SYSTEM_XXX) was true but the
header files were not present.

This had already been fixed for jpeg but not for the other two libs.
This commit rearranges the logic for all three libs.

Add information about builtin or system libraries to config summary.
2022-02-01 00:54:42 +01:00
Albrecht Schlosser
04ccc8cc46 Remove experimental platforms Android, Pico, SDL (PR #376)
... as discussed in fltk.coredev: "FLTK 1.4.0 release schedule"
https://groups.google.com/g/fltkcoredev/c/PDbHTRpXVh0/m/JqboexZ_AwAJ
2022-01-23 18:12:47 +01:00
Albrecht Schlosser
5438954d8c Generate FL/fl_config.h rather than FL/abi-version.h
... as discussed in fltk.coredev in thread "RFC: introduce public
config header <FL/fl_config.h>", see:
https://groups.google.com/g/fltkcoredev/c/xLCs1AIXMVo/m/MHZpQggzAQAJ

- Rename abi-version.h to fl_config.h, rename input files,
  update dependencies, .gitignore, CMake, configure and Makefiles.

- Include Cairo options in FL/fl_config.h

- Rename FLTK_USE_CAIRO to FLTK_HAVE_CAIROEXT for consistency.

- Include <FL/fl_config.h> in config.h and wherever necessary,
  fix include order (move FL/Fl.H to the top) and more.

- Move USE_X11 to fl_config.h and rename to FLTK_USE_X11

- Do not include <config.h> in Cairo demo program which is no
  longer required in Cairo programs since FLTK 1.4.0
2021-12-18 22:44:08 +01:00
Albrecht Schlosser
654e20ff8b CMake: Build fluid when cross-compiling 2021-11-11 23:11:06 +01:00
Albrecht Schlosser
410a01c6db Add CMake compatibility functions and macros
CMake/compatibility.cmake: define functions and macros to be used
  if a particular CMake functionality requires a higher CMake version
  than FLTK's minimum CMake version, see 'cmake_minimum_required(...)'
  in the root CMakeLists.txt.

Note: target_link_directories() is available since CMake 3.13
2021-07-26 17:40:26 +02:00
Albrecht Schlosser
787c67afea macOS: fix fltk_cairo shared library (issue #250)
- add missing dependencies to build the shared libfltk_cairo(.dylib)
- remove incorrect dependency on cairo from libfltk
- add cairo_test-shared demo (linked with shared libs)
2021-07-12 20:05:07 +02:00
Albrecht Schlosser
5c85a4ea95 Enhance CMake build configuration summary 2021-04-30 19:48:17 +02:00
Albrecht Schlosser
266b5e7cdd Fix CMake warning related to CMP0072 2021-03-01 10:02:41 +01:00
Albrecht Schlosser
bbaec9bd88 Update CMake and make files, minor edits only
There are no functional changes to be expected, mostly formatting
and comments.
2021-02-15 19:45:20 +01:00
Albrecht Schlosser
caf0bfa81d Avoid CMake developer warning related to OpenGL/CMP0072
Newer CMake versions warn if CMake policy CMP0072 is not set. We're
using "legacy mode" since we use FindOpenGL with `OPENGL_LIBRARIES`
and not (yet) the `OpenGL::GL` target.

See https://cmake.org/cmake/help/latest/policy/CMP0072.html
2020-09-18 18:07:18 +02:00
Albrecht Schlosser
9ba4cd06dc CMake: add feature and configuration summary 2020-08-21 19:00:38 +02:00
Albrecht Schlosser
3b9a04ae2e 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
2020-08-21 18:55:12 +02:00
Albrecht Schlosser
720b84ef9d CMake: refactor and reformat CMake files
- raise minimum CMake version from 2.6.3 to 3.2.3 (Jun 01, 2015)
- indent all CMake files according to the CMP (2 col.)
- refactor FLTK version number definitions and usage
- unify CMake and autoconf/configure variable names:
  - FL_VERSION -> FLTK_VERSION
  - FL_MAJOR_VERSION -> FLTK_VERSION_MAJOR
  - etc. for _MINOR_ and _PATCH_, respectively
  - note: this does not affect FL_VERSION etc. in source code
- generate "export headers" for all libraries (experimental: OFF)
- port some forgotten goodies from branch-1.3 to master
- merge and improve macro 'create_example' (WIP)
- remove "temporary" options and code for older CMake versions
- include and use 'GenerateExportHeader' (experimental, WIP: OFF)
  - note: created header files are not yet used
- build only *one* DLL with Visual Studio (tested, works)
  - similar to the bundled IDE projects in 1.3.x
- add some dynamically linked test/demo programs ('*-shared')
  if shared libraries are built (WIP)
- split 'macros.cmake': use one file per macro
2020-07-15 00:34:53 +02:00