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

View File

@ -1,8 +1,8 @@
# #
# A macro used by the CMake build system for the Fast Light Tool Kit (FLTK). # A function used by the CMake build system for the Fast Light Tool Kit (FLTK).
# Written by Michael Surette # Originally written by Michael Surette
# #
# Copyright 1998-2020 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # 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 # the file "COPYING" which should have been included with this file. If this
@ -17,7 +17,7 @@
################################################################################ ################################################################################
# #
# macro CREATE_EXAMPLE - Create a test/demo (example) program # function CREATE_EXAMPLE - Create a test/demo (example) program
# #
# Input: # Input:
# #
@ -119,13 +119,13 @@ function (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAME ${NAME}) set_target_properties (${TARGET_NAME} PROPERTIES OUTPUT_NAME ${NAME})
target_link_libraries (${TARGET_NAME} ${LIBRARIES}) target_link_libraries (${TARGET_NAME} ${LIBRARIES})
# we must link all programs with fltk_cairo if option CAIROEXT is enabled # we must link all programs with cairo if option CAIROEXT is enabled
if (FLTK_HAVE_CAIROEXT) if (FLTK_HAVE_CAIROEXT)
target_link_libraries (${TARGET_NAME} fltk_cairo cairo) target_link_libraries (${TARGET_NAME} ${PKG_CAIRO_LIBRARIES})
endif () endif ()
if (FLTK_HAVE_CAIRO) if (FLTK_HAVE_CAIRO AND PKG_CAIRO_LIBRARY_DIRS)
fl_target_link_directories (${TARGET_NAME} PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}") fl_target_link_directories (${TARGET_NAME} PUBLIC ${PKG_CAIRO_LIBRARY_DIRS})
endif () endif ()
if (USE_GDIPLUS) # can only be true on Windows if (USE_GDIPLUS) # can only be true on Windows

View File

@ -412,19 +412,8 @@ if (OPTION_CAIRO OR OPTION_CAIROEXT)
if (OPTION_CAIROEXT) if (OPTION_CAIROEXT)
set (FLTK_HAVE_CAIROEXT 1) set (FLTK_HAVE_CAIROEXT 1)
endif (OPTION_CAIROEXT) endif (OPTION_CAIROEXT)
add_subdirectory (cairo)
if (0)
fl_debug_var (PKG_CAIRO_INCLUDE_DIRS)
fl_debug_var (PKG_CAIRO_CFLAGS)
fl_debug_var (PKG_CAIRO_LIBRARIES)
fl_debug_var (PKG_CAIRO_LIBRARY_DIRS)
fl_debug_var (PKG_CAIRO_STATIC_INCLUDE_DIRS)
fl_debug_var (PKG_CAIRO_STATIC_CFLAGS)
fl_debug_var (PKG_CAIRO_STATIC_LIBRARIES)
fl_debug_var (PKG_CAIRO_STATIC_LIBRARY_DIRS)
endif()
### FIXME ###
include_directories (${PKG_CAIRO_INCLUDE_DIRS}) include_directories (${PKG_CAIRO_INCLUDE_DIRS})
# Cairo libs and flags for fltk-config # Cairo libs and flags for fltk-config
@ -442,16 +431,67 @@ if (OPTION_CAIRO OR OPTION_CAIROEXT)
string (REPLACE ";" " " CAIROLIBS "${CAIROLIBS}") string (REPLACE ";" " " CAIROLIBS "${CAIROLIBS}")
string (REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") string (REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}")
# fl_debug_var (FLTK_LDLIBS) else (PKG_CAIRO_FOUND)
# fl_debug_var (CAIROFLAGS)
# fl_debug_var (CAIROLIBS) if (NOT MSVC)
message (STATUS "*** Cairo was requested but not found - please check your cairo installation")
message (STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.")
message (FATAL_ERROR "*** Terminating: missing Cairo libs or headers.")
endif ()
# Tweak Cairo includes / libs / paths for Visual Studio (TEMPORARY solution).
# Todo: find a better way to set the required variables and flags!
# AlbrechtS 03/2023
message (STATUS "--- Cairo not found: trying to find Cairo for MSVC ...")
if (NOT FLTK_CAIRO_DIR)
message (STATUS "--- Please set FLTK_CAIRO_DIR to point at the Cairo installation folder ...")
message (STATUS " ... with files 'include/cairo.h' and 'lib/x64/cairo.lib'")
message (STATUS "--- Example: cmake -DFLTK_CAIRO_DIR=\"C:/cairo-windows\" ...")
message (STATUS "--- Note: this will be changed in the future; currently only 64-bit supported")
message (FATAL_ERROR "*** Terminating: missing Cairo libs or headers.")
endif ()
set (CAIROLIBS "-lcairo") # should be correct: needs cairo.lib
# simulate results of 'pkg_search_module (PKG_CAIRO cairo)' and more (above)
# these variables will be used later
set (PKG_CAIRO_LIBRARIES "cairo")
set (PKG_CAIRO_INCLUDE_DIRS "${FLTK_CAIRO_DIR}/include")
set (PKG_CAIRO_LIBRARY_DIRS "${FLTK_CAIRO_DIR}/lib/x64/")
### FIXME ###
include_directories (${PKG_CAIRO_INCLUDE_DIRS})
set (FLTK_HAVE_CAIRO 1)
if (OPTION_CAIROEXT)
set (FLTK_HAVE_CAIROEXT 1)
endif (OPTION_CAIROEXT)
else ()
message (STATUS "*** Cairo was requested but not found - please check your cairo installation")
message (STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.")
message (FATAL_ERROR "*** Terminating: missing Cairo libs or headers.")
endif (PKG_CAIRO_FOUND) endif (PKG_CAIRO_FOUND)
if (0) # 1 = DEBUG, 0 = no output
message (STATUS "--- options.cmake: Cairo related variables ---")
if (MSVC)
fl_debug_var (FLTK_CAIRO_DIR)
endif (MSVC)
fl_debug_var (PKG_CAIRO_INCLUDE_DIRS)
fl_debug_var (PKG_CAIRO_CFLAGS)
fl_debug_var (PKG_CAIRO_LIBRARIES)
fl_debug_var (PKG_CAIRO_LIBRARY_DIRS)
fl_debug_var (PKG_CAIRO_STATIC_INCLUDE_DIRS)
fl_debug_var (PKG_CAIRO_STATIC_CFLAGS)
fl_debug_var (PKG_CAIRO_STATIC_LIBRARIES)
fl_debug_var (PKG_CAIRO_STATIC_LIBRARY_DIRS)
message (STATUS "--- fltk-config/Cairo variables ---")
fl_debug_var (FLTK_LDLIBS)
fl_debug_var (CAIROFLAGS)
fl_debug_var (CAIROLIBS)
message (STATUS "--- End of Cairo related variables ---")
endif() # 1 = DEBUG, ...
endif (OPTION_CAIRO OR OPTION_CAIROEXT) endif (OPTION_CAIRO OR OPTION_CAIROEXT)
####################################################################### #######################################################################

View File

@ -102,7 +102,17 @@ endif (debug_build)
unset (debug_build) unset (debug_build)
####################################################################### #######################################################################
# build the FLTK libraries # Build a dummy ("empty") Cairo library for backwards compatibility.
# This should be removed some time after 1.4.0 was released, maybe
# in FLTK 1.4.1, 1.4.2, 1.5.0, or whatever the next minor release is.
#######################################################################
if (FLTK_HAVE_CAIRO)
add_subdirectory (cairo)
endif ()
#######################################################################
# build the standard FLTK libraries
####################################################################### #######################################################################
add_subdirectory(src) add_subdirectory(src)
@ -129,11 +139,13 @@ endif (FLTK_BUILD_FLTK_OPTIONS)
# install.cmake creates these files for an installed FLTK # install.cmake creates these files for an installed FLTK
# these two would only differ in paths, so common variables are set here # these two would only differ in paths, so common variables are set here
####################################################################### #######################################################################
include (CMake/variables.cmake) include (CMake/variables.cmake)
####################################################################### #######################################################################
# final config and export # final config and export
####################################################################### #######################################################################
include (CMake/export.cmake) include (CMake/export.cmake)
configure_file ( configure_file (
@ -157,6 +169,7 @@ endif (FLTK_BUILD_EXAMPLES)
####################################################################### #######################################################################
# installation # installation
####################################################################### #######################################################################
include (CMake/install.cmake) include (CMake/install.cmake)
####################################################################### #######################################################################
@ -221,15 +234,15 @@ else ()
endif () endif ()
if (FLTK_BUILD_FLUID) if (FLTK_BUILD_FLUID)
message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid") message (STATUS "FLUID will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fluid")
else () else ()
message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)") message (STATUS "FLUID will not be built (set FLTK_BUILD_FLUID=ON to build)")
endif () endif ()
if (FLTK_BUILD_FLTK_OPTIONS) if (FLTK_BUILD_FLTK_OPTIONS)
message (STATUS "fltk-options will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-options") message (STATUS "fltk-options will be built in ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-options")
else () else ()
message (STATUS "fltk-options will not be built (set FLTK_BUILD_FLTK_OPTIONS=ON to build)") message (STATUS "fltk-options will not be built (set FLTK_BUILD_FLTK_OPTIONS=ON to build)")
endif () endif ()
if (FLTK_BUILD_TEST) if (FLTK_BUILD_TEST)
@ -243,21 +256,21 @@ else ()
endif () endif ()
if (FLTK_USE_BUILTIN_JPEG) if (FLTK_USE_BUILTIN_JPEG)
message (STATUS "Image Libraries: JPEG = Builtin") message (STATUS "Image Libraries: JPEG = Builtin")
else () else ()
message (STATUS "Image Libraries: JPEG = System") message (STATUS "Image Libraries: JPEG = System")
endif () endif ()
if (FLTK_USE_BUILTIN_PNG) if (FLTK_USE_BUILTIN_PNG)
message (STATUS " PNG = Builtin") message (STATUS " PNG = Builtin")
else () else ()
message (STATUS " PNG = System") message (STATUS " PNG = System")
endif () endif ()
if (FLTK_USE_BUILTIN_ZLIB) if (FLTK_USE_BUILTIN_ZLIB)
message (STATUS " ZLIB = Builtin") message (STATUS " ZLIB = Builtin")
else () else ()
message (STATUS " ZLIB = System") message (STATUS " ZLIB = System")
endif () endif ()
if (UNIX AND NOT (APPLE AND NOT OPTION_APPLE_X11)) if (UNIX AND NOT (APPLE AND NOT OPTION_APPLE_X11))

View File

@ -1,7 +1,7 @@
// //
// Main header file for the Fast Light Tool Kit (FLTK). // Main Cairo header file for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2021 by Bill Spitzak and others. // Copyright 1998-2022 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // 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 // the file "COPYING" which should have been included with this file. If this
@ -14,74 +14,88 @@
// https://www.fltk.org/bugs.php // https://www.fltk.org/bugs.php
// //
/* \file /** \file Fl_Cairo.H
Handling transparently platform dependent cairo include files Cairo is currently supported for the following platforms:
Windows, macOS, Unix/Linux (X11 + Wayland).
\note In FLTK 1.3.x this header file (Fl_Cairo.H) included the platform
specific Cairo headers. This is no longer true since 1.4.0.
This header file is platform agnostic. If you need platform specific Cairo
headers you need to #include them in your source file.
To use FLTK's builtin Cairo support you need to <tt>\#include \<FL/Fl.H></tt>
\b before you include any other FLTK header which is officially required anyway.
Since FLTK 1.4.0 the preprocessor constants \p FLTK_HAVE_CAIRO and/or
\p FLTK_HAVE_CAIROEXT are defined in \<FL/Fl.H> by including \<FL/fl_config.h>.
*/ */
#ifndef FL_CAIRO_H #ifndef FL_CAIRO_H
# define FL_CAIRO_H #define FL_CAIRO_H
# include <FL/fl_config.h> // build configuration #include <FL/Fl.H>
# ifdef FLTK_HAVE_CAIRO # ifdef FLTK_HAVE_CAIRO
// Cairo is currently supported for the following platforms:
// Win32, Apple Quartz, X11
# include <FL/Fl_Export.H>
# include <cairo.h> # include <cairo.h>
/** /**
\addtogroup group_cairo \addtogroup group_cairo
@{ @{
*/ */
/** /**
Contains all the necessary info on the current cairo context. Contains all the necessary info on the current cairo context.
A private internal & unique corresponding object is created to A private internal & unique corresponding object is created to
permit cairo context state handling while keeping it opaque. permit cairo context state handling while keeping it opaque.
For internal use only. For internal use only.
\note Only available when configure has the --enable-cairo or \note Only available when configure has the --enable-cairo or
--enable-cairoext option or one or both of the CMake options --enable-cairoext option or one or both of the CMake options
OPTION_CAIRO or OPTION_CAIROEXT is set (ON) OPTION_CAIRO or OPTION_CAIROEXT is set (ON)
*/ */
class FL_EXPORT Fl_Cairo_State { class FL_EXPORT Fl_Cairo_State {
public: public:
Fl_Cairo_State() : cc_(0), own_cc_(false), autolink_(false), window_(0), gc_(0) {} Fl_Cairo_State()
: cc_(0)
, own_cc_(false)
, autolink_(false)
, window_(0)
, gc_(0) {}
// access attributes // access attributes
cairo_t* cc() const {return cc_;} ///< Gets the current cairo context cairo_t *cc() const { return cc_; } ///< Gets the current cairo context
bool autolink() const {return autolink_;} ///< Gets the autolink option. See Fl::cairo_autolink_context(bool) bool autolink() const { return autolink_; } ///< Gets the autolink option. See Fl::cairo_autolink_context(bool)
/** Sets the current cairo context. /** Sets the current cairo context.
\p own == \e true (the default) indicates that the cairo context \p c \p own == \e true (the default) indicates that the cairo context \p c
will be deleted by FLTK internally when another cc is set later. will be deleted by FLTK internally when another cc is set later.
\p own == \e false indicates cc deletion is handled externally \p own == \e false indicates cc deletion is handled externally
by the user program. by the user program.
*/ */
void cc(cairo_t* c, bool own=true) { void cc(cairo_t *c, bool own = true) {
if (cc_ && own_cc_) cairo_destroy(cc_); if (cc_ && own_cc_)
cc_=c; cairo_destroy(cc_);
if (!cc_) window_=0; cc_ = c;
own_cc_=own; if (!cc_)
} window_ = 0;
void autolink(bool b); ///< Sets the autolink option, only available with --enable-cairoext own_cc_ = own;
void window(void* w) {window_=w;} ///< Sets the window \p w to keep track on }
void* window() const {return window_;} ///< Gets the last window attached to a cc void autolink(bool b); ///< Sets the autolink option, only available with --enable-cairoext
void gc(void* c) {gc_=c;} ///< Sets the gc \p c to keep track on void window(void *w) { window_ = w; } ///< Sets the window \p w to keep track on
void* gc() const {return gc_;} ///< Gets the last gc attached to a cc void *window() const { return window_; } ///< Gets the last window attached to a cc
void gc(void *c) { gc_ = c; } ///< Sets the gc \p c to keep track on
void *gc() const { return gc_; } ///< Gets the last gc attached to a cc
private: private:
cairo_t * cc_; // contains the unique autoupdated cairo context cairo_t *cc_; // contains the unique autoupdated cairo context
bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup bool own_cc_; // indicates whether we must delete the cc, useful for internal cleanup
bool autolink_; // false by default, prevents the automatic cairo mapping on fltk windows bool autolink_; // false by default, prevents the automatic cairo mapping on fltk windows
// for custom cairo implementations. // for custom cairo implementations.
void* window_, *gc_; // for keeping track internally of last win+gc treated void *window_, *gc_; // for keeping track internally of last win+gc treated
}; };
/** @} */ /** @} */
# endif // FLTK_HAVE_CAIRO #endif // FLTK_HAVE_CAIRO
#endif // FL_CAIRO_H #endif // FL_CAIRO_H

View File

@ -1,7 +1,7 @@
// //
// Cairo Window header file for the Fast Light Tool Kit (FLTK). // Cairo window header file for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2021 by Bill Spitzak and others. // Copyright 1998-2023 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // 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 // the file "COPYING" which should have been included with this file. If this
@ -15,7 +15,7 @@
// //
/* \file /* \file
Fl_Cairo_Window Handling transparently a FLTK window incorporating a cairo draw callback. Fl_Cairo_Window, an FLTK window incorporating a Cairo draw callback.
*/ */
#ifndef FL_CAIRO_WINDOW_H #ifndef FL_CAIRO_WINDOW_H
@ -26,7 +26,7 @@
# ifdef FLTK_HAVE_CAIRO # ifdef FLTK_HAVE_CAIRO
// Cairo is currently supported for the following platforms: // Cairo is currently supported for the following platforms:
// Win32, Apple Quartz, X11 // Win32, Apple Quartz, X11, Wayland
# include <FL/Fl.H> # include <FL/Fl.H>
# include <FL/Fl_Double_Window.H> # include <FL/Fl_Double_Window.H>
@ -36,11 +36,11 @@
*/ */
/** /**
This defines a FLTK window with cairo support. This defines an FLTK window with Cairo support.
This class overloads the virtual draw() method for you, This class overloads the virtual draw() method for you,
so that the only thing you have to do is to provide your cairo code. so that the only thing you have to do is to provide your Cairo code.
All cairo context handling is achieved transparently. All Cairo context handling is achieved transparently.
The default coordinate system for cairo drawing commands within Fl_Cario_Window The default coordinate system for cairo drawing commands within Fl_Cario_Window
is FLTK's coordinate system, where the `x,y,w,h` values are releative to the is FLTK's coordinate system, where the `x,y,w,h` values are releative to the
@ -79,7 +79,7 @@
CMake option OPTION_CAIRO or configure --enable-cairo. CMake option OPTION_CAIRO or configure --enable-cairo.
\note You can alternatively define your custom cairo FLTK window, \note You can alternatively define your custom cairo FLTK window,
and thus at least override the draw() method to provide custom cairo and thus at least override the draw() method to provide custom Cairo
support. In this case you will probably use Fl::cairo_make_current(Fl_Window*) support. In this case you will probably use Fl::cairo_make_current(Fl_Window*)
to attach a context to your window. You should do it only when your window is to attach a context to your window. You should do it only when your window is
the current window. \see Fl_Window::current() the current window. \see Fl_Window::current()
@ -93,7 +93,7 @@ public:
: Fl_Double_Window(X, Y, W, H, L), draw_cb_(0) {} : Fl_Double_Window(X, Y, W, H, L), draw_cb_(0) {}
protected: protected:
/** Overloaded to provide cairo callback support */ /** Overloaded to provide Cairo callback support */
void draw() FL_OVERRIDE { void draw() FL_OVERRIDE {
Fl_Double_Window::draw(); Fl_Double_Window::draw();
if (draw_cb_) { // call the Cairo draw callback if (draw_cb_) { // call the Cairo draw callback
@ -101,18 +101,19 @@ protected:
if (!Fl::cairo_autolink_context()) if (!Fl::cairo_autolink_context())
Fl::cairo_make_current(this); Fl::cairo_make_current(this);
draw_cb_(this, Fl::cairo_cc()); draw_cb_(this, Fl::cairo_cc());
// flush cairo drawings: necessary at least for Windows // flush Cairo drawings: necessary at least for Windows
cairo_surface_t *s = cairo_get_target(Fl::cairo_cc()); cairo_surface_t *s = cairo_get_target(Fl::cairo_cc());
cairo_surface_flush(s); cairo_surface_flush(s);
} }
} }
public: public:
/** This defines the cairo draw callback prototype that you must further */ /** The Cairo draw callback prototype you need to implement. */
typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def); typedef void (*cairo_draw_cb) (Fl_Cairo_Window* self, cairo_t* def);
/** /**
You must provide a draw callback which will implement your cairo rendering. You must provide a draw callback that implements your Cairo rendering.
This method will permit you to set your cairo callback to \p cb. This method permits you to set your Cairo callback to \p cb.
*/ */
void set_draw_cb(cairo_draw_cb cb) { draw_cb_ = cb; } void set_draw_cb(cairo_draw_cb cb) { draw_cb_ = cb; }
private: private:

View File

@ -1,7 +1,7 @@
# #
# Top-level Makefile for the Fast Light Tool Kit (FLTK). # Top-level Makefile for the Fast Light Tool Kit (FLTK).
# #
# Copyright 1998-2021 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # 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 # the file "COPYING" which should have been included with this file. If this
@ -113,7 +113,7 @@ native-dist:
epm -v -f native fltk epm -v -f native fltk
etags: etags:
etags FL/*.H FL/*.h src/*.cxx src/*.c src/*.h src/xutf8/*.h src/xutf8/*.c cairo/*.cxx fluid/*.h fluid/*.cxx fltk-options/*.cxx test/*.h test/*.cxx etags FL/*.H FL/*.h src/*.cxx src/*.c src/*.h src/xutf8/*.h src/xutf8/*.c cairo/*.c fluid/*.h fluid/*.cxx test/*.h test/*.cxx
# #
# Run the clang.llvm.org static code analysis tool on the C sources. # Run the clang.llvm.org static code analysis tool on the C sources.

View File

@ -1,22 +1,39 @@
#
# CMakeLists.txt to build a dummy Cairo library for the FLTK project using CMake
#
# Copyright 1998-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
# file is missing or damaged, see the license at:
#
# https://www.fltk.org/COPYING.php
#
# Please see the following page on how to report bugs and issues:
#
# https://www.fltk.org/bugs.php
#
include_directories (${PKG_CAIRO_INCLUDE_DIRS}) ########################################################################
# 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.
########################################################################
# source files for cairo # Build dummy fltk_cairo library
set (cairo_SRCS Fl_Cairo.cxx)
set (cairo_SRCS cairo_dummy.c)
#######################################################################
FL_ADD_LIBRARY (fltk_cairo STATIC "${cairo_SRCS}") FL_ADD_LIBRARY (fltk_cairo STATIC "${cairo_SRCS}")
####################################################################### # Build shared dummy library (optional)
# Build shared library (optional)
#######################################################################
if (OPTION_BUILD_SHARED_LIBS) if (OPTION_BUILD_SHARED_LIBS)
FL_ADD_LIBRARY (fltk_cairo SHARED "${cairo_SRCS}") FL_ADD_LIBRARY (fltk_cairo SHARED "${cairo_SRCS}")
target_link_libraries (fltk_cairo_SHARED fltk_SHARED ${PKG_CAIRO_LIBRARIES}) target_link_libraries (fltk_cairo_SHARED fltk_SHARED)
fl_target_link_directories (fltk_cairo_SHARED PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
endif (OPTION_BUILD_SHARED_LIBS) endif (OPTION_BUILD_SHARED_LIBS)
#######################################################################

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 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 # 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 # the file "COPYING" which should have been included with this file. If this
@ -15,6 +15,15 @@
# https://www.fltk.org/bugs.php # 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 # 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) # 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... # Object files...
# #
CAIROCPPFILES = Fl_Cairo.cxx CAIROCFILES = cairo_dummy.c
CAIROOBJECTS = $(CAIROCPPFILES:.cxx=.o) CAIROOBJECTS = $(CAIROCFILES:.c=.o)
# #
# Make all of the targets... # Make all of the targets...
@ -89,7 +98,7 @@ mgwfltknox_cairo-$(FL_DSO_VERSION).dll: $(CAIROLIBNAME) ../src/mgwfltknox-$(FL_D
clean: clean:
-$(RM) *.o *.dll.a core.* *~ *.bak *.bck -$(RM) *.o *.dll.a core.* *~ *.bak *.bck
-$(RM) $(CAIROOBJECTS) $(CAIROLIBNAME) $(CAIRODSONAME) \ -$(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... # Install everything...
@ -163,8 +172,8 @@ uninstall:
$(CAIROOBJECTS): ../makeinclude $(CAIROOBJECTS): ../makeinclude
depend: $(CAIROCPPFILES) depend: $(CAIROCFILES)
makedepend -Y -I.. -f makedepend -w 20 $(CAIROCPPFILES) makedepend -Y -I.. -f makedepend -w 20 $(CAIROCFILES)
echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > makedepend.tmp echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > makedepend.tmp
echo "" >> makedepend.tmp echo "" >> makedepend.tmp
grep '^[a-zA-Z]' makedepend | ( LC_ALL=C sort -u -f >> makedepend.tmp; ) grep '^[a-zA-Z]' makedepend | ( LC_ALL=C sort -u -f >> makedepend.tmp; )

28
cairo/cairo_dummy.c Normal file
View File

@ -0,0 +1,28 @@
/*
Dummy C file to build the dummy Cairo library for the FLTK project.
Copyright 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
file is missing or damaged, see the license at:
https://www.fltk.org/COPYING.php
Please see the following page on how to report bugs and issues:
https://www.fltk.org/bugs.php
*/
/*
Note: since FLTK 1.4.0 Fl_Cairo_Window support 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.
*/
int fl_cairo_dummy() {
return 0;
}

View File

@ -1,19 +1,2 @@
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
Fl_Cairo.o: ../FL/Enumerations.H
Fl_Cairo.o: ../FL/Fl.H
Fl_Cairo.o: ../FL/fl_attr.h
Fl_Cairo.o: ../FL/Fl_Bitmap.H
Fl_Cairo.o: ../FL/Fl_Cairo.H
Fl_Cairo.o: ../FL/fl_casts.H
Fl_Cairo.o: ../FL/fl_config.h
Fl_Cairo.o: ../FL/Fl_Export.H
Fl_Cairo.o: ../FL/Fl_Group.H
Fl_Cairo.o: ../FL/Fl_Image.H
Fl_Cairo.o: ../FL/fl_types.h
Fl_Cairo.o: ../FL/fl_utf8.h
Fl_Cairo.o: ../FL/Fl_Widget.H
Fl_Cairo.o: ../FL/Fl_Window.H
Fl_Cairo.o: ../FL/platform.H
Fl_Cairo.o: ../FL/platform_types.h
Fl_Cairo.o: ../FL/x11.H

View File

@ -86,7 +86,7 @@ AC_SUBST(OPTIM)
dnl Other options dnl Other options
AC_ARG_ENABLE([cairo], AS_HELP_STRING([--enable-cairo], [add support for Fl_Cairo_Window])) AC_ARG_ENABLE([cairo], AS_HELP_STRING([--enable-cairo], [add support for Fl_Cairo_Window]))
AC_ARG_ENABLE([cairoext], AS_HELP_STRING([--enable-cairoext], [use FLTK code instrumentation for cairo extended use])) AC_ARG_ENABLE([cairoext], AS_HELP_STRING([--enable-cairoext], [use FLTK code instrumentation for Cairo extended use]))
AC_ARG_ENABLE([cp936], AS_HELP_STRING([--enable-cp936], [turn on CP936])) AC_ARG_ENABLE([cp936], AS_HELP_STRING([--enable-cp936], [turn on CP936]))
AS_IF([test x$enable_cp936 = xyes], [ AS_IF([test x$enable_cp936 = xyes], [
@ -235,7 +235,7 @@ AS_IF([test x$enable_cairoext = xyes], [
LIBS="$CAIROLIBS $LIBS" LIBS="$CAIROLIBS $LIBS"
LINKFLTK="$LINKFLTK $LINKFLTKCAIRO" LINKFLTK="$LINKFLTK $LINKFLTKCAIRO"
], [ ], [
AC_MSG_ERROR([Cairo requested but not available.]) AC_MSG_ERROR([Cairo requested but not found.])
]) ])
], [test x$enable_cairo = xyes], [ ], [test x$enable_cairo = xyes], [
AS_IF([$PKGCONFIG --exists cairo], [ AS_IF([$PKGCONFIG --exists cairo], [
@ -247,7 +247,7 @@ AS_IF([test x$enable_cairoext = xyes], [
LINKFLTKCAIRO="../lib/libfltk_cairo.a" LINKFLTKCAIRO="../lib/libfltk_cairo.a"
FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX" FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
], [ ], [
AC_MSG_ERROR([Cairo requested but not available.]) AC_MSG_ERROR([Cairo requested but not found.])
]) ])
]) ])

View File

@ -570,7 +570,6 @@ INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/advanced.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/unicode.dox INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/unicode.dox
INPUT += @FLTK_SOURCE_DIR@/FL INPUT += @FLTK_SOURCE_DIR@/FL
INPUT += @FLTK_SOURCE_DIR@/src INPUT += @FLTK_SOURCE_DIR@/src
INPUT += @FLTK_SOURCE_DIR@/cairo
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/enumerations.dox INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/enumerations.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/glut.dox INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/glut.dox
INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/forms.dox INPUT += @CMAKE_CURRENT_SOURCE_DIR@/src/forms.dox

View File

@ -261,8 +261,8 @@ if test x$use_images = xyes; then
fi fi
if test x$use_cairo = xyes -a $FLTK_HAVE_CAIRO = 1; then if test x$use_cairo = xyes -a $FLTK_HAVE_CAIRO = 1; then
LDLIBS="-lfltk_cairo$SHAREDSUFFIX $CAIROLIBS $LDLIBS" LDLIBS="$CAIROLIBS $LDLIBS"
LDSTATIC="$libdir/libfltk_cairo.a $CAIROLIBS $LDSTATIC" LDSTATIC="$CAIROLIBS $LDSTATIC"
fi fi
LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS" LDLIBS="$DSOLINK $LDFLAGS $libs $LDLIBS"
@ -390,10 +390,6 @@ if test "$echo_libs" = "yes"; then
USELIBS="$libdir/libfltk_gl.a $USELIBS" USELIBS="$libdir/libfltk_gl.a $USELIBS"
fi fi
if test x$use_cairo = xyes; then
USELIBS="$libdir/libfltk_cairo.a $USELIBS"
fi
if test x$use_images = xyes; then if test x$use_images = xyes; then
USELIBS="$libdir/libfltk_images.a $USELIBS" USELIBS="$libdir/libfltk_images.a $USELIBS"

View File

@ -51,11 +51,7 @@ else ()
endif () endif ()
# we must link all programs with fltk_cairo if option CAIROEXT is enabled # we must link fltk-optons with cairo if option CAIRO is enabled
if (FLTK_HAVE_CAIROEXT)
list (APPEND FLTK_OPTIONS_LIBS fltk_cairo cairo)
endif (FLTK_HAVE_CAIROEXT)
if (FLTK_HAVE_CAIRO) if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fltk-options PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}") fl_target_link_directories (fltk-options PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
endif (FLTK_HAVE_CAIRO) endif (FLTK_HAVE_CAIRO)

View File

@ -1,7 +1,7 @@
# #
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org) # CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
# #
# Copyright 1998-2022 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # 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 # the file "COPYING" which should have been included with this file. If this
@ -114,13 +114,12 @@ else ()
endif () endif ()
# we must link all programs with fltk_cairo if option CAIROEXT is enabled # we must link fluid with Cairo if OPTION_CAIRO is enabled
if (FLTK_HAVE_CAIROEXT)
list (APPEND FLUID_LIBS fltk_cairo cairo)
endif (FLTK_HAVE_CAIROEXT)
if (FLTK_HAVE_CAIRO) if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fluid PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}") target_include_directories (fluid PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
if (PKG_CAIRO_LIBRARY_DIRS)
fl_target_link_directories (fluid PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
endif ()
endif (FLTK_HAVE_CAIRO) endif (FLTK_HAVE_CAIRO)
if (USE_GDIPLUS) # can only be true on Windows if (USE_GDIPLUS) # can only be true on Windows
@ -137,11 +136,27 @@ if (WIN32)
list (APPEND FLUID_TARGETS fluid-cmd) list (APPEND FLUID_TARGETS fluid-cmd)
add_executable (fluid-cmd ${CPPFILES} ${HEADERFILES}) add_executable (fluid-cmd ${CPPFILES} ${HEADERFILES})
target_link_libraries (fluid-cmd ${FLUID_LIBS}) target_link_libraries (fluid-cmd ${FLUID_LIBS})
if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fluid-cmd PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
endif (FLTK_HAVE_CAIRO)
endif ()
# we must link fluid-cmd with Cairo if OPTION_CAIRO is enabled (same as above)
if (FLTK_HAVE_CAIRO)
target_include_directories (fluid-cmd PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
if (PKG_CAIRO_LIBRARY_DIRS)
fl_target_link_directories (fluid-cmd PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
endif ()
endif (FLTK_HAVE_CAIRO)
endif (WIN32)
# Build fluid-shared (experimental)
if (OPTION_BUILD_SHARED_LIBS)
list (APPEND FLUID_TARGETS fluid-shared)
add_executable (fluid-shared ${CPPFILES} ${HEADERFILES})
if (MSVC)
target_link_libraries (fluid-shared fltk_SHARED)
else ()
target_link_libraries (fluid-shared fltk_images_SHARED)
endif (MSVC)
endif ()
# install fluid GUI and commandline tool # install fluid GUI and commandline tool
@ -164,7 +179,7 @@ if (APPLE AND (NOT OPTION_APPLE_X11))
# ## set_target_properties (fluid PROPERTIES RESOURCE ${ICON_PATH}) # ## set_target_properties (fluid PROPERTIES RESOURCE ${ICON_PATH})
# install fluid GUI and commandline tools # install fluid GUI and commandline tools
#install (TARGETS fluid DESTINATION "/Applications") # install (TARGETS fluid DESTINATION "/Applications")
# install command line tool # install command line tool
install (PROGRAMS $<TARGET_FILE:fluid> DESTINATION ${FLTK_BINDIR}) install (PROGRAMS $<TARGET_FILE:fluid> DESTINATION ${FLTK_BINDIR})
@ -180,7 +195,7 @@ else()
ARCHIVE DESTINATION ${FLTK_LIBDIR} ARCHIVE DESTINATION ${FLTK_LIBDIR}
) )
endif (APPLE AND (NOT OPTION_APPLE_X11)) endif (APPLE AND (NOT OPTION_APPLE_X11))
# install desktop files # install desktop files

View File

@ -220,6 +220,72 @@ CodeEditor.o: ../FL/Fl_Widget.H
CodeEditor.o: ../FL/platform_types.h CodeEditor.o: ../FL/platform_types.h
CodeEditor.o: CodeEditor.h CodeEditor.o: CodeEditor.h
CodeEditor.o: StyleParse.h CodeEditor.o: StyleParse.h
custom_widgets.o: ../config.h
custom_widgets.o: ../FL/Enumerations.H
custom_widgets.o: ../FL/filename.H
custom_widgets.o: ../FL/Fl.H
custom_widgets.o: ../FL/fl_attr.h
custom_widgets.o: ../FL/Fl_Bitmap.H
custom_widgets.o: ../FL/Fl_Box.H
custom_widgets.o: ../FL/Fl_Browser_.H
custom_widgets.o: ../FL/Fl_Button.H
custom_widgets.o: ../FL/Fl_Cairo.H
custom_widgets.o: ../FL/fl_casts.H
custom_widgets.o: ../FL/Fl_Check_Button.H
custom_widgets.o: ../FL/Fl_Choice.H
custom_widgets.o: ../FL/fl_config.h
custom_widgets.o: ../FL/Fl_Device.H
custom_widgets.o: ../FL/Fl_Double_Window.H
custom_widgets.o: ../FL/fl_draw.H
custom_widgets.o: ../FL/Fl_Export.H
custom_widgets.o: ../FL/Fl_Graphics_Driver.H
custom_widgets.o: ../FL/Fl_Group.H
custom_widgets.o: ../FL/Fl_Image.H
custom_widgets.o: ../FL/Fl_Input.H
custom_widgets.o: ../FL/Fl_Input_.H
custom_widgets.o: ../FL/Fl_Input_Choice.H
custom_widgets.o: ../FL/Fl_Light_Button.H
custom_widgets.o: ../FL/Fl_Menu_.H
custom_widgets.o: ../FL/Fl_Menu_Button.H
custom_widgets.o: ../FL/Fl_Menu_Item.H
custom_widgets.o: ../FL/Fl_Pixmap.H
custom_widgets.o: ../FL/Fl_Plugin.H
custom_widgets.o: ../FL/Fl_Preferences.H
custom_widgets.o: ../FL/Fl_Rect.H
custom_widgets.o: ../FL/Fl_Return_Button.H
custom_widgets.o: ../FL/Fl_RGB_Image.H
custom_widgets.o: ../FL/Fl_Scrollbar.H
custom_widgets.o: ../FL/Fl_Shortcut_Button.H
custom_widgets.o: ../FL/Fl_Slider.H
custom_widgets.o: ../FL/Fl_String.H
custom_widgets.o: ../FL/fl_string_functions.h
custom_widgets.o: ../FL/Fl_Tabs.H
custom_widgets.o: ../FL/Fl_Text_Buffer.H
custom_widgets.o: ../FL/Fl_Text_Display.H
custom_widgets.o: ../FL/Fl_Text_Editor.H
custom_widgets.o: ../FL/Fl_Tile.H
custom_widgets.o: ../FL/fl_types.h
custom_widgets.o: ../FL/fl_utf8.h
custom_widgets.o: ../FL/Fl_Valuator.H
custom_widgets.o: ../FL/Fl_Value_Input.H
custom_widgets.o: ../FL/Fl_Widget.H
custom_widgets.o: ../FL/Fl_Window.H
custom_widgets.o: ../FL/platform.H
custom_widgets.o: ../FL/platform_types.h
custom_widgets.o: ../FL/x11.H
custom_widgets.o: ../src/flstring.h
custom_widgets.o: code.h
custom_widgets.o: CodeEditor.h
custom_widgets.o: custom_widgets.h
custom_widgets.o: factory.h
custom_widgets.o: fluid.h
custom_widgets.o: Fl_Type.h
custom_widgets.o: Fl_Widget_Type.h
custom_widgets.o: Fl_Window_Type.h
custom_widgets.o: pixmaps.h
custom_widgets.o: StyleParse.h
custom_widgets.o: widget_browser.h
custom_widgets.o: widget_panel.h
ExternalCodeEditor_UNIX.o: ../FL/Enumerations.H ExternalCodeEditor_UNIX.o: ../FL/Enumerations.H
ExternalCodeEditor_UNIX.o: ../FL/filename.H ExternalCodeEditor_UNIX.o: ../FL/filename.H
ExternalCodeEditor_UNIX.o: ../FL/Fl.H ExternalCodeEditor_UNIX.o: ../FL/Fl.H
@ -722,6 +788,7 @@ Fl_Menu_Type.o: ../FL/Fl_Scheme.H
Fl_Menu_Type.o: ../FL/Fl_Scheme_Choice.H Fl_Menu_Type.o: ../FL/Fl_Scheme_Choice.H
Fl_Menu_Type.o: ../FL/Fl_Scrollbar.H Fl_Menu_Type.o: ../FL/Fl_Scrollbar.H
Fl_Menu_Type.o: ../FL/Fl_Shared_Image.H Fl_Menu_Type.o: ../FL/Fl_Shared_Image.H
Fl_Menu_Type.o: ../FL/Fl_Shortcut_Button.H
Fl_Menu_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Menu_Type.o: ../FL/Fl_Simple_Terminal.H
Fl_Menu_Type.o: ../FL/Fl_Slider.H Fl_Menu_Type.o: ../FL/Fl_Slider.H
Fl_Menu_Type.o: ../FL/Fl_Spinner.H Fl_Menu_Type.o: ../FL/Fl_Spinner.H
@ -740,6 +807,7 @@ Fl_Menu_Type.o: ../FL/platform_types.h
Fl_Menu_Type.o: ../src/flstring.h Fl_Menu_Type.o: ../src/flstring.h
Fl_Menu_Type.o: alignment_panel.h Fl_Menu_Type.o: alignment_panel.h
Fl_Menu_Type.o: code.h Fl_Menu_Type.o: code.h
Fl_Menu_Type.o: custom_widgets.h
Fl_Menu_Type.o: file.h Fl_Menu_Type.o: file.h
Fl_Menu_Type.o: fluid.h Fl_Menu_Type.o: fluid.h
Fl_Menu_Type.o: Fluid_Image.h Fl_Menu_Type.o: Fluid_Image.h
@ -849,6 +917,7 @@ Fl_Widget_Type.o: ../FL/Fl_Scheme_Choice.H
Fl_Widget_Type.o: ../FL/Fl_Scroll.H Fl_Widget_Type.o: ../FL/Fl_Scroll.H
Fl_Widget_Type.o: ../FL/Fl_Scrollbar.H Fl_Widget_Type.o: ../FL/Fl_Scrollbar.H
Fl_Widget_Type.o: ../FL/Fl_Shared_Image.H Fl_Widget_Type.o: ../FL/Fl_Shared_Image.H
Fl_Widget_Type.o: ../FL/Fl_Shortcut_Button.H
Fl_Widget_Type.o: ../FL/fl_show_colormap.H Fl_Widget_Type.o: ../FL/fl_show_colormap.H
Fl_Widget_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Widget_Type.o: ../FL/Fl_Simple_Terminal.H
Fl_Widget_Type.o: ../FL/Fl_Slider.H Fl_Widget_Type.o: ../FL/Fl_Slider.H
@ -873,6 +942,7 @@ Fl_Widget_Type.o: ../src/flstring.h
Fl_Widget_Type.o: alignment_panel.h Fl_Widget_Type.o: alignment_panel.h
Fl_Widget_Type.o: code.h Fl_Widget_Type.o: code.h
Fl_Widget_Type.o: CodeEditor.h Fl_Widget_Type.o: CodeEditor.h
Fl_Widget_Type.o: custom_widgets.h
Fl_Widget_Type.o: ExternalCodeEditor_UNIX.h Fl_Widget_Type.o: ExternalCodeEditor_UNIX.h
Fl_Widget_Type.o: file.h Fl_Widget_Type.o: file.h
Fl_Widget_Type.o: fluid.h Fl_Widget_Type.o: fluid.h
@ -935,6 +1005,7 @@ Fl_Window_Type.o: ../FL/Fl_Scheme.H
Fl_Window_Type.o: ../FL/Fl_Scheme_Choice.H Fl_Window_Type.o: ../FL/Fl_Scheme_Choice.H
Fl_Window_Type.o: ../FL/Fl_Scrollbar.H Fl_Window_Type.o: ../FL/Fl_Scrollbar.H
Fl_Window_Type.o: ../FL/Fl_Shared_Image.H Fl_Window_Type.o: ../FL/Fl_Shared_Image.H
Fl_Window_Type.o: ../FL/Fl_Shortcut_Button.H
Fl_Window_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Window_Type.o: ../FL/Fl_Simple_Terminal.H
Fl_Window_Type.o: ../FL/Fl_Slider.H Fl_Window_Type.o: ../FL/Fl_Slider.H
Fl_Window_Type.o: ../FL/Fl_Spinner.H Fl_Window_Type.o: ../FL/Fl_Spinner.H
@ -959,6 +1030,7 @@ Fl_Window_Type.o: ../src/flstring.h
Fl_Window_Type.o: alignment_panel.h Fl_Window_Type.o: alignment_panel.h
Fl_Window_Type.o: code.h Fl_Window_Type.o: code.h
Fl_Window_Type.o: CodeEditor.h Fl_Window_Type.o: CodeEditor.h
Fl_Window_Type.o: custom_widgets.h
Fl_Window_Type.o: factory.h Fl_Window_Type.o: factory.h
Fl_Window_Type.o: file.h Fl_Window_Type.o: file.h
Fl_Window_Type.o: fluid.h Fl_Window_Type.o: fluid.h
@ -1019,6 +1091,7 @@ function_panel.o: ../FL/Fl_Window.H
function_panel.o: ../FL/platform_types.h function_panel.o: ../FL/platform_types.h
function_panel.o: code.h function_panel.o: code.h
function_panel.o: CodeEditor.h function_panel.o: CodeEditor.h
function_panel.o: custom_widgets.h
function_panel.o: factory.h function_panel.o: factory.h
function_panel.o: fluid.h function_panel.o: fluid.h
function_panel.o: Fl_Type.h function_panel.o: Fl_Type.h
@ -1290,6 +1363,7 @@ widget_panel.o: ../FL/Fl_Rect.H
widget_panel.o: ../FL/Fl_Return_Button.H widget_panel.o: ../FL/Fl_Return_Button.H
widget_panel.o: ../FL/Fl_RGB_Image.H widget_panel.o: ../FL/Fl_RGB_Image.H
widget_panel.o: ../FL/Fl_Scrollbar.H widget_panel.o: ../FL/Fl_Scrollbar.H
widget_panel.o: ../FL/Fl_Shortcut_Button.H
widget_panel.o: ../FL/Fl_Slider.H widget_panel.o: ../FL/Fl_Slider.H
widget_panel.o: ../FL/Fl_Tabs.H widget_panel.o: ../FL/Fl_Tabs.H
widget_panel.o: ../FL/Fl_Text_Buffer.H widget_panel.o: ../FL/Fl_Text_Buffer.H
@ -1305,6 +1379,7 @@ widget_panel.o: ../FL/Fl_Window.H
widget_panel.o: ../FL/platform_types.h widget_panel.o: ../FL/platform_types.h
widget_panel.o: code.h widget_panel.o: code.h
widget_panel.o: CodeEditor.h widget_panel.o: CodeEditor.h
widget_panel.o: custom_widgets.h
widget_panel.o: Fl_Type.h widget_panel.o: Fl_Type.h
widget_panel.o: Fl_Widget_Type.h widget_panel.o: Fl_Widget_Type.h
widget_panel.o: pixmaps.h widget_panel.o: pixmaps.h

View File

@ -172,6 +172,10 @@ set (CPPFILES
screen_xywh.cxx screen_xywh.cxx
) )
if (FLTK_HAVE_CAIRO) # OPTION_CAIRO or OPTION_CAIROEXT
list (APPEND CPPFILES Fl_Cairo.cxx)
endif ()
# find all header files in source directory <FL/...> # find all header files in source directory <FL/...>
file (GLOB file (GLOB
HEADER_FILES HEADER_FILES
@ -616,6 +620,10 @@ if (HAVE_XRENDER)
list (APPEND OPTIONAL_LIBS ${X11_Xrender_LIB}) list (APPEND OPTIONAL_LIBS ${X11_Xrender_LIB})
endif (HAVE_XRENDER) endif (HAVE_XRENDER)
if (FLTK_HAVE_CAIRO) # OPTION_CAIRO or OPTION_CAIROEXT
list (APPEND OPTIONAL_LIBS ${PKG_CAIRO_LIBRARIES})
endif()
if (USE_PANGO) if (USE_PANGO)
### FIXME ### This needs to use the PKG_* variables directly ### FIXME ### This needs to use the PKG_* variables directly
list (APPEND OPTIONAL_LIBS ${HAVE_LIB_PANGO} ${HAVE_LIB_PANGOCAIRO}) list (APPEND OPTIONAL_LIBS ${HAVE_LIB_PANGO} ${HAVE_LIB_PANGOCAIRO})
@ -694,6 +702,10 @@ endif (UNIX AND OPTION_USE_WAYLAND)
FL_ADD_LIBRARY (fltk STATIC "${STATIC_FILES}") FL_ADD_LIBRARY (fltk STATIC "${STATIC_FILES}")
target_link_libraries (fltk ${OPTIONAL_LIBS}) target_link_libraries (fltk ${OPTIONAL_LIBS})
if (FLTK_HAVE_CAIRO)
fl_target_link_directories (fltk PUBLIC "${PKG_CAIRO_LIBRARY_DIRS}")
endif()
####################################################################### #######################################################################
FL_ADD_LIBRARY (fltk_forms STATIC "${FORMS_FILES}") FL_ADD_LIBRARY (fltk_forms STATIC "${FORMS_FILES}")
@ -738,7 +750,8 @@ endif (OPENGL_FOUND)
if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC) if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}") FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}")
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS}) target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS} ${PKG_CAIRO_LIBRARIES})
fl_target_link_directories (fltk_SHARED PUBLIC "${PKG_CAIRO_LIBRARY_DIRS}")
################################################################### ###################################################################

View File

@ -26,6 +26,7 @@ CPPFILES = \
Fl_Browser_load.cxx \ Fl_Browser_load.cxx \
Fl_Box.cxx \ Fl_Box.cxx \
Fl_Button.cxx \ Fl_Button.cxx \
Fl_Cairo.cxx \
Fl_Chart.cxx \ Fl_Chart.cxx \
Fl_Check_Browser.cxx \ Fl_Check_Browser.cxx \
Fl_Check_Button.cxx \ Fl_Check_Button.cxx \
@ -452,7 +453,7 @@ $(LIBNAME): $(OBJECTS)
libfltk.so.$(FL_DSO_VERSION): $(OBJECTS) libfltk.so.$(FL_DSO_VERSION): $(OBJECTS)
echo $(DSOCOMMAND) $@ ... echo $(DSOCOMMAND) $@ ...
$(DSOCOMMAND) $@ $(OBJECTS) $(LDLIBS) $(DSOCOMMAND) $@ $(OBJECTS) $(LDLIBS) $(CAIROLIBS)
$(RM) libfltk.so $(RM) libfltk.so
$(LN) libfltk.so.$(FL_DSO_VERSION) libfltk.so $(LN) libfltk.so.$(FL_DSO_VERSION) libfltk.so
@ -468,7 +469,7 @@ libfltk.$(FL_DSO_VERSION).dylib: $(OBJECTS)
-install_name $(libdir)/$@ \ -install_name $(libdir)/$@ \
-current_version $(FL_VERSION) \ -current_version $(FL_VERSION) \
-compatibility_version $(FL_DSO_VERSION).0 \ -compatibility_version $(FL_DSO_VERSION).0 \
$(OBJECTS) $(LDLIBS) $(OBJECTS) $(LDLIBS) $(CAIROLIBS)
$(RM) libfltk.dylib $(RM) libfltk.dylib
$(LN) libfltk.$(FL_DSO_VERSION).dylib libfltk.dylib $(LN) libfltk.$(FL_DSO_VERSION).dylib libfltk.dylib

View File

@ -1279,6 +1279,23 @@ Fl_Button.o: ../FL/fl_utf8.h
Fl_Button.o: ../FL/Fl_Widget.H Fl_Button.o: ../FL/Fl_Widget.H
Fl_Button.o: ../FL/Fl_Window.H Fl_Button.o: ../FL/Fl_Window.H
Fl_Button.o: ../FL/platform_types.h Fl_Button.o: ../FL/platform_types.h
Fl_Cairo.o: ../FL/Enumerations.H
Fl_Cairo.o: ../FL/Fl.H
Fl_Cairo.o: ../FL/fl_attr.h
Fl_Cairo.o: ../FL/Fl_Bitmap.H
Fl_Cairo.o: ../FL/Fl_Cairo.H
Fl_Cairo.o: ../FL/fl_casts.H
Fl_Cairo.o: ../FL/fl_config.h
Fl_Cairo.o: ../FL/Fl_Export.H
Fl_Cairo.o: ../FL/Fl_Group.H
Fl_Cairo.o: ../FL/Fl_Image.H
Fl_Cairo.o: ../FL/fl_types.h
Fl_Cairo.o: ../FL/fl_utf8.h
Fl_Cairo.o: ../FL/Fl_Widget.H
Fl_Cairo.o: ../FL/Fl_Window.H
Fl_Cairo.o: ../FL/platform.H
Fl_Cairo.o: ../FL/platform_types.h
Fl_Cairo.o: ../FL/x11.H
Fl_Chart.o: ../config.h Fl_Chart.o: ../config.h
Fl_Chart.o: ../FL/Enumerations.H Fl_Chart.o: ../FL/Enumerations.H
Fl_Chart.o: ../FL/Fl.H Fl_Chart.o: ../FL/Fl.H
@ -2313,6 +2330,7 @@ Fl_Help_View.o: ../FL/Fl_RGB_Image.H
Fl_Help_View.o: ../FL/Fl_Scrollbar.H Fl_Help_View.o: ../FL/Fl_Scrollbar.H
Fl_Help_View.o: ../FL/Fl_Shared_Image.H Fl_Help_View.o: ../FL/Fl_Shared_Image.H
Fl_Help_View.o: ../FL/Fl_Slider.H Fl_Help_View.o: ../FL/Fl_Slider.H
Fl_Help_View.o: ../FL/Fl_String.H
Fl_Help_View.o: ../FL/fl_string_functions.h Fl_Help_View.o: ../FL/fl_string_functions.h
Fl_Help_View.o: ../FL/fl_types.h Fl_Help_View.o: ../FL/fl_types.h
Fl_Help_View.o: ../FL/fl_utf8.h Fl_Help_View.o: ../FL/fl_utf8.h
@ -3219,6 +3237,7 @@ Fl_Preferences.o: ../FL/fl_config.h
Fl_Preferences.o: ../FL/Fl_Export.H Fl_Preferences.o: ../FL/Fl_Export.H
Fl_Preferences.o: ../FL/Fl_Plugin.H Fl_Preferences.o: ../FL/Fl_Plugin.H
Fl_Preferences.o: ../FL/Fl_Preferences.H Fl_Preferences.o: ../FL/Fl_Preferences.H
Fl_Preferences.o: ../FL/Fl_String.H
Fl_Preferences.o: ../FL/fl_string_functions.h Fl_Preferences.o: ../FL/fl_string_functions.h
Fl_Preferences.o: ../FL/fl_types.h Fl_Preferences.o: ../FL/fl_types.h
Fl_Preferences.o: ../FL/fl_utf8.h Fl_Preferences.o: ../FL/fl_utf8.h
@ -3613,6 +3632,22 @@ fl_shortcut.o: ../FL/platform_types.h
fl_shortcut.o: flstring.h fl_shortcut.o: flstring.h
fl_shortcut.o: Fl_Screen_Driver.H fl_shortcut.o: Fl_Screen_Driver.H
fl_shortcut.o: Fl_System_Driver.H fl_shortcut.o: Fl_System_Driver.H
Fl_Shortcut_Button.o: ../config.h
Fl_Shortcut_Button.o: ../FL/Enumerations.H
Fl_Shortcut_Button.o: ../FL/Fl.H
Fl_Shortcut_Button.o: ../FL/fl_attr.h
Fl_Shortcut_Button.o: ../FL/Fl_Button.H
Fl_Shortcut_Button.o: ../FL/Fl_Cairo.H
Fl_Shortcut_Button.o: ../FL/fl_casts.H
Fl_Shortcut_Button.o: ../FL/fl_config.h
Fl_Shortcut_Button.o: ../FL/fl_draw.H
Fl_Shortcut_Button.o: ../FL/Fl_Export.H
Fl_Shortcut_Button.o: ../FL/Fl_Shortcut_Button.H
Fl_Shortcut_Button.o: ../FL/fl_types.h
Fl_Shortcut_Button.o: ../FL/fl_utf8.h
Fl_Shortcut_Button.o: ../FL/Fl_Widget.H
Fl_Shortcut_Button.o: ../FL/platform_types.h
Fl_Shortcut_Button.o: flstring.h
fl_show_colormap.o: ../config.h fl_show_colormap.o: ../config.h
fl_show_colormap.o: ../FL/Enumerations.H fl_show_colormap.o: ../FL/Enumerations.H
fl_show_colormap.o: ../FL/Fl.H fl_show_colormap.o: ../FL/Fl.H
@ -3691,6 +3726,7 @@ Fl_Spinner.o: ../FL/Fl_Rect.H
Fl_Spinner.o: ../FL/Fl_Repeat_Button.H Fl_Spinner.o: ../FL/Fl_Repeat_Button.H
Fl_Spinner.o: ../FL/Fl_Spinner.H Fl_Spinner.o: ../FL/Fl_Spinner.H
Fl_Spinner.o: ../FL/Fl_Widget.H Fl_Spinner.o: ../FL/Fl_Widget.H
Fl_String.o: ../FL/Fl_Export.H
Fl_String.o: ../FL/Fl_String.H Fl_String.o: ../FL/Fl_String.H
fl_string_functions.o: ../FL/Enumerations.H fl_string_functions.o: ../FL/Enumerations.H
fl_string_functions.o: ../FL/filename.H fl_string_functions.o: ../FL/filename.H
@ -4929,6 +4965,7 @@ gl_start.o: Fl_Gl_Window_Driver.H
numericsort.o: ../FL/filename.H numericsort.o: ../FL/filename.H
numericsort.o: ../FL/fl_config.h numericsort.o: ../FL/fl_config.h
numericsort.o: ../FL/Fl_Export.H numericsort.o: ../FL/Fl_Export.H
numericsort.o: ../FL/fl_utf8.h
numericsort.o: ../FL/platform_types.h numericsort.o: ../FL/platform_types.h
print_button.o: ../FL/Enumerations.H print_button.o: ../FL/Enumerations.H
print_button.o: ../FL/Fl.H print_button.o: ../FL/Fl.H

View File

@ -197,7 +197,7 @@ endif (OPENGL_FOUND)
# Cairo demo - must also be built w/o Cairo (displays a message box) # Cairo demo - must also be built w/o Cairo (displays a message box)
if (FLTK_HAVE_CAIRO) if (FLTK_HAVE_CAIRO)
CREATE_EXAMPLE (cairo_test cairo_test.cxx "fltk_cairo;fltk;cairo") CREATE_EXAMPLE (cairo_test cairo_test.cxx "fltk;cairo")
else () else ()
CREATE_EXAMPLE (cairo_test cairo_test.cxx fltk) CREATE_EXAMPLE (cairo_test cairo_test.cxx fltk)
endif (FLTK_HAVE_CAIRO) endif (FLTK_HAVE_CAIRO)
@ -257,7 +257,7 @@ if (OPTION_BUILD_SHARED_LIBS)
endif (OPENGL_FOUND) endif (OPENGL_FOUND)
if (FLTK_HAVE_CAIRO) if (FLTK_HAVE_CAIRO)
CREATE_EXAMPLE (cairo_test-shared cairo_test.cxx "fltk_cairo_SHARED;fltk_SHARED;cairo") CREATE_EXAMPLE (cairo_test-shared cairo_test.cxx "fltk_SHARED;cairo")
endif () endif ()
endif (MSVC) # (not MSVC) endif (MSVC) # (not MSVC)

View File

@ -682,5 +682,5 @@ shape$(EXEEXT): shape.o
cairo_test$(EXEEXT): cairo_test.o cairo_test$(EXEEXT): cairo_test.o
echo Linking $@... echo Linking $@...
$(CXX) $(ARCHFLAGS) $(CXXFLAGS) $(CAIROFLAGS) $(LDFLAGS) -o $@ cairo_test.o $(LINKFLTK) $(LINKFLTKCAIRO) $(GLDLIBS) $(CXX) $(ARCHFLAGS) $(CXXFLAGS) $(CAIROFLAGS) $(LDFLAGS) -o $@ cairo_test.o $(LINKFLTK) $(CAIROLIBS) $(GLDLIBS)
$(OSX_ONLY) ../fltk-config --post $@ $(OSX_ONLY) ../fltk-config --post $@

View File

@ -2643,6 +2643,7 @@ twowin.o: ../FL/platform_types.h
unittests.o: ../FL/Enumerations.H unittests.o: ../FL/Enumerations.H
unittests.o: ../FL/filename.H unittests.o: ../FL/filename.H
unittests.o: ../FL/Fl.H unittests.o: ../FL/Fl.H
unittests.o: ../FL/fl_ask.H
unittests.o: ../FL/fl_attr.h unittests.o: ../FL/fl_attr.h
unittests.o: ../FL/Fl_Bitmap.H unittests.o: ../FL/Fl_Bitmap.H
unittests.o: ../FL/Fl_Box.H unittests.o: ../FL/Fl_Box.H
@ -2666,8 +2667,12 @@ unittests.o: ../FL/Fl_Preferences.H
unittests.o: ../FL/Fl_Rect.H unittests.o: ../FL/Fl_Rect.H
unittests.o: ../FL/Fl_RGB_Image.H unittests.o: ../FL/Fl_RGB_Image.H
unittests.o: ../FL/Fl_Scrollbar.H unittests.o: ../FL/Fl_Scrollbar.H
unittests.o: ../FL/Fl_Simple_Terminal.H
unittests.o: ../FL/Fl_Slider.H unittests.o: ../FL/Fl_Slider.H
unittests.o: ../FL/Fl_String.H
unittests.o: ../FL/fl_string_functions.h unittests.o: ../FL/fl_string_functions.h
unittests.o: ../FL/Fl_Text_Buffer.H
unittests.o: ../FL/Fl_Text_Display.H
unittests.o: ../FL/fl_types.h unittests.o: ../FL/fl_types.h
unittests.o: ../FL/fl_utf8.h unittests.o: ../FL/fl_utf8.h
unittests.o: ../FL/Fl_Valuator.H unittests.o: ../FL/Fl_Valuator.H
@ -2768,6 +2773,38 @@ unittest_complex_shapes.o: ../FL/Fl_Widget.H
unittest_complex_shapes.o: ../FL/Fl_Window.H unittest_complex_shapes.o: ../FL/Fl_Window.H
unittest_complex_shapes.o: ../FL/platform_types.h unittest_complex_shapes.o: ../FL/platform_types.h
unittest_complex_shapes.o: unittests.h unittest_complex_shapes.o: unittests.h
unittest_core.o: ../FL/Enumerations.H
unittest_core.o: ../FL/Fl.H
unittest_core.o: ../FL/fl_attr.h
unittest_core.o: ../FL/Fl_Bitmap.H
unittest_core.o: ../FL/Fl_Cairo.H
unittest_core.o: ../FL/fl_casts.H
unittest_core.o: ../FL/fl_config.h
unittest_core.o: ../FL/Fl_Device.H
unittest_core.o: ../FL/Fl_Double_Window.H
unittest_core.o: ../FL/fl_draw.H
unittest_core.o: ../FL/Fl_Export.H
unittest_core.o: ../FL/Fl_Graphics_Driver.H
unittest_core.o: ../FL/Fl_Group.H
unittest_core.o: ../FL/Fl_Image.H
unittest_core.o: ../FL/Fl_Pixmap.H
unittest_core.o: ../FL/Fl_Plugin.H
unittest_core.o: ../FL/Fl_Preferences.H
unittest_core.o: ../FL/Fl_Rect.H
unittest_core.o: ../FL/Fl_RGB_Image.H
unittest_core.o: ../FL/Fl_Scrollbar.H
unittest_core.o: ../FL/Fl_Simple_Terminal.H
unittest_core.o: ../FL/Fl_Slider.H
unittest_core.o: ../FL/Fl_String.H
unittest_core.o: ../FL/Fl_Text_Buffer.H
unittest_core.o: ../FL/Fl_Text_Display.H
unittest_core.o: ../FL/fl_types.h
unittest_core.o: ../FL/fl_utf8.h
unittest_core.o: ../FL/Fl_Valuator.H
unittest_core.o: ../FL/Fl_Widget.H
unittest_core.o: ../FL/Fl_Window.H
unittest_core.o: ../FL/platform_types.h
unittest_core.o: unittests.h
unittest_fast_shapes.o: ../config.h unittest_fast_shapes.o: ../config.h
unittest_fast_shapes.o: ../FL/Enumerations.H unittest_fast_shapes.o: ../FL/Enumerations.H
unittest_fast_shapes.o: ../FL/Fl.H unittest_fast_shapes.o: ../FL/Fl.H