Commit Graph

23 Commits

Author SHA1 Message Date
Albrecht Schlosser 0771bc6cee CMake: improve formatting, remove debug statements 2024-02-13 15:10:06 +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 007e37d897 Ensure that exporting 'fl_disable_wayland' works
... with cmake_minimum_required(VERSION 3.4) or higher. This version
sets CMP0065 to 'NEW' which by default inhibits exporting global
symbols from executable programs.

For details see CMake policy CMP0065 and README.Wayland.txt.
2023-12-21 19:13:49 +01:00
Albrecht Schlosser e8ad00d9fe CMake/Windows/MSVC: add DLL path as target property
This modifies the debug environment so demo programs linked to FLTK
DLL's can be debugged w/o copying FLTK DLL's to the build folders
of the demo programs.

This is work in progress and may be improved in a future commit but
it works as it is now for all demo programs.
2023-11-25 20:53:46 +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 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 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
Matthias Melcher edf7510dda
Make building Fluid optional. (#539) 2022-11-13 20:16:54 +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 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
ManoloFLTK b027d2ba57 Windows platform: use GDI+ to antialias oblique lines and curves. 2021-05-31 08:28:06 +02:00
Albrecht Schlosser 773467dee4 Refactor macOS bundle generation to avoid "quarantine"
macOS Big Sur 11.3 introduced a new "security feature" such that
app bundles created from existing bundle templates in downloaded
files (tar distibutions, expanded) could no longer be executed
without unsetting the "quarantine" attribute. This commit fixes
this by creating all bundles from scratch.

Known *workaround* for older tarballs and snapshots:

  $ xattr -d -r com.apple.quarantine xxx.app
2021-05-13 16:18:13 +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 2555e3b37e Fix build with Cairo for CMake < 3.13
target_link_directories() was introduced in CMake 3.13
2021-04-30 12:46:58 +02:00
Albrecht Schlosser 1e2137668a Fix CMake warning 2021-04-08 15:51:05 +02:00
Albrecht Schlosser 02dfdd590d Fix macOS bundle: set missing fields for test apps
- MACOSX_BUNDLE_BUNDLE_NAME: CFBundleName
 - MACOSX_BUNDLE_GUI_IDENTIFIER: CFBundleIdentifier

test/demo.cxx: Remove confusing quotes from demo variable output.
2021-04-08 13:50:32 +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
Albrecht Schlosser 2f26170a2a macOS: don't create bundles when using X11 2020-08-26 12:46:00 +02:00
Albrecht Schlosser fcd5239adc CMake: Fix macOS bundle wrapper generation
Now bundle wrapper scripts are created in the particular build folder,
i.e. in subdir 'Debug', 'Release' etc. in multi config builds (Xcode).
To do this, the scripts are now copied whenever the target is built
and not during the configuration phase.

To do: "install" wrapper scripts.
2020-08-18 16:23:25 +02:00
Albrecht Schlosser 332003cd13 Create macOS "bundle wrapper" scripts (#115)
These scripts must be installed side by side with the bundle with the
same name and run the executable inside the bundle when executed.
2020-07-23 02:07:43 +02:00
Albrecht Schlosser 4858882e1e CMake: simplify create_example macro
- move target (demo) specific code from macro to CMakeLists.txt
- refactor macOS specific code for a cleaner structure
- improve documentation

Note: CMake ignores platform specific code like creating bundles on
other platforms, hence the entire code could be simplified (less
conditional code)
2020-07-20 11:02:01 +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