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.
This commit is contained in:
Albrecht Schlosser
2023-03-09 13:21:49 +02:00
parent e32d4bcab9
commit 5175192755
23 changed files with 444 additions and 170 deletions
+16 -7
View File
@@ -1,8 +1,8 @@
#
# CAIRO library makefile for the Fast Light Toolkit (FLTK).
# Dummy Cairo Library Makefile for the Fast Light Toolkit (FLTK).
#
# Copyright 1997-2009 by Easy Software Products.
# Copyright 2010-2021 by Bill Spitzak and others.
# Copyright 2010-2023 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@@ -15,6 +15,15 @@
# https://www.fltk.org/bugs.php
#
########################################################################
# Note: since FLTK 1.4.0 Fl_Cairo_Window support [1] is included in
# libfltk and libfltk_cairo is no longer necessary. This directory is
# used to build an "empty" dummy library for backwards compatibility,
# just in case users expect it to exist.
# ----------------------------------------------------------------------
# The entire 'cairo' folder will be removed in a later FLTK release.
########################################################################
# Note: see ../configure.in and/or ../makeinclude for definition of
# FL_VERSION (x.y.z), FL_ABI_VERSION (x.y.0), and FL_DSO_VERSION (x.y)
@@ -24,8 +33,8 @@ include ../makeinclude
#
# Object files...
#
CAIROCPPFILES = Fl_Cairo.cxx
CAIROOBJECTS = $(CAIROCPPFILES:.cxx=.o)
CAIROCFILES = cairo_dummy.c
CAIROOBJECTS = $(CAIROCFILES:.c=.o)
#
# Make all of the targets...
@@ -89,7 +98,7 @@ mgwfltknox_cairo-$(FL_DSO_VERSION).dll: $(CAIROLIBNAME) ../src/mgwfltknox-$(FL_D
clean:
-$(RM) *.o *.dll.a core.* *~ *.bak *.bck
-$(RM) $(CAIROOBJECTS) $(CAIROLIBNAME) $(CAIRODSONAME) \
libfltk_cairo.so src/libfltk_cairo.sl src/libfltk_cairo.dylib
libfltk_cairo.so src/libfltk_cairo.sl src/libfltk_cairo.dylib
#
# Install everything...
@@ -163,8 +172,8 @@ uninstall:
$(CAIROOBJECTS): ../makeinclude
depend: $(CAIROCPPFILES)
makedepend -Y -I.. -f makedepend -w 20 $(CAIROCPPFILES)
depend: $(CAIROCFILES)
makedepend -Y -I.. -f makedepend -w 20 $(CAIROCFILES)
echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > makedepend.tmp
echo "" >> makedepend.tmp
grep '^[a-zA-Z]' makedepend | ( LC_ALL=C sort -u -f >> makedepend.tmp; )