Commit Graph

292 Commits

Author SHA1 Message Date
ManoloFLTK
f2db90cb77 Fix "CMake: Fallback to libOpenGL (no-X11 OpenGL)" (#1251)
Some checks failed
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled
2025-11-02 15:13:29 +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
Some checks failed
Build and Test / build-linux (push) Has been cancelled
Build and Test / build-wayland (push) Has been cancelled
Build and Test / build-macos (push) Has been cancelled
Build and Test / build-windows (push) Has been cancelled
- 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
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
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
794d493eb6 CMake: check version for some properties in fl_debug_target()
Debug only, if fl_debug_target() is used:

Prior to CMake 3.19 some properties of "INTERFACE_LIBRARY targets"
can't be read with get_property(). These properties are now
excluded if the CMake version is lower than 3.19.
2025-04-02 19:59:56 +02:00
Aaron M. Ucko
8b28e38942 options.cmake: Check Threads_FOUND, not CMAKE_HAVE_THREADS_LIBRARY
Some checks are pending
Build and Test / build-linux (push) Waiting to run
Build and Test / build-wayland (push) Waiting to run
Build and Test / build-macos (push) Waiting to run
Build and Test / build-windows (push) Waiting to run
The former's been available since CMake v2.8 and documented since v3.17;
the latter was never documented and quietly went away in CMake v3.24.
2025-04-01 19:12:10 +02: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
ManoloFLTK
d4efb77660 Fix "X11 library missing in fltk-config" (#1228) 2025-03-18 15:53:31 +01:00
Albrecht Schlosser
b252e5e45c Remove libfltk_cairo (fltk::cairo)
Some checks are pending
Build and Test / build-linux (push) Waiting to run
Build and Test / build-wayland (push) Waiting to run
Build and Test / build-macos (push) Waiting to run
Build and Test / build-windows (push) Waiting to run
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
Some checks are pending
Build and Test / build-linux (push) Waiting to run
Build and Test / build-wayland (push) Waiting to run
Build and Test / build-macos (push) Waiting to run
Build and Test / build-windows (push) Waiting to run
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
0c4d2be71b CMake: set FLTK_OPTION_STD effectively "always on"
Temporarily done by setting the internal variable FLTK_USE_STD to 1.
This affects FL/fl_config.h where FLTK_USE_STD will always be 1.

Source code that checks this variable should be fixed soon.
2025-03-08 19:08:04 +01:00
ManoloFLTK
7f60f019d7 Fix "fltk autotools build does not link against libXft" (#1202)
libXft was erroneously present in the link command when using Pango and Cairo.
This is fixed by disconnecting the GUI scaling code from use of Xft.

This commit also makes sure that when Wayland is used, pkg-config is available
on the build machine. This allows to remove from file CMake/options.cmake
code that was labelled with "FIXME".
2025-03-07 11:06:24 +01:00
Albrecht Schlosser
02af6a57eb Bump version numbers to 1.4.2
Some checks are pending
Build and Test / build-linux (push) Waiting to run
Build and Test / build-wayland (push) Waiting to run
Build and Test / build-macos (push) Waiting to run
Build and Test / build-windows (push) Waiting to run
2025-02-21 16:25:39 +01:00
Albrecht Schlosser
323d525591 MSYS2: Correctly detect ucrt64 environment (PR #1167)
This fix is different than the proposed PR.
The PR will be closed and not merged.

Closes #1167.
2025-01-16 18:14:41 +01:00
ManoloFLTK
c82165cb07 No need to link to libgtk when using package libdecor-0-dev 2024-12-09 09:21:24 +01:00
ManoloFLTK
0cd048a7a8 Improve procedure to construct best link command for macOS platform
As discussed between Matthias, Albrecht and Manolo, the best procedure is
- use MAC_OS_X_VERSION_MAX_ALLOWED but not __MAC_OS_X_VERSION_MAX_ALLOWED;
- compile helper file CMake /macOSMaxAllowed.c to detect whether the SDK in use
is in version above a given threshold version number;
- based upon the result of this check, decide to weakly link or not a given framework.
2024-11-28 14:59:32 +01:00
Albrecht Schlosser
87527017b2 MacOS: Fix build folder for detection of SDK version (#1103)
Sorry for the noise...
2024-11-05 16:53:12 +01:00
Albrecht Schlosser
d5c0e215a4 MacOS: Improve detection of SDK version (#1103)
CMake/macOSMaxAllowed.c:
  avoid C compiler warning in test code

CMake/setup.cmake, technical changes:
- optimization: test SDK 15.0.0 first to avoid unnecessary test if true
- use a function instead of a macro
- use different names for (cached) result variables
- use prefix FLTK_ for cache variables

Note: the cache variables are marked 'internal': you may need to grep
  CMakeCache.txt to view them.
2024-11-05 16:09:39 +01:00
Matthias Melcher
a77cc0cb35 MacOS version check using try_compile: #1103
This change will work as well when cross-compiling.
2024-11-04 22:35:49 +01:00
Matthias Melcher
71a61d9cbf Using try_run to get __MAC_OS_X_VERSION_MAX_ALLOWED (#1105) 2024-11-04 20:26:49 +01:00
Albrecht Schlosser
81d3ccefa4 CMake: ignore FLTK_MSVC_RUNTIME_DLL on other platforms
This commit suppresses a CMake warning if FLTK_MSVC_RUNTIME_DLL is
defined on the CMake commandline on platforms that don't use it.
2024-10-09 16:04:38 +02:00
Albrecht Schlosser
b595db30d4 CMake/Windows: enable MSVC runtime DLL option for Clang (#1058)
User @supsm reported that using LLVM/clang to compile together with
the MSVC linker should support the MSVC runtime DLL selection.

This commit enables the option on Windows except MinGW and MSYS
rather than MSVC only.
2024-09-03 11:17:58 +02:00
ManoloFLTK
1da9438a1c CMake: replace check_function_exists() with check_symbol_exists() (#1053) 2024-08-31 16:59:03 +02:00
Albrecht Schlosser
dd819a118c macOS: Fix installing partial 'FLTK.framework' (#961)
... which is not a real macOS "Framework".

Note that users building and *installing* FLTK should either install in
a fresh directory or delete the entire 'FLTK.framework' tree if they
are reusing an existing install directory because it will not be
deleted by subsequent installs.
2024-08-30 12:27:08 +02:00
Albrecht Schlosser
9568d5bb73 Display Git revision in docs generated from releases (#499)
- makesrcdist: store Git revision in a file in the tarball
 - CMake/resources.cmake: get git revision either from Git or file and
   store it as CMake cache variable 'FLTK_GIT_REVISION' for reference
 - documentation/*: get git revision from git or file
 - fluid/documentation/*: get git revision from git or file
2024-08-26 20:02:42 +02:00
Albrecht Schlosser
67e0547bf9 CMake: replace check_function_exists() for trunc() (#1049)
Part 1: replace the check for trunc() with check_symbol_exists().

Part 2 (to be done): replace all occurrences of the macro
  check_function_exists() with check_symbol_exists() if possible.
2024-08-25 17:51:15 +02:00
Albrecht Schlosser
9e35b0216f CMake: remove cache consistency check (#1046)
The attempted consistency check to remove FLTK's obsolete cache
variable OPENGL_GLU_INCLUDE_DIR which is used by CMake 3.29+ could
cause false positives, at least on macOS, as reported on issue #1046.

This modified code removes OPENGL_GLU_INCLUDE_DIR if it is defined
but FLTK_OPENGL_GLU_INCLUDE_DIR is not (yet) defined which indicates
the first configure execution with the new code.
2024-08-23 18:00:43 +02:00
Albrecht Schlosser
60330a6d6f CMake: remove debug statements 2024-08-08 17:43:38 +02:00
Albrecht Schlosser
e65681c9ac CMake: fix usage of OPENGL_GLU_INCLUDE_DIR (#1001)
This commit consists of two parts:

1. CMake/resources.cmake: remove the old variable OPENGL_GLU_INCLUDE_DIR
   from the CMake cache if possible, otherwise enforce a clean build.

2. src/CMakeLists.txt, CMake/options.cmake: use the new variable name
   FLTK_OPENGL_GLU_INCLUDE_DIR.

For details please see GitHub Issue #1001.
2024-08-08 14:49:34 +02:00
ManoloFLTK
713f0b0f64 Add -lwinspool necessary for new class Fl_PDF_File_Surface 2024-08-06 17:27:10 +02:00
ManoloFLTK
377ff11ec9 Link frameworks used by recent macOS versions with -weak_framework
This allows FLTK apps to use the recent frameworks when they run on recent
macOS versions even if the minimum supported macOS version of these apps is more
ancient than the framework.
2024-06-16 19:48:55 +02:00
ManoloFLTK
7d98413d46 macOS 15.0 Sequoia: fix capture of window titlebars
The previous procedure using CGWindowListCreateImageFromArray()
is obsoleted in macOS 15.0 .
The new procedure requires an additional framework: ScreenCaptureKit;
FLTK uses it only for macOS ≥ 15.0
2024-06-14 11:55:53 +02:00
Albrecht Schlosser
bc63ea7629 CMake: improve linking OpenGL3 example programs (#959)
- Remove find_library(LIB_GLEW ...) from 'resources.cmake'

- Use the variable FLTK_GLEW_DIR to "find" a user supplied GLEW library
  for OpenGL3 example programs (examples/OpenGL3*.cxx).
  Both static and shared libs (DLLs) are supported, but the static
  library is preferred to avoid DLL dependencies.

- Define preprocessor macro 'GLEW_STATIC' by CMake compile definitions
  if and only if the static glew library (glew32s) was found and linked.
  The previous code defined 'GLEW_STATIC' unconditionally in the source
  code which led to undefined references if a shared lib (DLL) was used.
2024-05-13 15:19:27 +02:00
Albrecht Schlosser
d1ea57bc7a CMake: improve finding cairo.dll on Windows
- don't use pkg-config to find Cairo if FLTK_CAIRO_DIR is set
- use FLTK_CAIRO_DIR to locate Cairo headers and DLL if it is set
- otherwise try to find Cairo with pkg-config anyway

This prevents accidentally "finding" the system Cairo libs provided
by MSYS - which would tie the FLTK library and user programs to MSYS,
i.e. it would make FLTK programs depend on the MSYS installation.
2024-05-13 15:18:04 +02:00
Albrecht Schlosser
6c06e953e1 Fix "Cannot build project with CMake ..." (#970)
... (add_library cannot create ALIAS target "fltk" because target
"fltk::fltk" is imported but not globally visible)

It turned out that this was due to a CMake feature that was changed in
CMake 3.18. This commit makes imported FLTK targets globally visible
for CMake versions less than 3.18.
2024-05-13 12:05:27 +02:00
Albrecht Schlosser
53543acb2e CMake: improve output of fl_debug_target()
Todo: check "*LOCATION" properties ...
2024-05-05 19:41:50 +02:00
ManoloFLTK
70b84b491b macOS + CMake: fix use of optional framework UniformTypeIdentifiers 2024-05-03 15:23:42 +02:00
ManoloFLTK
6238ede94d CMake: don't put freetype stuff in include directories for macOS
This removes these warnings for each source file compiled
  osxcross: warning: possibly dangerous include path specified: '-I /usr/include/freetype2'
  osxcross: info: you can silence this warning via 'OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1' (env)
when cross-compiling from Linux to macOS.
2024-05-03 08:33:56 +02:00
ManoloFLTK
4a9205f282 Remove commit 4a31d49 that breaks X11 build 2024-05-02 19:54:58 +02:00
ManoloFLTK
4a31d4988b CMake: put freetype stuff in include directories for X11 only
This would create these warnings for each source file compiled
  osxcross: warning: possibly dangerous include path specified: '-I /usr/include/freetype2'
  osxcross: info: you can silence this warning via 'OSXCROSS_NO_INCLUDE_PATH_WARNINGS=1' (env)
when cross-compiling from Linux to macOS.
2024-05-02 19:43:54 +02:00
Albrecht Schlosser
f194d8596f CMake/debug: add more properties to fl_debug_target()
This commit is only for CMake debugging.
2024-05-01 17:25:26 +02:00
Albrecht Schlosser
9cdd457382 CMake: make compile definition "FL_DLL" public for MSVC (#960)
Visual Studio projects that link to the FLTK DLL (fltk::fltk-shared)
inherit the compile definition set by the DLL target and will be
compiled with "-D FL_DLL" as required w/o the user project having
to set this preprocessor macro explicitly.

Todo: documentation will follow...
2024-04-27 18:35:39 +02:00
ManoloFLTK
abfc8ee52f Fix: Fl_Native_File_Chooser::filter_value() [Kdialog] always returns 0 (#899)
- remove build option FLTK_USE_KDIALOG replaced by an Fl::option() option
- new run-time option OPTION_FNFC_USES_KDIALOG
- make options OPTION_FNFC_USES_KDIALOG and OPTION_FNFC_USES_ZENITY
false by default
- add mention of new program fltk-options in the doc of Fl::option()
- change logic of choice of the native file chooser under X11/Wayland:
the zenity and kdialog choosers are opt-in; otherwise the GTK file chooser
is used, unless opted out with  OPTION_FNFC_USES_GTK
- document that zenity may be interesting for sandboxed apps
- document that both zenity and kdialog make member functions
Fl_Native_File_Chooser::filter_value() inoperable
2024-04-22 16:34:08 +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
ManoloFLTK
15d9a350bf Restore IMPORTED_TARGET in pkg_check_modules command for libdecor 2024-04-18 20:51:10 +02:00
ManoloFLTK
e6957fc2f5 Allow libdecor package version ≥ 0.2.0 with FLTK_USE_SYSTEM_LIBDECOR 2024-04-18 19:32:47 +02:00
Matthias Melcher
fd791a068e Separate FLUID user documentation, screen shot automation (#936)
* CMake integration, no autotiools
* alignment panel is now correctly renamed to setting panel
* source view is now correctly renamed to code view
* Merge FLTK FLUID docs into FLUID user manual.
* Add two simple entry tutorials
* Remove FLUID chapter form FLTK docs.
* GitHub action to generate HTML and PDF docs and
  make the available as artefacts
2024-04-17 17:51:32 +02:00
Albrecht Schlosser
b4cf1a9824 Fix and improve generation of fltk-config (#954 and more)
Parts of this commit fix the usage of CMake targets in the generation
process of fltk-config modified by PR #954.

The rest improves handling of variables used to generate fltk-config,
removes obsolete comments, documents variables like GLLIBS etc. which
had to be done anyway.
2024-04-14 19:15:08 +02:00