2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
2022-03-13 23:52:18 +03:00
|
|
|
# Originally written by Michael Surette
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
2024-02-07 20:30:11 +03:00
|
|
|
# Copyright 1998-2024 by Bill Spitzak and others.
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
#
|
2020-02-14 17:23:53 +03:00
|
|
|
# https://www.fltk.org/COPYING.php
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# Please see the following page on how to report bugs and issues:
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/bugs.php
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
|
2022-04-06 21:08:10 +03:00
|
|
|
#######################################################################
|
|
|
|
# Important implementation note for FLTK developers
|
|
|
|
#######################################################################
|
|
|
|
#
|
|
|
|
# *FIXME* In the current version of FLTK's CMake build files we're
|
|
|
|
# using 'include_directories()' to define directories that must be
|
|
|
|
# used in compile commands (typically "-Idirectories").
|
|
|
|
#
|
|
|
|
# include_directories() is a global command that affects *all* source
|
|
|
|
# files in the current directory and all subdirectories. This can lead
|
|
|
|
# to conflicts and should be replaced with target_include_directories()
|
|
|
|
# which can be applied to particular targets and source files only.
|
|
|
|
#
|
|
|
|
# This could remove some of these potential build conflicts, for
|
|
|
|
# instance # if the bundled image libs and Cairo or Pango are used
|
|
|
|
# together (Pango depends on Cairo and Cairo depends on libpng).
|
|
|
|
# However, this is not a proper solution!
|
|
|
|
#
|
|
|
|
# That said, order of "-I..." switches matters, and therefore the
|
|
|
|
# bundled libraries (png, jpeg, zlib) *must* appear before any other
|
|
|
|
# include_directories() statements that might introduce conflicts.
|
|
|
|
# Currently 'resources.cmake' is included before this file and thus
|
2024-02-07 20:30:11 +03:00
|
|
|
# 'include_directories(${FREETYPE_PATH})' is executed before this
|
2022-04-06 21:08:10 +03:00
|
|
|
# file but this doesn't matter.
|
|
|
|
#
|
|
|
|
# This *MUST* be fixed using target_include_directories() as
|
|
|
|
# appropriate but this would need a major rework.
|
|
|
|
#
|
|
|
|
# Albrecht-S April 6, 2022
|
|
|
|
#
|
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(DEBUG_OPTIONS_CMAKE 0)
|
|
|
|
if(DEBUG_OPTIONS_CMAKE)
|
|
|
|
message(STATUS "[** options.cmake **]")
|
|
|
|
fl_debug_var(WIN32)
|
|
|
|
fl_debug_var(FLTK_LDLIBS)
|
|
|
|
endif(DEBUG_OPTIONS_CMAKE)
|
2018-02-23 22:41:52 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
# options
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_OPTION_OPTIM ""
|
2020-06-13 16:19:27 +03:00
|
|
|
CACHE STRING
|
|
|
|
"custom optimization flags"
|
|
|
|
)
|
2024-02-07 20:30:11 +03:00
|
|
|
# *FIXME* add_definitions()
|
|
|
|
add_definitions(${FLTK_OPTION_OPTIM})
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_ARCHFLAGS ""
|
2020-06-13 16:19:27 +03:00
|
|
|
CACHE STRING
|
|
|
|
"custom architecture flags"
|
2020-08-13 21:32:56 +03:00
|
|
|
)
|
2024-02-07 20:30:11 +03:00
|
|
|
# *FIXME* add_definitions()
|
|
|
|
add_definitions(${FLTK_ARCHFLAGS})
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2015-07-12 22:23:55 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_ABI_VERSION ""
|
2020-06-13 16:19:27 +03:00
|
|
|
CACHE STRING
|
|
|
|
"FLTK ABI Version FL_ABI_VERSION: 1xxyy for 1.x.y (xx,yy with leading zero)"
|
2020-08-13 21:32:56 +03:00
|
|
|
)
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FL_ABI_VERSION ${FLTK_ABI_VERSION})
|
2023-11-25 22:30:58 +03:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Select MSVC (Visual Studio) Runtime: DLL (/MDx) or static (/MTx)
|
|
|
|
# where x = 'd' for Debug builds, empty ('') for non-Debug builds.
|
|
|
|
# Note: this might be handled better by the 'MSVC_RUNTIME_LIBRARY'
|
|
|
|
# target property for each target rather than setting a global
|
|
|
|
# CMake variable - but this version does the latter.
|
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(MSVC)
|
|
|
|
option(FLTK_MSVC_RUNTIME_DLL "use MSVC Runtime-DLL (/MDx)" ON)
|
|
|
|
if(FLTK_MSVC_RUNTIME_DLL)
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
|
|
|
|
else()
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
|
|
endif()
|
|
|
|
endif(MSVC)
|
2023-11-25 22:30:58 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE)
|
|
|
|
option(FLTK_BACKEND_X11 "use X11" OFF)
|
|
|
|
if(CMAKE_OSX_SYSROOT)
|
|
|
|
list(APPEND FLTK_CFLAGS "-isysroot ${CMAKE_OSX_SYSROOT}")
|
|
|
|
endif(CMAKE_OSX_SYSROOT)
|
|
|
|
elseif(UNIX)
|
|
|
|
option(FLTK_BACKEND_X11 "use X11" ON)
|
|
|
|
endif(APPLE)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
# Bundled Library Options
|
2022-04-06 21:08:10 +03:00
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(WIN32 OR (APPLE AND NOT FLTK_BACKEND_X11))
|
|
|
|
option(FLTK_USE_SYSTEM_LIBJPEG "use system libjpeg" OFF)
|
|
|
|
option(FLTK_USE_SYSTEM_LIBPNG "use system libpng" OFF)
|
|
|
|
option(FLTK_USE_SYSTEM_ZLIB "use system zlib" OFF)
|
|
|
|
else()
|
|
|
|
option(FLTK_USE_SYSTEM_LIBJPEG "use system libjpeg" ON)
|
|
|
|
option(FLTK_USE_SYSTEM_LIBPNG "use system libpng" ON)
|
|
|
|
option(FLTK_USE_SYSTEM_ZLIB "use system zlib" ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Set default values of internal build options
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_USE_BUNDLED_JPEG FALSE)
|
|
|
|
set(FLTK_USE_BUNDLED_PNG FALSE)
|
|
|
|
set(FLTK_USE_BUNDLED_ZLIB FALSE)
|
2023-01-01 19:29:23 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# Collect libraries to build fltk_images (starting empty)
|
|
|
|
|
|
|
|
set(FLTK_IMAGE_LIBRARIES "")
|
2023-01-01 19:29:23 +03:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
# Ensure that png and zlib are both system or both local for compatibility
|
2023-01-01 19:29:23 +03:00
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_SYSTEM_ZLIB)
|
|
|
|
find_package(ZLIB)
|
|
|
|
if(NOT ZLIB_FOUND)
|
|
|
|
set(FLTK_USE_BUNDLED_ZLIB TRUE)
|
|
|
|
endif()
|
2022-04-06 21:08:10 +03:00
|
|
|
else()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_USE_BUNDLED_ZLIB TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(FLTK_USE_SYSTEM_LIBPNG AND NOT FLTK_USE_BUNDLED_ZLIB)
|
|
|
|
find_package(PNG)
|
|
|
|
if(NOT PNG_FOUND)
|
|
|
|
set(FLTK_USE_BUNDLED_PNG TRUE)
|
|
|
|
set(FLTK_USE_BUNDLED_ZLIB TRUE)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(FLTK_USE_BUNDLED_PNG TRUE)
|
|
|
|
set(FLTK_USE_BUNDLED_ZLIB TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Issue warnings if we deviate from the user's choice
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_SYSTEM_LIBPNG AND FLTK_USE_BUNDLED_PNG)
|
|
|
|
message(STATUS "System PNG or ZLIB not usable, falling back to local PNG for compatibility.")
|
|
|
|
endif()
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_SYSTEM_ZLIB AND FLTK_USE_BUNDLED_ZLIB)
|
|
|
|
message(STATUS "System PNG or ZLIB not usable, falling back to local ZLIB for compatibility.")
|
|
|
|
endif()
|
2022-04-06 21:08:10 +03:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
# Bundled Compression Library : zlib
|
2022-04-06 21:08:10 +03:00
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_BUNDLED_ZLIB)
|
|
|
|
|
|
|
|
add_subdirectory(zlib)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# FIXME - include_directories()
|
|
|
|
include_directories(${ZLIB_INCLUDE_DIR})
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(HAVE_LIBZ 1)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Bundled Image Library : libpng
|
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_BUNDLED_PNG)
|
|
|
|
|
|
|
|
add_subdirectory(png)
|
|
|
|
set(FLTK_PNG_LIBRARIES fltk::png)
|
|
|
|
list(APPEND FLTK_IMAGE_LIBRARIES fltk::png)
|
|
|
|
|
|
|
|
# Definitions for 'config.h' - do we still need this?
|
|
|
|
# See also png/CMakeLists.txt (target_compile_definitions).
|
|
|
|
# Note: config.h is generated by either configure or CMake,
|
|
|
|
# hence we should support it in 1.4.0 (may be changed in 1.5.0)
|
|
|
|
|
|
|
|
set(HAVE_PNG_H 1)
|
|
|
|
set(HAVE_PNG_GET_VALID 1)
|
|
|
|
set(HAVE_PNG_SET_TRNS_TO_ALPHA 1)
|
|
|
|
|
|
|
|
# *FIXME* include_directories()
|
|
|
|
include_directories(${FLTK_SOURCE_DIR}/png)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
else() # use system libpng and zlib
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_PNG_LIBRARIES ${PNG_LIBRARIES})
|
|
|
|
list(APPEND FLTK_IMAGE_LIBRARIES ${PNG_LIBRARIES})
|
|
|
|
|
|
|
|
# *FIXME* include_directories()
|
|
|
|
include_directories(${PNG_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
set(_INCLUDE_SAVED ${CMAKE_REQUIRED_INCLUDES})
|
|
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES ${PNG_INCLUDE_DIRS})
|
2022-04-06 21:08:10 +03:00
|
|
|
|
|
|
|
# Note: we do not check for <libpng/png.h> explicitly.
|
|
|
|
# This is assumed to exist if we have PNG_FOUND and don't find <png.h>
|
|
|
|
|
|
|
|
# FIXME - Force search by unsetting the chache variable. Maybe use
|
|
|
|
# FIXME - another cache variable to check for option changes?
|
2024-02-07 20:30:11 +03:00
|
|
|
# unset(HAVE_PNG_H CACHE) # force search
|
|
|
|
|
|
|
|
check_include_file(png.h HAVE_PNG_H)
|
|
|
|
mark_as_advanced(HAVE_PNG_H)
|
|
|
|
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${_INCLUDE_SAVED})
|
|
|
|
unset(_INCLUDE_SAVED)
|
|
|
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(HAVE_LIBPNG 1)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Bundled Image Library : libjpeg
|
|
|
|
#######################################################################
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_SYSTEM_LIBJPEG)
|
|
|
|
find_package(JPEG)
|
|
|
|
if(NOT JPEG_FOUND)
|
|
|
|
set(FLTK_USE_BUNDLED_JPEG TRUE)
|
|
|
|
message(STATUS "cannot find system jpeg library - using built-in")
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(FLTK_USE_BUNDLED_JPEG TRUE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(FLTK_USE_BUNDLED_JPEG)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
add_subdirectory(jpeg)
|
|
|
|
set(FLTK_JPEG_LIBRARIES fltk::jpeg)
|
|
|
|
# list(APPEND FLTK_IMAGE_LIBRARIES fltk::jpeg)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# *FIXME* include_directories
|
|
|
|
include_directories(${FLTK_SOURCE_DIR}/jpeg)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
else()
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
|
|
|
|
list(APPEND FLTK_IMAGE_LIBRARIES ${JPEG_LIBRARIES})
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(HAVE_LIBJPEG 1)
|
2022-04-06 21:08:10 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
|
|
|
|
if(UNIX)
|
|
|
|
option(FLTK_INSTALL_LINKS "create backwards compatibility links" OFF)
|
|
|
|
list(APPEND FLTK_LDLIBS -lm)
|
|
|
|
if(NOT APPLE)
|
|
|
|
option(FLTK_BACKEND_WAYLAND "support the Wayland backend" ON)
|
|
|
|
endif(NOT APPLE)
|
|
|
|
if(FLTK_BACKEND_WAYLAND)
|
2023-04-02 17:04:13 +03:00
|
|
|
pkg_check_modules(WLDCLIENT wayland-client>=1.18)
|
2022-11-18 11:10:22 +03:00
|
|
|
pkg_check_modules(WLDCURSOR wayland-cursor)
|
2023-04-02 17:04:13 +03:00
|
|
|
pkg_check_modules(WLDPROTO wayland-protocols>=1.15)
|
2022-11-18 11:10:22 +03:00
|
|
|
pkg_check_modules(XKBCOMMON xkbcommon)
|
2024-02-07 20:30:11 +03:00
|
|
|
if(NOT(WLDCLIENT_FOUND AND WLDCURSOR_FOUND AND WLDPROTO_FOUND AND XKBCOMMON_FOUND))
|
|
|
|
message(STATUS "Not all software modules 'wayland-client>=1.18 wayland-cursor wayland-protocols>=1.15 xkbcommon' are present")
|
2024-02-10 18:27:38 +03:00
|
|
|
message(STATUS "Consequently, FLTK_BACKEND_WAYLAND is turned off.")
|
2024-02-07 20:30:11 +03:00
|
|
|
unset(FLTK_BACKEND_WAYLAND CACHE)
|
|
|
|
set(FLTK_BACKEND_WAYLAND 0)
|
|
|
|
endif(NOT(WLDCLIENT_FOUND AND WLDCURSOR_FOUND AND WLDPROTO_FOUND AND XKBCOMMON_FOUND))
|
|
|
|
endif(FLTK_BACKEND_WAYLAND)
|
|
|
|
|
|
|
|
if(FLTK_BACKEND_WAYLAND)
|
|
|
|
set(FLTK_USE_WAYLAND 1)
|
2024-02-10 18:27:38 +03:00
|
|
|
include(FindX11)
|
|
|
|
if(FLTK_BACKEND_X11 AND X11_FOUND)
|
|
|
|
set(FLTK_USE_X11 1) # build a hybrid Wayland/X11 library
|
2024-02-07 20:30:11 +03:00
|
|
|
else()
|
2024-02-10 18:27:38 +03:00
|
|
|
set(FLTK_USE_X11 0) # build a Wayland-only library
|
|
|
|
endif()
|
2024-02-07 20:30:11 +03:00
|
|
|
unset(FLTK_GRAPHICS_CAIRO CACHE)
|
|
|
|
set(FLTK_GRAPHICS_CAIRO TRUE CACHE BOOL "all drawing to X11 windows uses Cairo")
|
|
|
|
option(FLTK_USE_SYSTEM_LIBDECOR "use libdecor from the system" ON)
|
|
|
|
set(USE_SYSTEM_LIBDECOR 1)
|
|
|
|
unset(FLTK_USE_XRENDER CACHE)
|
|
|
|
unset(FLTK_USE_XINERAMA CACHE)
|
2024-02-10 18:27:38 +03:00
|
|
|
# unset(FLTK_USE_XFT CACHE)
|
2024-02-07 20:30:11 +03:00
|
|
|
unset(FLTK_USE_XCURSOR CACHE)
|
|
|
|
unset(FLTK_USE_XFIXES CACHE)
|
|
|
|
if(X11_FOUND)
|
|
|
|
if(NOT X11_Xfixes_FOUND)
|
2022-11-24 09:22:27 +03:00
|
|
|
message(WARNING "Install development headers for libXfixes (e.g., libxfixes-dev)")
|
2022-11-23 21:00:05 +03:00
|
|
|
endif()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HAVE_XFIXES 1)
|
|
|
|
if(NOT X11_Xrender_FOUND)
|
2022-11-24 09:22:27 +03:00
|
|
|
message(WARNING "Install development headers for libXrender (e.g., libxrender-dev)")
|
2022-11-23 21:00:05 +03:00
|
|
|
endif()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HAVE_XRENDER 1)
|
|
|
|
if(NOT X11_Xft_FOUND)
|
2022-11-24 09:22:27 +03:00
|
|
|
message(WARNING "Install development headers for libXft (e.g., libxft-dev)")
|
2022-11-23 21:00:05 +03:00
|
|
|
endif()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(USE_XFT 1)
|
|
|
|
if(NOT X11_Xcursor_FOUND)
|
2022-11-24 09:22:27 +03:00
|
|
|
message(WARNING "Install development headers for libXcursor (e.g., libxcursor-dev)")
|
2022-11-23 21:00:05 +03:00
|
|
|
endif()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HAVE_XCURSOR 1)
|
|
|
|
if(NOT X11_Xinerama_FOUND)
|
2022-11-24 09:22:27 +03:00
|
|
|
message(WARNING "Install development headers for libXinerama (e.g., libxinerama-dev)")
|
2022-11-23 21:00:05 +03:00
|
|
|
endif()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HAVE_XINERAMA 1)
|
|
|
|
if(NOT (X11_Xfixes_FOUND AND X11_Xrender_FOUND AND X11_Xft_FOUND AND X11_Xcursor_FOUND
|
2022-11-24 09:22:27 +03:00
|
|
|
AND X11_Xinerama_FOUND))
|
2024-02-07 20:30:11 +03:00
|
|
|
message(FATAL_ERROR "*** Terminating: one or more required software package(s) missing.")
|
|
|
|
endif()
|
|
|
|
endif(X11_FOUND)
|
|
|
|
unset(FLTK_USE_PANGO CACHE)
|
|
|
|
set(FLTK_USE_PANGO TRUE CACHE BOOL "use lib Pango")
|
|
|
|
if(FLTK_USE_SYSTEM_LIBDECOR)
|
|
|
|
pkg_check_modules(SYSTEM_LIBDECOR libdecor-0>=0.2.0 QUIET)
|
|
|
|
if(NOT SYSTEM_LIBDECOR_FOUND)
|
2024-02-08 21:31:40 +03:00
|
|
|
message(STATUS "Warning: system libdecor doesn't satisfy version >= 0.2.0,")
|
|
|
|
message(STATUS " using bundled libdecor library instead.")
|
|
|
|
set(USE_SYSTEM_LIBDECOR 0)
|
2024-02-07 20:30:11 +03:00
|
|
|
else()
|
2023-12-01 16:43:32 +03:00
|
|
|
pkg_get_variable(LIBDECOR_LIBDIR libdecor-0 libdir)
|
2024-02-07 20:30:11 +03:00
|
|
|
set(LIBDECOR_PLUGIN_DIR ${LIBDECOR_LIBDIR}/libdecor/plugins-1)
|
|
|
|
if(EXISTS ${LIBDECOR_PLUGIN_DIR} AND IS_DIRECTORY ${LIBDECOR_PLUGIN_DIR})
|
|
|
|
set(LIBDECOR_PLUGIN_DIR "\"${LIBDECOR_PLUGIN_DIR}\"" )
|
|
|
|
else()
|
|
|
|
set(USE_SYSTEM_LIBDECOR 0)
|
|
|
|
endif()
|
|
|
|
endif(NOT SYSTEM_LIBDECOR_FOUND)
|
2024-02-15 00:57:55 +03:00
|
|
|
else()
|
|
|
|
set(USE_SYSTEM_LIBDECOR 0)
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_USE_SYSTEM_LIBDECOR)
|
|
|
|
|
|
|
|
if(USE_SYSTEM_LIBDECOR)
|
|
|
|
set(FLTK_USE_LIBDECOR_GTK ON)
|
|
|
|
else()
|
|
|
|
option(FLTK_USE_LIBDECOR_GTK "Allow to use libdecor's GTK plugin" ON)
|
|
|
|
endif(USE_SYSTEM_LIBDECOR)
|
|
|
|
|
|
|
|
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
|
|
check_include_file(linux/input.h LINUX_INPUT_H)
|
|
|
|
if(NOT LINUX_INPUT_H)
|
|
|
|
message(FATAL_ERROR "Required include file 'linux/input.h' is missing. Please install package 'evdev-proto'")
|
|
|
|
endif(NOT LINUX_INPUT_H)
|
|
|
|
endif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
|
|
|
|
|
|
endif(FLTK_BACKEND_WAYLAND)
|
|
|
|
endif(UNIX)
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
option(FLTK_GRAPHICS_GDIPLUS "use GDI+ when possible for antialiased graphics" ON)
|
|
|
|
if(FLTK_GRAPHICS_GDIPLUS)
|
|
|
|
set(USE_GDIPLUS TRUE)
|
|
|
|
if(NOT MSVC)
|
|
|
|
list(APPEND FLTK_LDLIBS "-lgdiplus")
|
|
|
|
endif(NOT MSVC)
|
|
|
|
endif(FLTK_GRAPHICS_GDIPLUS)
|
|
|
|
endif(WIN32)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
option(FLTK_OPTION_STD "allow FLTK to use some std:: features" OFF)
|
|
|
|
if(FLTK_OPTION_STD)
|
|
|
|
set(FLTK_USE_STD 1)
|
|
|
|
else()
|
|
|
|
set(FLTK_USE_STD 0)
|
|
|
|
endif()
|
2023-10-22 20:30:37 +03:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
|
2018-02-25 22:25:45 +03:00
|
|
|
# find X11 libraries and headers
|
2024-02-07 20:30:11 +03:00
|
|
|
set(PATH_TO_XLIBS)
|
|
|
|
if((NOT APPLE OR FLTK_BACKEND_X11) AND NOT WIN32 AND NOT FLTK_BACKEND_WAYLAND)
|
|
|
|
include(FindX11)
|
|
|
|
if(X11_FOUND)
|
|
|
|
set(FLTK_USE_X11 1)
|
|
|
|
list(APPEND FLTK_LDLIBS -lX11)
|
|
|
|
if(X11_Xext_FOUND)
|
|
|
|
list(APPEND FLTK_LDLIBS -lXext)
|
|
|
|
endif(X11_Xext_FOUND)
|
|
|
|
get_filename_component(PATH_TO_XLIBS ${X11_X11_LIB} PATH)
|
|
|
|
endif(X11_FOUND)
|
|
|
|
endif()
|
|
|
|
|
2024-02-22 21:42:57 +03:00
|
|
|
if(APPLE AND FLTK_BACKEND_X11)
|
2024-02-07 20:30:11 +03:00
|
|
|
if(NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0)) # a.k.a. macOS version ≥ 10.13
|
|
|
|
list(APPEND FLTK_CFLAGS "-D_LIBCPP_HAS_THREAD_API_PTHREAD")
|
|
|
|
endif(NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0))
|
|
|
|
# FIXME: include_directories(!)
|
|
|
|
# FIXME: how can we implement "AFTER SYSTEM" ?
|
|
|
|
include_directories(AFTER SYSTEM /opt/X11/include/freetype2)
|
|
|
|
include_directories(AFTER SYSTEM /opt/X11/include) # for Xft.h
|
|
|
|
if(PATH_TO_XLIBS)
|
|
|
|
set(LDFLAGS "-L${PATH_TO_XLIBS} ${LDFLAGS}")
|
|
|
|
endif(PATH_TO_XLIBS)
|
|
|
|
if(X11_INCLUDE_DIR)
|
|
|
|
set(TEMP_INCLUDE_DIR ${X11_INCLUDE_DIR})
|
|
|
|
list(TRANSFORM TEMP_INCLUDE_DIR PREPEND "-I")
|
|
|
|
list(APPEND FLTK_CFLAGS "${TEMP_INCLUDE_DIR}")
|
|
|
|
endif(X11_INCLUDE_DIR)
|
2024-02-22 21:42:57 +03:00
|
|
|
endif(APPLE AND FLTK_BACKEND_X11)
|
2024-02-07 20:30:11 +03:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
option(FLTK_USE_POLL "use poll if available" OFF)
|
|
|
|
mark_as_advanced(FLTK_USE_POLL)
|
|
|
|
|
|
|
|
if(FLTK_USE_POLL)
|
2020-06-13 16:19:27 +03:00
|
|
|
CHECK_FUNCTION_EXISTS(poll USE_POLL)
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_USE_POLL)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_BUILD_SHARED_LIBS
|
|
|
|
"Build shared libraries in addition to static libraries"
|
2020-06-13 16:19:27 +03:00
|
|
|
OFF
|
2020-08-13 21:32:56 +03:00
|
|
|
)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_OPTION_PRINT_SUPPORT "allow print support" ON)
|
|
|
|
option(FLTK_OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
|
2023-12-20 18:56:29 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_BUILD_FORMS "Build forms compatibility library" ON)
|
|
|
|
option(FLTK_BUILD_FLUID "Build FLUID" ON)
|
|
|
|
option(FLTK_BUILD_FLTK_OPTIONS "Build fltk-options" ON)
|
|
|
|
option(FLTK_BUILD_EXAMPLES "Build example programs" OFF)
|
2023-12-20 18:56:29 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_IS_TOPLEVEL)
|
|
|
|
option(FLTK_BUILD_TEST "Build test/demo programs" ON)
|
|
|
|
else()
|
|
|
|
option(FLTK_BUILD_TEST "Build test/demo programs" OFF)
|
|
|
|
endif()
|
2020-08-13 21:32:56 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_BUILD_FORMS)
|
|
|
|
set(FLTK_HAVE_FORMS 1)
|
|
|
|
else()
|
|
|
|
set(FLTK_HAVE_FORMS 0)
|
|
|
|
endif()
|
2020-08-13 21:32:56 +03:00
|
|
|
|
2015-04-26 00:42:51 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
option(FLTK_BUILD_HTML_DOCS "build html docs" ON)
|
|
|
|
option(FLTK_INSTALL_HTML_DOCS "install html docs" OFF)
|
2018-12-29 22:04:38 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_INCLUDE_DRIVER_DOCS "include driver (developer) docs" OFF)
|
|
|
|
mark_as_advanced(FLTK_INCLUDE_DRIVER_DOCS)
|
2018-12-29 22:04:38 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(LATEX_FOUND)
|
|
|
|
option(FLTK_BUILD_PDF_DOCS "build pdf docs" ON)
|
|
|
|
option(FLTK_INSTALL_PDF_DOCS "install pdf docs" OFF)
|
|
|
|
endif(LATEX_FOUND)
|
|
|
|
endif(DOXYGEN_FOUND)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_BUILD_HTML_DOCS OR FLTK_BUILD_PDF_DOCS)
|
|
|
|
add_subdirectory(documentation)
|
|
|
|
endif(FLTK_BUILD_HTML_DOCS OR FLTK_BUILD_PDF_DOCS)
|
2015-04-26 00:42:51 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2021-02-28 16:56:19 +03:00
|
|
|
# Include optional Cairo support
|
|
|
|
#######################################################################
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_OPTION_CAIRO_WINDOW "add support for Fl_Cairo_Window" OFF)
|
|
|
|
option(FLTK_OPTION_CAIRO_EXT
|
2020-06-13 16:19:27 +03:00
|
|
|
"use FLTK code instrumentation for Cairo extended use" OFF
|
|
|
|
)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_HAVE_CAIRO 0)
|
|
|
|
set(FLTK_HAVE_CAIROEXT 0)
|
2021-02-28 16:56:19 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_OPTION_CAIRO_WINDOW OR FLTK_OPTION_CAIRO_EXT)
|
|
|
|
pkg_search_module(PKG_CAIRO cairo)
|
2021-02-28 16:56:19 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(PKG_CAIRO_FOUND)
|
|
|
|
set(FLTK_HAVE_CAIRO 1)
|
|
|
|
if(FLTK_OPTION_CAIRO_EXT)
|
|
|
|
set(FLTK_HAVE_CAIROEXT 1)
|
|
|
|
endif(FLTK_OPTION_CAIRO_EXT)
|
2021-02-28 16:56:19 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${PKG_CAIRO_INCLUDE_DIRS})
|
2021-02-28 16:56:19 +03:00
|
|
|
|
|
|
|
# Cairo libs and flags for fltk-config
|
|
|
|
|
|
|
|
# Hint: use either PKG_CAIRO_* or PKG_CAIRO_STATIC_* variables to
|
2024-02-07 20:30:11 +03:00
|
|
|
# create the list of libraries used to link programs with Cairo
|
2021-02-28 16:56:19 +03:00
|
|
|
# by running fltk-config --use-cairo --compile ...
|
2024-02-07 20:30:11 +03:00
|
|
|
# Currently we're using the non-STATIC variables to link Cairo shared.
|
2021-02-28 16:56:19 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(CAIROLIBS)
|
|
|
|
foreach(lib ${PKG_CAIRO_LIBRARIES})
|
|
|
|
list(APPEND CAIROLIBS "-l${lib}")
|
2021-02-28 16:56:19 +03:00
|
|
|
endforeach()
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
string(REPLACE ";" " " CAIROLIBS "${CAIROLIBS}")
|
|
|
|
string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}")
|
2021-02-28 16:56:19 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
else(PKG_CAIRO_FOUND)
|
2023-03-09 14:21:49 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(NOT MSVC)
|
|
|
|
message(STATUS "*** Cairo was requested but not found - please check your Cairo installation")
|
|
|
|
message(STATUS "*** or disable options FLTK_OPTION_CAIRO_WINDOW and FLTK_OPTION_CAIRO_EXT.")
|
|
|
|
message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers.")
|
|
|
|
endif()
|
2023-03-09 14:21:49 +03:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
message(STATUS "--- Cairo not found: trying to find Cairo for MSVC ...")
|
2023-03-09 14:21:49 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
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()
|
2023-03-09 14:21:49 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(CAIROLIBS "-lcairo") # should be correct: needs cairo.lib
|
2023-03-09 14:21:49 +03:00
|
|
|
|
|
|
|
# simulate results of 'pkg_search_module (PKG_CAIRO cairo)' and more (above)
|
|
|
|
# these variables will be used later
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(PKG_CAIRO_LIBRARIES "cairo")
|
|
|
|
set(PKG_CAIRO_INCLUDE_DIRS "${FLTK_CAIRO_DIR}/include")
|
|
|
|
set(PKG_CAIRO_LIBRARY_DIRS "${FLTK_CAIRO_DIR}/lib/x64/")
|
2023-03-09 14:21:49 +03:00
|
|
|
|
|
|
|
### FIXME ###
|
2024-02-07 20:30:11 +03:00
|
|
|
include_directories(${PKG_CAIRO_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
set(FLTK_HAVE_CAIRO 1)
|
|
|
|
if(FLTK_OPTION_CAIRO_EXT)
|
|
|
|
set(FLTK_HAVE_CAIROEXT 1)
|
|
|
|
endif(FLTK_OPTION_CAIRO_EXT)
|
|
|
|
|
|
|
|
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_pkg(PKG_CAIRO cairo)
|
|
|
|
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 ---")
|
2023-03-09 14:21:49 +03:00
|
|
|
endif() # 1 = DEBUG, ...
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_OPTION_CAIRO_WINDOW OR FLTK_OPTION_CAIRO_EXT)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2017-09-03 16:14:25 +03:00
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_OPTION_SVG "read/write SVG image files" ON)
|
|
|
|
|
|
|
|
if(FLTK_OPTION_SVG)
|
|
|
|
set(FLTK_USE_SVG 1)
|
|
|
|
else()
|
|
|
|
set(FLTK_USE_SVG 0)
|
|
|
|
endif(FLTK_OPTION_SVG)
|
2017-09-03 16:14:25 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# FIXME: GL libs have already been searched in resources.cmake
|
|
|
|
|
|
|
|
set(HAVE_GL LIB_GL OR LIB_MesaGL)
|
|
|
|
set(FLTK_USE_GL FALSE)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(HAVE_GL)
|
|
|
|
option(FLTK_BUILD_GL "use OpenGL and build fltk_gl library" ON)
|
2024-02-13 16:47:28 +03:00
|
|
|
if(FLTK_BUILD_GL)
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_USE_GL TRUE)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(FLTK_BUILD_GL)
|
|
|
|
if(FLTK_BACKEND_WAYLAND)
|
2022-11-24 11:08:46 +03:00
|
|
|
pkg_check_modules(WLD_EGL wayland-egl)
|
|
|
|
pkg_check_modules(PKG_EGL egl)
|
|
|
|
pkg_check_modules(PKG_GL gl)
|
2024-02-07 20:30:11 +03:00
|
|
|
if(NOT (WLD_EGL_FOUND AND PKG_EGL_FOUND AND PKG_GL_FOUND))
|
|
|
|
message(STATUS "Modules 'wayland-egl, egl, and gl' are required to build for the Wayland backend.")
|
|
|
|
message(FATAL_ERROR "*** Aborting ***")
|
|
|
|
endif(NOT (WLD_EGL_FOUND AND PKG_EGL_FOUND AND PKG_GL_FOUND))
|
|
|
|
endif(FLTK_BACKEND_WAYLAND)
|
|
|
|
if(FLTK_BACKEND_X11)
|
|
|
|
set(OPENGL_FOUND TRUE)
|
2022-10-16 09:29:59 +03:00
|
|
|
find_library(OPENGL_LIB GL)
|
2024-02-07 20:30:11 +03:00
|
|
|
get_filename_component(PATH_TO_GLLIB ${OPENGL_LIB} DIRECTORY)
|
2024-02-08 21:18:37 +03:00
|
|
|
# FIXME: we should find a better way to resolve this issue:
|
2022-10-16 09:29:59 +03:00
|
|
|
# with GL, must use XQuartz libX11 else "Insufficient GL support"
|
2024-02-07 20:30:11 +03:00
|
|
|
set(OPENGL_LIBRARIES -L${PATH_TO_GLLIB} -lX11 -lGLU -lGL)
|
2020-08-31 17:17:04 +03:00
|
|
|
unset(HAVE_GL_GLU_H CACHE)
|
2024-02-07 20:30:11 +03:00
|
|
|
find_file(HAVE_GL_GLU_H GL/glu.h PATHS ${X11_INCLUDE_DIR})
|
2020-06-13 16:19:27 +03:00
|
|
|
else()
|
2023-11-15 23:30:12 +03:00
|
|
|
find_package(OpenGL)
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE)
|
|
|
|
set(HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H})
|
|
|
|
endif(APPLE)
|
|
|
|
endif(FLTK_BACKEND_X11)
|
|
|
|
else()
|
|
|
|
set(OPENGL_FOUND FALSE)
|
|
|
|
set(HAVE_GL FALSE)
|
|
|
|
set(HAVE_GL_GLU_H FALSE)
|
|
|
|
set(HAVE_GLXGETPROCADDRESSARB FALSE)
|
|
|
|
endif(FLTK_BUILD_GL)
|
|
|
|
|
2024-02-08 21:18:37 +03:00
|
|
|
mark_as_advanced(OPENGL_LIB) # internal cache variable, not relevant for users
|
|
|
|
|
|
|
|
# FIXME: the following is necessary because this variable may have been removed
|
|
|
|
# from the cache above. It has been marked "advanced" before in resources.cmake.
|
|
|
|
mark_as_advanced(HAVE_GL_GLU_H)
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(OPENGL_FOUND)
|
|
|
|
set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL)
|
2018-02-24 16:44:06 +03:00
|
|
|
|
|
|
|
# Set GLLIBS (used in fltk-config).
|
|
|
|
# We should probably deduct this from OPENGL_LIBRARIES but it turned
|
|
|
|
# out to be difficult since FindOpenGL seems to return different
|
|
|
|
# syntax depending on the platform (and maybe also CMake version).
|
|
|
|
# Hence we use the following code...
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(WIN32)
|
|
|
|
set(GLLIBS "-lglu32 -lopengl32")
|
|
|
|
elseif(APPLE AND NOT FLTK_BACKEND_X11)
|
|
|
|
set(GLLIBS "-framework OpenGL")
|
|
|
|
elseif(FLTK_BACKEND_WAYLAND)
|
|
|
|
set(GLLIBS "-lwayland-egl -lEGL -lGLU -lGL")
|
|
|
|
else()
|
|
|
|
set(GLLIBS "-lGLU -lGL")
|
|
|
|
endif(WIN32)
|
2015-12-30 17:37:35 +03:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
# check if function glXGetProcAddressARB exists
|
2024-02-07 20:30:11 +03:00
|
|
|
set(TEMP_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_LIBRARIES})
|
|
|
|
check_function_exists(glXGetProcAddressARB HAVE_GLXGETPROCADDRESSARB)
|
|
|
|
set(CMAKE_REQUIRED_LIBRARIES ${TEMP_REQUIRED_LIBRARIES})
|
|
|
|
unset(TEMP_REQUIRED_LIBRARIES)
|
2015-12-30 17:37:35 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_GL_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(FLTK_GL_FOUND FALSE)
|
|
|
|
set(GLLIBS)
|
|
|
|
endif(OPENGL_FOUND)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-25 22:25:45 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_OPTION_LARGE_FILE "enable large file support" ON)
|
2018-02-25 22:25:45 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_OPTION_LARGE_FILE)
|
|
|
|
if(NOT MSVC)
|
|
|
|
add_definitions(-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
|
|
|
|
list(APPEND FLTK_CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
|
|
|
|
endif(NOT MSVC)
|
|
|
|
endif(FLTK_OPTION_LARGE_FILE)
|
2018-02-25 22:25:45 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2016-12-06 22:20:34 +03:00
|
|
|
# Create an option whether we want to check for pthreads.
|
|
|
|
# We must not do it on Windows unless we run under Cygwin, since we
|
|
|
|
# always use native threads on Windows (even if libpthread is available).
|
|
|
|
|
|
|
|
# Note: HAVE_PTHREAD_H has already been determined in resources.cmake
|
|
|
|
# before this file is included (or set to 0 for WIN32).
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(WIN32 AND NOT CYGWIN)
|
|
|
|
# set(HAVE_PTHREAD_H 0) # (see resources.cmake)
|
|
|
|
set(FLTK_USE_PTHREADS FALSE)
|
|
|
|
else()
|
|
|
|
option(FLTK_USE_PTHREADS "use multi-threading with pthreads" ON)
|
|
|
|
endif(WIN32 AND NOT CYGWIN)
|
2016-12-06 22:20:34 +03:00
|
|
|
|
|
|
|
# initialize more variables
|
2024-02-07 20:30:11 +03:00
|
|
|
set(USE_THREADS 0)
|
|
|
|
set(HAVE_PTHREAD 0)
|
|
|
|
set(FLTK_PTHREADS_FOUND FALSE)
|
|
|
|
|
|
|
|
if(FLTK_USE_PTHREADS)
|
|
|
|
|
|
|
|
include(FindThreads)
|
|
|
|
|
|
|
|
if(CMAKE_HAVE_THREADS_LIBRARY)
|
|
|
|
add_definitions("-D_THREAD_SAFE -D_REENTRANT")
|
|
|
|
set(USE_THREADS 1)
|
|
|
|
set(FLTK_THREADS_FOUND TRUE)
|
|
|
|
endif(CMAKE_HAVE_THREADS_LIBRARY)
|
|
|
|
|
|
|
|
if(CMAKE_USE_PTHREADS_INIT AND NOT WIN32)
|
|
|
|
set(HAVE_PTHREAD 1)
|
|
|
|
if(NOT APPLE)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
|
|
|
|
endif(NOT APPLE)
|
|
|
|
list(APPEND FLTK_LDLIBS -lpthread)
|
|
|
|
list(APPEND FLTK_CFLAGS -D_THREAD_SAFE -D_REENTRANT)
|
|
|
|
set(FLTK_PTHREADS_FOUND TRUE)
|
2016-12-06 22:20:34 +03:00
|
|
|
else()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HAVE_PTHREAD 0)
|
|
|
|
set(HAVE_PTHREAD_H 0)
|
|
|
|
set(FLTK_PTHREADS_FOUND FALSE)
|
|
|
|
endif(CMAKE_USE_PTHREADS_INIT AND NOT WIN32)
|
2016-12-06 22:20:34 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
else(FLTK_USE_PTHREADS)
|
2016-12-06 22:20:34 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HAVE_PTHREAD_H 0)
|
2016-12-06 22:20:34 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_USE_PTHREADS)
|
2016-12-06 22:20:34 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(debug_threads 0) # set to 1 to show debug info
|
|
|
|
if(debug_threads)
|
|
|
|
message("")
|
|
|
|
message(STATUS "options.cmake: set debug_threads to 0 to disable the following info:")
|
|
|
|
fl_debug_var(FLTK_USE_PTHREADS)
|
2018-02-09 23:51:15 +03:00
|
|
|
fl_debug_var(HAVE_PTHREAD)
|
|
|
|
fl_debug_var(HAVE_PTHREAD_H)
|
|
|
|
fl_debug_var(FLTK_THREADS_FOUND)
|
|
|
|
fl_debug_var(CMAKE_EXE_LINKER_FLAGS)
|
2024-02-07 20:30:11 +03:00
|
|
|
message(STATUS "options.cmake: end of debug_threads info.")
|
|
|
|
endif(debug_threads)
|
|
|
|
unset(debug_threads)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2022-04-05 16:36:28 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
if(X11_Xinerama_FOUND)
|
|
|
|
option(FLTK_USE_XINERAMA "use lib Xinerama" ON)
|
|
|
|
endif(X11_Xinerama_FOUND)
|
|
|
|
|
|
|
|
if(FLTK_USE_XINERAMA)
|
|
|
|
set(HAVE_XINERAMA ${X11_Xinerama_FOUND})
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${X11_Xinerama_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXinerama)
|
|
|
|
set(FLTK_XINERAMA_FOUND TRUE)
|
2014-02-09 22:41:29 +04:00
|
|
|
else()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_XINERAMA_FOUND FALSE)
|
|
|
|
endif(FLTK_USE_XINERAMA)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
if(X11_Xfixes_FOUND)
|
|
|
|
option(FLTK_USE_XFIXES "use lib Xfixes" ON)
|
|
|
|
endif(X11_Xfixes_FOUND)
|
|
|
|
|
|
|
|
if(FLTK_USE_XFIXES)
|
|
|
|
set(HAVE_XFIXES ${X11_Xfixes_FOUND})
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${X11_Xfixes_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXfixes)
|
|
|
|
set(FLTK_XFIXES_FOUND TRUE)
|
2014-02-09 22:41:29 +04:00
|
|
|
else()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_XFIXES_FOUND FALSE)
|
|
|
|
endif(FLTK_USE_XFIXES)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2014-06-16 15:17:57 +04:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
if(X11_Xcursor_FOUND)
|
|
|
|
option(FLTK_USE_XCURSOR "use lib Xcursor" ON)
|
|
|
|
endif(X11_Xcursor_FOUND)
|
|
|
|
|
|
|
|
if(FLTK_USE_XCURSOR)
|
|
|
|
set(HAVE_XCURSOR ${X11_Xcursor_FOUND})
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${X11_Xcursor_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXcursor)
|
|
|
|
set(FLTK_XCURSOR_FOUND TRUE)
|
2014-06-16 15:17:57 +04:00
|
|
|
else()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_XCURSOR_FOUND FALSE)
|
|
|
|
endif(FLTK_USE_XCURSOR)
|
2014-06-16 15:17:57 +04:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
if(X11_Xft_FOUND)
|
|
|
|
option(FLTK_USE_XFT "use lib Xft" ON)
|
|
|
|
option(FLTK_USE_PANGO "use lib Pango" OFF)
|
|
|
|
if(NOT FLTK_BACKEND_WAYLAND)
|
|
|
|
option(FLTK_GRAPHICS_CAIRO "all drawing to X11 windows uses Cairo" OFF)
|
|
|
|
endif(NOT FLTK_BACKEND_WAYLAND)
|
|
|
|
endif(X11_Xft_FOUND)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2022-03-15 08:42:06 +03:00
|
|
|
# test option compatibility: Cairo for Xlib requires Pango
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_GRAPHICS_CAIRO)
|
2024-02-10 18:27:38 +03:00
|
|
|
unset(FLTK_USE_PANGO CACHE)
|
|
|
|
set(FLTK_USE_PANGO TRUE CACHE BOOL "use lib Pango")
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(FLTK_GRAPHICS_CAIRO)
|
|
|
|
|
2024-02-10 18:27:38 +03:00
|
|
|
if(FLTK_USE_PANGO OR FLTK_GRAPHICS_CAIRO) # implies to use PANGOXFT
|
|
|
|
set(USE_PANGOXFT true)
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
2022-10-16 09:29:59 +03:00
|
|
|
|
2018-01-14 22:34:39 +03:00
|
|
|
# test option compatibility: Pango requires Xft
|
2024-02-07 20:30:11 +03:00
|
|
|
if(USE_PANGOXFT)
|
|
|
|
if(NOT X11_Xft_FOUND)
|
|
|
|
message(STATUS "Pango requires Xft but Xft library or headers could not be found.")
|
|
|
|
message(STATUS "Please install Xft development files and try again or disable FLTK_USE_PANGO.")
|
|
|
|
message(FATAL_ERROR "*** Aborting ***")
|
|
|
|
else()
|
|
|
|
if(NOT FLTK_USE_XFT)
|
|
|
|
message(STATUS "Pango requires Xft but usage of Xft was disabled.")
|
|
|
|
message(STATUS "Please enable FLTK_USE_XFT and try again or disable FLTK_USE_PANGO.")
|
|
|
|
message(FATAL_ERROR "*** Aborting ***")
|
|
|
|
endif(NOT FLTK_USE_XFT)
|
|
|
|
endif(NOT X11_Xft_FOUND)
|
|
|
|
endif(USE_PANGOXFT)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
if((X11_Xft_FOUND OR NOT USE_PANGOXFT) AND FLTK_USE_PANGO)
|
2022-03-13 23:52:18 +03:00
|
|
|
pkg_check_modules(CAIRO cairo)
|
2024-02-07 20:30:11 +03:00
|
|
|
if(USE_PANGOXFT)
|
2022-10-16 09:29:59 +03:00
|
|
|
pkg_check_modules(PANGOXFT pangoxft)
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(USE_PANGOXFT)
|
2020-10-28 19:19:05 +03:00
|
|
|
pkg_check_modules(PANGOCAIRO pangocairo)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if((PANGOXFT_FOUND OR NOT USE_PANGOXFT) AND PANGOCAIRO_FOUND AND CAIRO_FOUND)
|
|
|
|
if(USE_PANGOXFT)
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${PANGOXFT_INCLUDE_DIRS})
|
|
|
|
else()
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${PANGOCAIRO_INCLUDE_DIRS})
|
|
|
|
endif(USE_PANGOXFT)
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${CAIRO_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
mark_as_advanced(HAVE_LIB_PANGO)
|
|
|
|
|
|
|
|
if(USE_PANGOXFT)
|
|
|
|
find_library(HAVE_LIB_PANGOXFT pangoxft-1.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
mark_as_advanced(HAVE_LIB_PANGOXFT)
|
|
|
|
endif(USE_PANGOXFT)
|
|
|
|
|
|
|
|
find_library(HAVE_LIB_PANGOCAIRO pangocairo-1.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
mark_as_advanced(HAVE_LIB_PANGOCAIRO)
|
|
|
|
|
|
|
|
find_library(HAVE_LIB_CAIRO cairo ${CMAKE_LIBRARY_PATH})
|
|
|
|
mark_as_advanced(HAVE_LIB_CAIRO)
|
|
|
|
|
|
|
|
find_library(HAVE_LIB_GOBJECT gobject-2.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
mark_as_advanced(HAVE_LIB_GOBJECT)
|
|
|
|
|
|
|
|
set(USE_PANGO TRUE)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
|
|
|
# add required libraries to fltk-config ...
|
2024-02-07 20:30:11 +03:00
|
|
|
if(USE_PANGOXFT)
|
|
|
|
list(APPEND FLTK_LDLIBS ${PANGOXFT_LDFLAGS})
|
|
|
|
endif(USE_PANGOXFT)
|
|
|
|
list(APPEND FLTK_LDLIBS ${PANGOCAIRO_LDFLAGS})
|
2024-02-10 18:27:38 +03:00
|
|
|
list(REMOVE_DUPLICATES FLTK_LDLIBS)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
|
|
|
# *FIXME* Libraries should not be added explicitly if possible
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_BACKEND_WAYLAND)
|
|
|
|
list(APPEND FLTK_LDLIBS -lgtk-3 -lgdk-3 -lgio-2.0)
|
|
|
|
if(FLTK_BACKEND_X11)
|
|
|
|
list(APPEND FLTK_LDLIBS -lX11)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-02-10 18:27:38 +03:00
|
|
|
list(REMOVE_DUPLICATES FLTK_LDLIBS)
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE)
|
2020-08-26 22:37:26 +03:00
|
|
|
get_filename_component(PANGO_L_PATH ${HAVE_LIB_PANGO} PATH)
|
2024-02-07 20:30:11 +03:00
|
|
|
set(LDFLAGS "${LDFLAGS} -L${PANGO_L_PATH}")
|
|
|
|
endif(APPLE)
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
else()
|
2022-03-13 23:52:18 +03:00
|
|
|
|
|
|
|
# this covers Debian, Ubuntu, FreeBSD, NetBSD, Darwin
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE AND FLTK_BACKEND_X11)
|
2022-03-13 23:52:18 +03:00
|
|
|
find_file(FINK_PREFIX NAMES /opt/sw /sw)
|
2024-02-24 21:20:22 +03:00
|
|
|
if(FINK_PREFIX)
|
|
|
|
list(APPEND CMAKE_INCLUDE_PATH ${FINK_PREFIX}/include)
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${FINK_PREFIX}/include/cairo)
|
|
|
|
list(APPEND CMAKE_LIBRARY_PATH ${FINK_PREFIX}/lib)
|
|
|
|
endif(FINK_PREFIX)
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(APPLE AND FLTK_BACKEND_X11)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
|
|
|
find_file(HAVE_PANGO_H pango-1.0/pango/pango.h ${CMAKE_INCLUDE_PATH})
|
|
|
|
find_file(HAVE_PANGOXFT_H pango-1.0/pango/pangoxft.h ${CMAKE_INCLUDE_PATH})
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(HAVE_PANGO_H AND HAVE_PANGOXFT_H)
|
2022-03-13 23:52:18 +03:00
|
|
|
find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
find_library(HAVE_LIB_PANGOXFT pangoxft-1.0 ${CMAKE_LIBRARY_PATH})
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE)
|
|
|
|
set(HAVE_LIB_GOBJECT TRUE)
|
2022-03-13 23:52:18 +03:00
|
|
|
else()
|
|
|
|
find_library(HAVE_LIB_GOBJECT gobject-2.0 ${CMAKE_LIBRARY_PATH})
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(APPLE)
|
|
|
|
endif(HAVE_PANGO_H AND HAVE_PANGOXFT_H)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(HAVE_LIB_PANGO AND HAVE_LIB_PANGOXFT AND HAVE_LIB_GOBJECT)
|
|
|
|
set(USE_PANGO TRUE)
|
2022-03-13 23:52:18 +03:00
|
|
|
# remove last 3 components of HAVE_PANGO_H and put in PANGO_H_PREFIX
|
|
|
|
get_filename_component(PANGO_H_PREFIX ${HAVE_PANGO_H} PATH)
|
|
|
|
get_filename_component(PANGO_H_PREFIX ${PANGO_H_PREFIX} PATH)
|
|
|
|
get_filename_component(PANGO_H_PREFIX ${PANGO_H_PREFIX} PATH)
|
|
|
|
|
|
|
|
get_filename_component(PANGOLIB_DIR ${HAVE_LIB_PANGO} PATH)
|
|
|
|
# glib.h is usually in ${PANGO_H_PREFIX}/glib-2.0/ ...
|
|
|
|
find_path(GLIB_H_PATH glib.h
|
|
|
|
PATHS ${PANGO_H_PREFIX}/glib-2.0
|
|
|
|
${PANGO_H_PREFIX}/glib/glib-2.0)
|
2024-02-07 20:30:11 +03:00
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${PANGO_H_PREFIX}/pango-1.0 ${GLIB_H_PATH} ${PANGOLIB_DIR}/glib-2.0/include)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
|
|
|
# *FIXME* Libraries should not be added explicitly if possible
|
2024-02-07 20:30:11 +03:00
|
|
|
list(APPEND FLTK_LDLIBS -lpango-1.0 -lpangoxft-1.0 -lgobject-2.0)
|
2022-03-13 23:52:18 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(HAVE_LIB_PANGO AND HAVE_LIB_PANGOXFT AND HAVE_LIB_GOBJECT)
|
|
|
|
endif((PANGOXFT_FOUND OR NOT USE_PANGOXFT) AND PANGOCAIRO_FOUND AND CAIRO_FOUND)
|
2016-12-21 18:05:02 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(USE_PANGO AND (FLTK_GRAPHICS_CAIRO OR FLTK_BACKEND_WAYLAND))
|
|
|
|
set(FLTK_USE_CAIRO 1)
|
|
|
|
# fl_debug_var(FLTK_USE_CAIRO)
|
|
|
|
endif()
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif((X11_Xft_FOUND OR NOT USE_PANGOXFT) AND FLTK_USE_PANGO)
|
2022-03-04 17:40:29 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_BACKEND_WAYLAND)
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# Note: Disable FLTK_USE_LIBDECOR_GTK to get cairo titlebars rather than GTK
|
|
|
|
if(FLTK_USE_LIBDECOR_GTK)
|
2022-03-15 08:42:06 +03:00
|
|
|
pkg_check_modules(GTK gtk+-3.0)
|
2024-02-07 20:30:11 +03:00
|
|
|
if(GTK_FOUND)
|
2024-02-10 18:27:38 +03:00
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${GTK_INCLUDE_DIRS})
|
2024-02-07 20:30:11 +03:00
|
|
|
else()
|
2022-11-24 09:22:27 +03:00
|
|
|
message(WARNING "Installation of the development files for the GTK library "
|
|
|
|
"(e.g., libgtk-3-dev) is recommended when using the gnome desktop.")
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(GTK_FOUND)
|
|
|
|
endif(FLTK_USE_LIBDECOR_GTK)
|
2022-03-15 08:42:06 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
2020-06-13 16:19:27 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(FLTK_USE_XFT)
|
|
|
|
set(USE_XFT X11_Xft_FOUND)
|
|
|
|
list(APPEND FLTK_LDLIBS -lXft)
|
|
|
|
set(FLTK_XFT_FOUND TRUE)
|
|
|
|
if(APPLE AND FLTK_BACKEND_X11)
|
2020-06-13 16:19:27 +03:00
|
|
|
find_library(LIB_fontconfig fontconfig "/opt/X11/lib")
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
2014-02-09 22:41:29 +04:00
|
|
|
else()
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_XFT_FOUND FALSE)
|
|
|
|
endif(FLTK_USE_XFT)
|
2020-06-13 16:19:27 +03:00
|
|
|
|
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
if(X11_Xrender_FOUND)
|
|
|
|
option(FLTK_USE_XRENDER "use lib Xrender" ON)
|
|
|
|
endif(X11_Xrender_FOUND)
|
|
|
|
|
|
|
|
if(FLTK_USE_XRENDER)
|
|
|
|
set(HAVE_XRENDER ${X11_Xrender_FOUND})
|
|
|
|
if(HAVE_XRENDER)
|
|
|
|
list(APPEND FLTK_BUILD_INCLUDE_DIRECTORIES ${X11_Xrender_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXrender)
|
|
|
|
set(FLTK_XRENDER_FOUND TRUE)
|
2020-06-13 16:19:27 +03:00
|
|
|
else(HAVE_XRENDER)
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FLTK_XRENDER_FOUND FALSE)
|
|
|
|
endif(HAVE_XRENDER)
|
|
|
|
else(FLTK_USE_XRENDER)
|
|
|
|
set(FLTK_XRENDER_FOUND FALSE)
|
|
|
|
endif(FLTK_USE_XRENDER)
|
2015-12-30 17:37:35 +03:00
|
|
|
|
2016-02-05 19:34:42 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FL_NO_PRINT_SUPPORT FALSE)
|
|
|
|
if(X11_FOUND AND NOT FLTK_OPTION_PRINT_SUPPORT)
|
|
|
|
set(FL_NO_PRINT_SUPPORT TRUE)
|
|
|
|
endif(X11_FOUND AND NOT FLTK_OPTION_PRINT_SUPPORT)
|
2016-02-05 19:34:42 +03:00
|
|
|
#######################################################################
|
|
|
|
|
2016-02-10 15:22:38 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
set(FL_CFG_NO_FILESYSTEM_SUPPORT TRUE)
|
|
|
|
if(FLTK_OPTION_FILESYSTEM_SUPPORT)
|
|
|
|
set(FL_CFG_NO_FILESYSTEM_SUPPORT FALSE)
|
|
|
|
endif(FLTK_OPTION_FILESYSTEM_SUPPORT)
|
2016-02-10 15:22:38 +03:00
|
|
|
#######################################################################
|
|
|
|
|
2021-12-08 11:40:57 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
option(FLTK_USE_KDIALOG "Fl_Native_File_Chooser may run kdialog" ON)
|
|
|
|
if(FLTK_USE_KDIALOG)
|
|
|
|
set(USE_KDIALOG 1)
|
|
|
|
else()
|
|
|
|
set(USE_KDIALOG 0)
|
|
|
|
endif()
|
2021-12-08 11:40:57 +03:00
|
|
|
#######################################################################
|
2019-01-15 01:27:34 +03:00
|
|
|
|
2015-04-26 01:57:17 +03:00
|
|
|
#######################################################################
|
2024-02-07 20:30:11 +03:00
|
|
|
option(CMAKE_SUPPRESS_REGENERATION "suppress rules to re-run CMake on rebuild" OFF)
|
|
|
|
mark_as_advanced(CMAKE_SUPPRESS_REGENERATION)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Clean up ...
|
|
|
|
|
|
|
|
# *** FIXME *** Do we need all these variables ?
|
|
|
|
|
|
|
|
list(REMOVE_DUPLICATES FLTK_BUILD_INCLUDE_DIRECTORIES)
|
|
|
|
list(REMOVE_DUPLICATES FLTK_IMAGE_INCLUDE_DIRECTORIES)
|
|
|
|
list(REMOVE_DUPLICATES FLTK_IMAGE_LIBRARIES)
|
2018-02-23 22:41:52 +03:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Debugging ...
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(DEBUG_OPTIONS_CMAKE)
|
|
|
|
message(STATUS "") # empty line
|
|
|
|
fl_debug_var(WIN32)
|
|
|
|
fl_debug_var(LIBS)
|
|
|
|
fl_debug_var(GLLIBS)
|
|
|
|
fl_debug_var(FLTK_LDLIBS)
|
|
|
|
fl_debug_var(OPENGL_FOUND)
|
|
|
|
fl_debug_var(OPENGL_INCLUDE_DIR)
|
|
|
|
fl_debug_var(OPENGL_LIBRARIES)
|
|
|
|
fl_debug_var(CMAKE_MSVC_RUNTIME_LIBRARY)
|
|
|
|
message("--- bundled libraries ---")
|
|
|
|
fl_debug_var(FLTK_USE_SYSTEM_LIBJPEG)
|
|
|
|
fl_debug_var(FLTK_USE_SYSTEM_LIBPNG)
|
|
|
|
fl_debug_var(FLTK_USE_SYSTEM_ZLIB)
|
|
|
|
fl_debug_var(FLTK_USE_BUNDLED_JPEG)
|
|
|
|
fl_debug_var(FLTK_USE_BUNDLED_PNG)
|
|
|
|
fl_debug_var(FLTK_USE_BUNDLED_ZLIB)
|
|
|
|
|
|
|
|
message(STATUS "--- *FIXME* include directories ---")
|
|
|
|
fl_debug_var(FLTK_BUILD_INCLUDE_DIRECTORIES)
|
|
|
|
fl_debug_var(FLTK_IMAGE_INCLUDE_DIRECTORIES)
|
|
|
|
|
|
|
|
message("--- X11 ---")
|
|
|
|
fl_debug_var(X11_FOUND)
|
|
|
|
fl_debug_var(X11_INCLUDE_DIR)
|
|
|
|
fl_debug_var(X11_LIBRARIES)
|
|
|
|
fl_debug_var(X11_X11_LIB)
|
|
|
|
fl_debug_var(X11_X11_INCLUDE_PATH)
|
|
|
|
fl_debug_var(X11_Xft_INCLUDE_PATH)
|
|
|
|
fl_debug_var(X11_Xft_LIB)
|
|
|
|
fl_debug_var(X11_Xft_FOUND)
|
|
|
|
fl_debug_var(PATH_TO_XLIBS)
|
|
|
|
message(STATUS "[** end of options.cmake **]")
|
|
|
|
endif(DEBUG_OPTIONS_CMAKE)
|
|
|
|
unset(DEBUG_OPTIONS_CMAKE)
|