Commit Graph

206 Commits

Author SHA1 Message Date
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 d11c412f95 CMake: Make compile definitions 'FL_LIBRARY' and 'FL_DLL' private
... so they are not inherited by consumers of the library.

Remove 'add_definitions(-DFL_LIBRARY)' from src/CMakeLists.txt
  This is not necessary, see CMake/fl_add_library.cmake

Don't set obsolete property 'CLEAN_DIRECT_OUTPUT' which was removed
in CMake 2.8.0.
2023-08-28 15:21:58 +02:00
Albrecht Schlosser 372fe4cc99 CMake: fix formatting, add more debug output 2023-08-26 17:33:05 +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
Albrecht Schlosser fc5f0c13f2 Fix fltk-config --use-images with local image libs (#689)
CMake only: replace wrong variable names with correct ones. Affected
were all image libraries (jpeg, png) and zlib.

These variables had been renamed in an earlier commit when lots of
CMake code had been rewritten.
2023-02-28 14:47:33 +01:00
ManoloFLTK 160eb2926d Remove usage of __APPLE_QUARTZ__ (#673) 2023-02-06 21:42:40 +01:00
Matthias Melcher 1aa6c4fed8
Fix position() methods that shadow Fl_Widget::position()
* `FL_DEPRECATED` macro to mark `position()` method that shadow `Fl_Widget::position()` #69 (#666)
2023-02-02 20:54:19 +01:00
ManoloFLTK 6276822e9e Allow cmake -DOPTION_APPLE_X11=On without -U__APPLE__ 2023-02-02 18:48:24 +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
Albrecht Schlosser 578601f062 CMake: improve debug macros 2022-11-11 17:05:11 +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
ManoloFLTK ad96df9e93 Wayland under FreeBSD: detect <GL/glu.h> and fix LIBDECOR_PLUGIN_DIR. 2022-05-21 07:55:03 +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 228d04d0e0 Build and use fluid-cmd on Windows for .fl files (#224, #293)
On Windows fluid.exe is a "GUI" program and does not allow console
output which can be a problem in automated builds. In Visual Studio
the fluid GUI program would pop up console windows when generating
.cxx and .h files from .fl files.

The new (additional) fluid-cmd.exe is built as console application
for users that need it and it is used in the FLTK build process on
Windows to convert the .fl files.
2022-04-03 23:47:23 +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
Albrecht Schlosser 2b8f3a757a CMake: Don't install man pages of game programs (issue #23)
I decided not to install the man pages for consistency because we
don't install the executable programs. The instructions are commented
out only so they can be activated easily if this will be changed,
i.e. if we decide to install the test/game programs in the future.

Closes #23
2022-03-26 20:04:04 +01:00
Albrecht Schlosser 9cf1afda62 CMake: Remove obsolete platform dependent instructions
The intended effect (building a Windows "GUI" application), is
correctly achieved using the "WIN32" option of add_executable()
selectively where appropriate rather than setting this platform
specific option for *all* (Windows) executables when using GNU
compilers (MinGW, MSYS2, Cygwin, ...).
2022-03-26 18:53:05 +01:00
Albrecht Schlosser 111b858e12 CMake/MSVC: limit "/utf-8" to VS 2015 and later (PR #415)
According to PR #415 this switch was added in Visual Studio 2015
Update 3. However, version "1900" does not distinguish updates,
hence Visual Studio 2015 up to Update 2 may fail to compile with
this addition. Installing the updates would obviously fix this.
2022-03-26 18:13:47 +01:00
ZJUGKC 6f06265e86 Add UTF-8 encoding support in setup.cmake for MSVC (PR #415)
The source files are all encoded by UTF-8 without BOM. This will raise
warnings and errors when compiling by the MSVC with some active code
pages (ACP). The file `test/ask.cxx` contains such characters with UTF-8
encoding. Adding `/utf-8` here is equivalent to specifying
`/source-charset:utf-8 /execution-charset:utf-8`, and all warnings and
errors are removed.
2022-03-26 18:00:50 +01:00
Albrecht Schlosser 3fb66056d6 CMake: add missing variable initialization
Although CMake uses previously undefined variables like empty strings
it could happen that variables set in the calling context by other
projects initialized some variables with unexpected values.

Example: FLTK_LIBRARIES could have been initialized by previous
  execution of 'find_package(FLTK ...)' in a project using FLTK
2022-03-25 17:27:46 +01: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
Albrecht Schlosser 14e1954859 Fix CMake version test in setup.cmake
Note: CMake operator 'VERSION_GREATER_EQUAL' was added in CMake 3.7
  but we allow 3.2.3
2022-03-13 21:56:05 +01:00
Albrecht Schlosser 5fd182ee50 CMake/Windows (MSVC): remove confusing CMake warning
The Visual Studio generator does often not find GL/glu.h and locale.h
although these headers are in the Visual Studio SDK. The warning has
been changed to "info" and the unnecessary and sometimes confusing
recommendation to rerun CMake has been removed.
2022-03-13 21:56:05 +01: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 fbf7a347ec CMake/MinGW/MSYS2: fix building examples with libglew32 (#226)
CMake/resources.cmake: add NAMES option to find_library

examples/CMakeLists.txt: fix linking libGLEW/libglew32
2022-03-07 15:05:07 +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 b91db00d91 CMake: export Cairo include directories (issue #350)
If a user project is built using a FLTK library generated by CMake
with Cairo support then the CMake variable FLTK_INCLUDE_DIRECTORIES
now includes the required Cairo include directories.
2021-12-20 19:18:38 +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