Commit Graph

113 Commits

Author SHA1 Message Date
Albrecht Schlosser
0987c763ec CMake: fix "LIBDECOR_PLUGIN_DIR" undefined error
This could happen on Linux if built with CMake option
  "-DFLTK_USE_SYSTEM_LIBDECOR=OFF"
2024-02-14 22:57:55 +01:00
Albrecht Schlosser
0771bc6cee CMake: improve formatting, remove debug statements 2024-02-13 15:10:06 +01:00
Albrecht Schlosser
179c5d3521 CMake: fix some weird internal dependencies (Wayland/X11)
Improve recognition of Wayland and X11 specific build options and
remove duplicates from required dependencies (FLTK_LDLIBS) used in
fltk-config.

This should also fix the GitLab CI build process.

To do: the logic to find the dependencies of Wayland and X11 is
currently suboptimal. This will be improved in a later commit.
2024-02-10 16:27:38 +01:00
Albrecht Schlosser
c83164fbcc CMake cleanup: fix alignment 2024-02-08 19:31:40 +01:00
Albrecht Schlosser
2ee5ca7ef3 CMake cleanup: mark two more cache variables "advanced" 2024-02-08 19:18:37 +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
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
7bbfa06e38 Wayland+CMake: use set_source_files_properties() for libdecor 2023-12-05 08:52:21 +01:00
Albrecht Schlosser
cf07fa09dc Minor updates of bundled libraries and README.CMake.txt
Update Makefiles, CMakeLists.txt, improve formatting.
2023-12-04 17:31:18 +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
4a461efae6 CMake/Windows/MSVC: Add option to select MSVC Runtime
Selects MSVC compiler/build options known as /MT, /MTd, /MD, or /MDd.

This applies to "Visual Studio" (IDE) and "NMake Makefiles" builds.
2023-11-25 21:03:23 +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
ManoloFLTK
3e2c8d5a95 Allow building Wayland platform without dbus - cont'd (#726)
CMake-based building without dbus is made possible
2023-04-30 21:36:19 +02:00
ManoloFLTK
b867488442 Fix "recipe for target '../../src/xdg-decoration-protocol.c' failed" (#704) 2023-04-02 16:04:13 +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
Matthias Melcher
c8024c7a3b
Make sure that zlib and png are both local or system (#621)
Autoconf syncs png and zlib configuration
Cmake png zlib selection
2023-01-01 17:29:23 +01:00
ManoloFLTK
41f37613ec Derive Fl_Zenity_Native_File_Chooser_Driver from Fl_Kdialog_Native_…
Also add Fl::option(OPTION_FNFC_USES_ZENITY)
2022-12-16 16:21:23 +01:00
Trent McPheron
576271fb04 Add Zenity-based file chooser based on the KDialog one (HugLifeTiZ)
If available, it is used on Linux regardless of the current desktop because
it offers free XDG portal integration, which means it picks the correct file
chooser on all desktops, and allows for meaningful file selection in sandbox
environments like Flatpak.
2022-12-16 16:21:23 +01:00
ManoloFLTK
496c7dd84b Fix for "Build on FreeBSD fails: linux/input.h not found" (#584) 2022-12-13 10:16:23 +01:00
ManoloFLTK
2356c9dcd6 CMake build for Wayland: check for presence of required GL-related software 2022-11-24 09:08:46 +01:00
ManoloFLTK
75b06d02c9 CMake building: improve messages about necessary software packages 2022-11-24 07:22:27 +01:00
ManoloFLTK
7d8885d6d8 CMake build for Wayland/X11 hybrid: check for libx???-dev packages 2022-11-23 19:00:05 +01:00
Albrecht Schlosser
ce777110fe Fix whitespace (trailing spaces) 2022-11-23 13:08:37 +01:00
ManoloFLTK
0ba051994a Have OPTION_USE_WAYLAND / --enable-wayland set to ON by default 2022-11-23 06:17:31 +01:00
ManoloFLTK
4dcced5b29 Wayland+CMake: stop forcing GTK_FOUND to 0
This removes the cause of this developer's message
  # FIXME: This needs to be redesigned! Forcing GTK_FOUND to 0 (NO) is a bad
  # FIXME: idea because there could be unwanted side effects. AlbrechtS
2022-11-23 05:59:57 +01:00
ManoloFLTK
615b731783 CMake+Wayland: check for presence of required software modules
Also, remove hardcoded path to wayland-protocols when
CMake version ≥ 3.4
2022-11-18 09:10:22 +01:00
Matthias Melcher
edf7510dda
Make building Fluid optional. (#539) 2022-11-13 20:16:54 +01:00
ManoloFLTK
a6b3903b89 Wayland + CMake: fix generated fltk-config that lacked -lX11 2022-11-08 11:37:49 +01:00
ManoloFLTK
260a446609 macOS + homebrew: restore building with CMake's OPTION_APPLE_X11
These option combinations work:
-DOPTION_APPLE_X11
-DOPTION_APPLE_X11 -DOPTION_USE_CAIRO

But
-DOPTION_APPLE_X11 -DOPTION_USE_PANGO
is not possible because homebrew doesn't provide the pangoxft package.
2022-10-16 08:29:59 +02:00
ManoloFLTK
203e7b7098 New OPTION_WAYLAND_ONLY for CMake to build pure Wayland platform. 2022-09-09 15:19:15 +02:00
ManoloFLTK
c720aae515 Make hybrid Wayland/X11 platform. 2022-08-29 12:15:32 +02:00
Albrecht Schlosser
b4bbc53c5e Reorder CMake build options for better order of include directories
This is only one minor step to remove issues of some CMake options
that can cause conflicting include directories ("-I..." switches).

See implementation note in CMake/options.cmake.
2022-04-07 19:19:40 +02:00
Albrecht Schlosser
8bd67f40da CMake: Restore removed HAVE_LIBPNG setting
This was removed unintentionally.
2022-04-05 15:36:28 +02:00
Albrecht Schlosser
cc6a7d008b Remove obsolete config variable 'HAVE_LIBPNG_PNG_H'
This variable has never been used in the code. Configure and CMake
look for a *working* libpng (HAVE_PNG) and set variable HAVE_PNG_H
if the header <png.h> can be included.

The alternative to include <libpng/png.h> is always used in the #else
clause and doesn't need its own config variable. Configure and CMake
log what they find, hence this extra variable is not necessary.
2022-04-04 21:10:25 +02:00
Albrecht Schlosser
5a8b9d9130 Improve libpng header search (notably on macOS)
Fix usage of internal cache variables so users can switch between
system and builtin libpng reliably.
2022-04-03 23:34:09 +02:00
ManoloFLTK
52015f2a26 Restore CMake build with OPTION_USE_GL=0 2022-03-22 22:16:03 +01:00
Albrecht Schlosser
59e028a3a7 CMake: Improve fltk-config generation
- set executable permissions on MinGW and more platforms
- add missing link libraries
- improve code formatting (indent)
- mark some variables as advanced
- simplify search for glib-2.0
2022-03-13 21:56:05 +01:00
ManoloFLTK
3718effc43 Add the Wayland platform to FLTK 1.4 2022-03-04 15:41:00 +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
ManoloFLTK
4bc25f7f9d Fix for issue #278 - continued : add CMake OPTION_USE_KDIALOG
Use of the kdialog command by class Fl_Naive_File_Chooser can now be turned off
at build-time through CMake OPTION_USE_KDIALOG.

If building via configure + make, set #define USE_KDIALOG to 0 in config.h before make.
2021-12-08 09:41:06 +01:00
ManoloFLTK
84cf249482 Fix for issue #253: Remove xdbe support 2021-11-26 15:01:54 +01:00
ManoloFLTK
b027d2ba57 Windows platform: use GDI+ to antialias oblique lines and curves. 2021-05-31 08:28:06 +02:00
Albrecht Schlosser
a484541d4b CMake: improve detection and configuration of image libs
Also: fix old (pre 3.13) link_directories() usage
2021-04-30 19:47:47 +02:00
Albrecht Schlosser
49a78bc482 Fix cairo build (autoconf + CMake) + README's
- rewrite to use pkg-config with both autoconf + CMake
- remove hardcoded library names
- fix build dependencies and search directories
- remove or replace old and unused variables
- update README files

To be done:
- implement fallback for autoconf/configure if pkg-config is missing
- fix pango build (uses cairo internally)
2021-03-01 10:45:59 +01:00
ManoloFLTK
1adaa3def2 Create classes Fl_XXX_Gl_Window_Driver according to driver model. 2021-02-16 09:29:13 +01:00
ManoloFLTK
8accc6e840
Pango ps (#148)
Use cairo-PostScript to output PostScript when pango is available.

This allows to draw in vectorial form any script.
Before, only the Latin script could be drawn to PostScript in vectorial form.
2020-10-28 17:19:05 +01:00
ManoloFLTK
95799bd364 Fix for cmake + macOS + OPTION_APPLE_X11 regarding GLU-using apps. 2020-08-31 16:17:04 +02:00