Commit Graph

269 Commits

Author SHA1 Message Date
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
Jordan Williams 5417ea5f1f
CMake: Use imported targets for PkgConfig packages (#954)
This carries include directories and the required link flags.
Several libraries brought in through pkg_check_modules aren't linked correctly using the _LDFLAGS variables.
Instead, they link the libraries directly with `-l`.
This is problematic because it doesn't properly pull in the actual directory of the library being linked when it is not in a system library directory.
Likewise, the necessary include directories for several of these targets aren't properly set either.
Linking against the imported targets automatically pulls in the necessary include directories.
2024-04-14 19:07:15 +02:00
Jordan Williams a6651e10ff
CMake: Improve detection of the GLU library and GL/glu.h header file (#953)
* CMake: Improve detection of the GLU library and GL/glu.h header file

Locate the GLU library and header independent of the GL library and header locations.
Add the GLU header location to necessary target_include_directory calls.

* CMake: Locate and use the GL include directory

Find the GL include directory and use it in target_include_directories calls.
2024-04-12 15:58:57 +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
Albrecht Schlosser 2f1b8fc726 CMake: Fix detection of trunc() for Windows 2024-04-05 18:45:59 +02:00
Albrecht Schlosser e5c4c1415b Add replacement for potentially missing trunc() (#944)
- add configure + CMake checks to define HAVE_TRUNC in config.h

- src/Fl_Timeout.cxx: add local replacement function
2024-04-02 16:03:29 +02:00
ManoloFLTK 4742d830be CMake for macOS platform: improve handling of -framework link arguments 2024-03-24 08:48:45 +01:00
ManoloFLTK 97d2836f5e macOS: remove deprecated use of property allowedFileTypes in class NSSavePanel
The recommended replacement requires macos ≥ 11.0 and a new framework: UniformTypeIdentifiers
2024-03-23 17:16:57 +01:00
Albrecht Schlosser a5bad9a395 CMake: formatting only 2024-03-18 22:44:53 +01:00
Albrecht Schlosser d3a3ab40b7 Replace setenv() with putenv() on old systems (+937)
Add system check for setenv() function in configure and CMake.
2024-03-18 22:29:50 +01:00
ManoloFLTK 82bd0b6652 Have FLTK use libdecor at version > 0.2.2
- it's no longer necessary to take care of the change in the layout of "struct libdecor"
between versions ≤ 0.2.2 and > 0.2.2 of libdecor
- version > 0.2.2 contains MR131, that is, it defines LIBDECOR_WINDOW_STATE_RESIZING
so the hack to emulate it is no longer  necessary
- CMake option FLTK_USE_SYSTEM_LIBDECOR now requires libdecor version > 0.2.2
to be activated, otherwise the bundled libdecor is used
- what will be the libdecor version after 0.2.2 (0.2.3? 0.3.0?) is not known as of today
2024-03-15 12:21:38 +01:00
ManoloFLTK 7e12981abd To support difference in struct libdecor between built-in and system
That should disappear when next version of libdecor will be released.
2024-03-13 18:53:48 +01:00
ManoloFLTK 3fafeb9ea1 Remove useless X11 libraries when building with -DFLTK_BACKEND_X11=0 2024-03-13 14:57:38 +01:00
ManoloFLTK 40aa9c8609 Allow CMake-based build with -DFLTK_BACKEND_X11=0 under Linux/Unix 2024-03-13 09:06:10 +01:00
Albrecht Schlosser 77c726c79c CMake/macOS/X11: fix "FINK" search directories
note: use only if found.

Todo: check if we can get rid of explicit directory names like /opt/sw,
  /sw, /opt/X11, ...
2024-02-24 19:20:22 +01:00
Albrecht Schlosser a6dc84ac83 Fix CMake code that should only be evaluated on macOS
Too much simplified code when introducing modern CMake and renaming
some build options caused this issue. It's hopefully fixed nor, or
at least improved.

Todo: the code in question needs to be revised anyway.
2024-02-22 19:42:57 +01:00
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 b282ee0335 CMake: remove unintended debug output 2024-02-14 17:51:51 +01:00
Albrecht Schlosser 7992b0b9ab CMake: fix installation on macOS
fluid and fltk-options are now installed correctly as bundles and as
stand-alone executables side by side in the 'bin' folder relative
to CMAKE_INSTALL_PREFIX.

This works but the installation folders may be changed in the future.

Targets fltk::fluid is now exported correctly so

  find_package(FLTK CONFIG ...)

works with both the build folder and an installed version.
2024-02-14 17:06:10 +01:00
Albrecht Schlosser cd3cb62770 CMake: simplify resources.cmake
Note: CheckIncludeFiles caches the result in an 'internal' variable.
Hence mark_as_advanced() is not necessary for these variables.
2024-02-13 16:15:46 +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 f4af40fe55 Modern CMake: export shared libraries and fltk-options 2024-02-10 14:19:09 +01:00
Albrecht Schlosser 809ceea075 Fix Cairo related build issues (missing Cairo lib)
... particularly for shared libs
2024-02-09 19:41:45 +01:00