Commit Graph

81 Commits

Author SHA1 Message Date
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
Albrecht Schlosser f09e17c3c5 Remove $Id$ tags, update URL's, and more
- remove obsolete svn '$Id$' tags from all source files
- update .fl files and generated files accordingly
- replace 'http://www.fltk.org' URL's with 'https://...'
- replace bug report URL 'str.php' with 'bugs.php'
- remove trailing whitespace
- fix other whitespace errors flagged by Git
- add and/or fix missing or wrong standard headers
- convert tabs to spaces in all source files

The only relevant code changes are in the fluid/ folder where
some .fl files and other source files were used to generate
the '$Id' headers and footers.
2020-07-06 20:28:20 +02:00
Matthias Melcher 563baced13 Android CMake: fix, more autogenerated files
Fixed a bug that would cause an error is Android Build was NOT
defined. Creating list of test targets automatically.
2019-01-16 02:12:29 +01:00
Matthias Melcher b450cea7e2 Android: starting to use CMake to build AndroidStudio files. 2019-01-15 01:22:18 +01:00
Matthias Melcher e25511131b Android: modifying CMake to also create AndroidStudio IDE 2019-01-14 23:27:34 +01:00
Matthias Melcher 42555053a1 More Android changes.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12699 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-03-02 20:03:04 +00:00
Albrecht Schlosser c7b5d61eb0 CMake: add macro fl_debug_var to debug variables.
Some debug messages are included, but currently disabled.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12658 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-09 20:51:15 +00:00
Albrecht Schlosser 7aef0cad39 CMake: enable building FLTK in a subdirectory of another project.
Basically replace CMAKE_XXX_DIR with CMAKE_CURRENT_XXX_DIR where
XXX = SOURCE or BINARY.

Patch proposal by cleanrock, FLTK PR #4:
https://github.com/fltk/test-only/pull/4

Patch modified to fix target dirs for test programs and doxygen docs.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12630 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-01-10 20:49:03 +00:00
Albrecht Schlosser 3eb6b7ea58 CMake: replace improperly used variables with correct ones.
CMake variables FLTK_SOURCE_DIR and FLTK_BINARY_DIR are only defined
if the project name is exactly "FLTK" (all uppercase). These variables
are generated (set) by CMake as <PROJECT_NAME>_SOURCE_DIR etc.

The correct variables are CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR,
respectively, which are always defined.

This commit enables future changes of the FLTK project name, e.g. to
"fltk" or "fltk-1.4.0" (a versioned project name), if we like...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12281 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-06-29 17:51:27 +00:00
Albrecht Schlosser 92d3e1e03a Update minimum required CMake version from 2.6 to 2.6.3.
Verified build with CMake 2.6.3 (failed with 2.6.2).

We need 2.6.3 for "unset" (unknown command in 2.6.2 and earlier).

CMake 2.6.2 also fails when parsing nested brackets in logical
expressions like the following one:

  if((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11397 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-22 00:23:25 +00:00
Albrecht Schlosser 9adb181156 Make FL_ABI_VERSION configurable (STR #3161).
This commit adds the configure option --with-abiversion and the CMake option
OPTION_ABI_VERSION. Both options can be set e.g. to 10304 to build with
FL_ABI_VERSION = 10304 (FLTK 1.3.4).

For IDE builds there are new files ide/<IDE-NAME>/FL/abi-version.h that
can be edited to change the ABI version before the FLTK lib is built.
Note that this file MUST be copied to the include/FL directory if the
IDE-built library is to be installed.

The default is FL_ABI_VERSION = FL_MAJOR*10000 + FL_MINOR*100 + 0, i.e.
10300 for all FLTK 1.3.x versions to keep binary compatibility (ABI).

Todo: more tests and more documentation.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10786 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-07-12 19:23:55 +00:00
Albrecht Schlosser e23bf0b768 [CMake] Fix CMake build's fltk-config (STR #3217).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10716 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-04-25 13:50:27 +00:00
Albrecht Schlosser 6390a0e09e [CMake] Improve installation, support DESTDIR, and more (STR #3149).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-02-16 14:30:27 +00:00
Albrecht Schlosser 078df04bfd CMake: Prevent annoying warning under Cygwin.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10368 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-10-09 16:03:56 +00:00
Albrecht Schlosser 318c3619dc CMake enhancements, as discussed in STR #3055.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10342 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-09-27 00:41:06 +00:00
Albrecht Schlosser f352740953 Split CMake files for better maintenance, as discussed in fltk.general.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10098 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-02-09 18:41:29 +00:00
Albrecht Schlosser 1396a79651 CMake/MinGW: Fix missing -pthread linker option for MinGW build.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10092 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-02-02 00:49:50 +00:00
Albrecht Schlosser c92e58fdac CMake: Fix linker issues on OS X and Arch Linux (STR #3045).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10091 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-02-02 00:41:01 +00:00