Commit Graph

47 Commits

Author SHA1 Message Date
ManoloFLTK
1da9438a1c CMake: replace check_function_exists() with check_symbol_exists() (#1053) 2024-08-31 16:59:03 +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
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
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
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
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
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
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
ManoloFLTK
ad96df9e93 Wayland under FreeBSD: detect <GL/glu.h> and fix LIBDECOR_PLUGIN_DIR. 2022-05-21 07:55:03 +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
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
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
84cf249482 Fix for issue #253: Remove xdbe support 2021-11-26 15:01:54 +01:00
Albrecht Schlosser
c6eccf6137 Call pthread's recursive mutex on Linux (Issue #245)
Add CMake test for PTHREAD_MUTEX_RECURSIVE

Add autoconf/configure compile test for PTHREAD_MUTEX_RECURSIVE

Replace "#ifdef PTHREAD_MUTEX_RECURSIVE"
   with "#ifdef HAVE_PTHREAD_MUTEX_RECURSIVE"
and define HAVE_PTHREAD_MUTEX_RECURSIVE in config.h
2021-07-21 12:16:20 +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
d94496582c Towards construction of fltk-config by CMake under macOS (WIP). 2020-08-25 18:41:43 +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
Albrecht Schlosser
7d1488507d CMake: Fix fltk-config for Windows and Unix/Linux.
This update ought to work with

  fltk-config [--use-images] [--use-gl] --compile <c source file>

on both Windows and Unix/Linux when built with CMake. It was tested
under Windows and Linux using fltk-config directly from the build tree,
but it should work as well after installation.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12686 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-02-23 19:41:52 +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
90f6c8ee26 Update copyright year(s).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12282 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-06-29 18:12:57 +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
54596de1c3 [CMake] Fix Visual Studio header detection.
This commit fixes a CMake issue if CMake is invoked from a desktop icon
or the Windows menu, i.e. not within the correct environment to find all
required header files.

We recommend to run CMake from a "Developer Command Prompt for Visual Studio X",
but sometimes users click on their desktop icon and run CMake without the
correct context. In this case some header files in the Windows SDK's are not
found by CMake.

The solution is to issue a warning and "fix" the header detection by faking
that the headers were found, because they are always available in Visual
Studio. The affected headers <locale.h> and <GL/glu.h> were set to "found"
in the bundles IDE's in FLTK 1.3 as well, so there should be no issue with
this fix.

It is also recommended by the CMake folks, i.e. they suggest not to search
for these special header files that are known to exist always.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12209 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-03-17 17:42:50 +00:00
Albrecht Schlosser
83b5df04fb [CMake] Remove unused header test HAVE_GL_GL_H (GL/gl.h).
Note: the test for OpenGL works slightly different with CMake vs. configure.

The CMake (cache) variable HAVE_GL_GL_H was never used.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12203 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-03-17 15:59:07 +00:00
Albrecht Schlosser
307dd033f0 [CMake] Rewrite pthreads checks for compatibility with configure.
Main point: pthreads must not be checked under Windows (e.g. MinGW)
since Windows always uses native Windows threads (unless Cygwin is used).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12138 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-12-06 19:20:34 +00:00
Albrecht Schlosser
78d853891c [CMake] Fix Windows dll build with Visual Studio generator.
Now you can set OPTION_BUILD_SHARED_LIBS:BOOL=ON to build FLTK dll's with
Visual Studio. Tested and works (Visual Studio 2010 + 2015).

Note: Linux fixes included, tested and works (Ubuntu).

Todo: dll names and target directories may need some changes.
We really need to get rid of that "_SHARED" suffix in .so names.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11867 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-09 14:11:42 +00:00
Manolo Gouy
68cf00ee09 THE best way to test for availability of dlsym().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11779 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-06-14 05:19:32 +00:00
Albrecht Schlosser
1f81808b10 [CMake] Fix restoration of CMAKE_REQUIRED_LIBRARIES.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11777 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-06-13 22:32:01 +00:00
Manolo Gouy
dc2fd2befc Fix cases where function dlysym() is not in library libdl.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-06-13 12:29:54 +00:00
Albrecht Schlosser
3beb45165a [CMake] config.h, part 2 - full compatibility with autoconf.
This commit makes the file config.h generated by CMake 100% compatible
with the one generated by autoconf/configure.

Fixes in this commit:
 - Set FLTK_DATADIR and FLTK_DOCDIR with the same default values.
   Note: needs some cleanup, option values are not clear, '/fltk'
   is currently appended in export.cmake (needs improvement).
 - Simulation of autoconf macro AC_HEADER_DIRENT for correct
   definition of only one 'dirent' header file.
 - Fix more function checks:
    - dlsym
    - png_get_valid
    - png_set_tRNS_to_alpha
 - Improve "Big Endian" check for __APPLE__ (mac_endianness.h).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10985 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-30 21:13:07 +00:00
Albrecht Schlosser
4f5e6e7732 Harmonize configure and CMake build system (part 1).
The files "config.h" generated by configure and CMake are now almost
identical, except a few comments and some still missing or failing
config tests, for instance checks for some functions in libraries.
[Note: tested and compared on Linux.]

configh.cmake.in: Fixed many #cmakedefine and #cmakedefine01 statements
  so they #define their variables as 0 or 1, or /* #undef */ it, resp.,
  as it is done in the configure build.

Added tests:
  - libXrender

Fixed tests:
  - function glXGetProcAddressARB

Todo (still failing tests in CMake):
  - HAVE_PNG_GET_VALID
  - HAVE_PNG_SET_TRNS_TO_ALPHA
  - HAVE_DLSYM

Other remaining issues:
  - compiler flags introduced in configure/make build
  - HAVE_SYS_NDIR_H - maybe missing test in configure ?
  - HAVE_SYS_DIR_H  - maybe missing test in configure ?
  - HAVE_NDIR_H     - maybe missing test in configure ?
  - WORDS_BIGENDIAN and #include <mac_endianness.h> ...
    i.e. Mac OS X specific #include needed or not ?



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10984 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-30 14:37:35 +00:00
Albrecht Schlosser
17c4817592 Add configure and CMake checks for X11/Xregion.h.
Configure and CMake now both check if X11/Xregion.h exists on the
build system and set HAVE_X11_XREGION_H in config.h accordingly.

src/Fl_Pixmap.cxx: modified to use the configure test as proposed by Manolo
in fltk.coredev on Dec 13 2015 in thread "Using X11 backend on OS X".


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10983 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-12-30 12:10:15 +00:00
Albrecht Schlosser
5f3f1c8bc6 [CMake] Add doxygen documentation generation (STR #3195).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10720 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2015-04-25 21:42:51 +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
fd4784a340 Set correct svn properties on CMake files.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10466 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2014-11-22 00:42:44 +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