2014-02-09 22:41:29 +04:00
|
|
|
#
|
2014-11-22 03:42:44 +03:00
|
|
|
# "$Id$"
|
2014-02-09 22:41:29 +04:00
|
|
|
#
|
|
|
|
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
|
|
|
# Written by Michael Surette
|
|
|
|
#
|
2018-01-10 23:49:03 +03:00
|
|
|
# Copyright 1998-2018 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:
|
|
|
|
#
|
|
|
|
# http://www.fltk.org/COPYING.php
|
|
|
|
#
|
|
|
|
# Please report all bugs and problems on the following page:
|
|
|
|
#
|
|
|
|
# http://www.fltk.org/str.php
|
|
|
|
#
|
|
|
|
|
2018-02-23 22:41:52 +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-24 16:44:06 +03:00
|
|
|
# *Temporary* option to modify header file searches
|
|
|
|
#######################################################################
|
|
|
|
# Note: The old, deprecated behavior (ON) was to use find_file() for
|
|
|
|
# header searches, the new behavior (ON) is to use check_include_files()
|
|
|
|
# which seems to be more reliable but more difficult to set up and
|
|
|
|
# slower because it uses a compilation test. Default is "new" (OFF).
|
|
|
|
# This option should be removed as soon as the new search strategy
|
|
|
|
# is considered stable.
|
|
|
|
# Currently used only in resources.cmake.
|
2018-02-23 22:41:52 +03:00
|
|
|
#######################################################################
|
|
|
|
option(USE_FIND_FILE
|
2018-02-24 16:44:06 +03:00
|
|
|
"Deprecated: use find_file() for header searches. Should be OFF."
|
2018-02-23 22:41:52 +03:00
|
|
|
OFF
|
|
|
|
)
|
|
|
|
mark_as_advanced(USE_FIND_FILE)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
# options
|
|
|
|
#######################################################################
|
|
|
|
set(OPTION_OPTIM ""
|
|
|
|
CACHE STRING
|
|
|
|
"custom optimization flags"
|
|
|
|
)
|
|
|
|
add_definitions(${OPTION_OPTIM})
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
set(OPTION_ARCHFLAGS ""
|
|
|
|
CACHE STRING
|
|
|
|
"custom architecture flags"
|
|
|
|
)
|
|
|
|
add_definitions(${OPTION_ARCHFLAGS})
|
|
|
|
|
2015-07-12 22:23:55 +03:00
|
|
|
#######################################################################
|
|
|
|
set(OPTION_ABI_VERSION ""
|
|
|
|
CACHE STRING
|
2016-07-09 21:47:06 +03:00
|
|
|
"FLTK ABI Version FL_ABI_VERSION: 1xxyy for 1.x.y (xx,yy with leading zero)"
|
2015-07-12 22:23:55 +03:00
|
|
|
)
|
|
|
|
set(FL_ABI_VERSION ${OPTION_ABI_VERSION})
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
#######################################################################
|
2018-02-23 22:41:52 +03:00
|
|
|
if (UNIX)
|
2018-02-24 16:44:06 +03:00
|
|
|
option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
|
2018-02-23 22:41:52 +03:00
|
|
|
endif (UNIX)
|
|
|
|
|
2017-07-18 23:15:02 +03:00
|
|
|
#######################################################################
|
2018-02-25 22:25:45 +03:00
|
|
|
if (APPLE)
|
|
|
|
option (OPTION_APPLE_X11 "use X11" OFF)
|
|
|
|
option (OPTION_APPLE_SDL "use SDL" OFF)
|
|
|
|
endif (APPLE)
|
|
|
|
|
|
|
|
# find X11 libraries and headers
|
|
|
|
set (PATH_TO_XLIBS)
|
|
|
|
if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
|
|
|
include (FindX11)
|
|
|
|
if (X11_FOUND)
|
|
|
|
set (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 ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32)
|
2016-12-06 22:20:34 +03:00
|
|
|
|
2016-12-01 09:31:25 +03:00
|
|
|
if (OPTION_APPLE_X11)
|
2018-02-25 22:25:45 +03:00
|
|
|
include_directories (AFTER SYSTEM /opt/X11/include/freetype2)
|
|
|
|
if (PATH_TO_XLIBS)
|
|
|
|
set (LDFLAGS "-L${PATH_TO_XLIBS} ${LDFLAGS}")
|
|
|
|
endif (PATH_TO_XLIBS)
|
|
|
|
if (X11_INCLUDE_DIR)
|
|
|
|
list (APPEND FLTK_CFLAGS "-I${X11_INCLUDE_DIR}")
|
|
|
|
endif (X11_INCLUDE_DIR)
|
2016-12-01 09:31:25 +03:00
|
|
|
endif (OPTION_APPLE_X11)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2016-03-02 03:54:37 +03:00
|
|
|
if (OPTION_APPLE_SDL)
|
2018-02-25 22:25:45 +03:00
|
|
|
find_package (SDL2 REQUIRED)
|
|
|
|
if (SDL2_FOUND)
|
|
|
|
set (USE_SDL 1)
|
|
|
|
list (APPEND FLTK_LDLIBS SDL2_LIBRARY)
|
|
|
|
endif (SDL2_FOUND)
|
|
|
|
endif (OPTION_APPLE_SDL)
|
2016-03-02 03:54:37 +03:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
option(OPTION_USE_POLL "use poll if available" OFF)
|
2016-03-05 16:29:46 +03:00
|
|
|
mark_as_advanced(OPTION_USE_POLL)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
if(OPTION_USE_POLL)
|
|
|
|
CHECK_FUNCTION_EXISTS(poll USE_POLL)
|
|
|
|
endif(OPTION_USE_POLL)
|
|
|
|
|
|
|
|
#######################################################################
|
2014-09-27 04:41:06 +04:00
|
|
|
option(OPTION_BUILD_SHARED_LIBS
|
|
|
|
"Build shared libraries(in addition to static libraries)"
|
|
|
|
OFF
|
|
|
|
)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
option(OPTION_BUILD_EXAMPLES "build example programs" ON)
|
2016-02-05 19:34:42 +03:00
|
|
|
option(OPTION_PRINT_SUPPORT "allow print support" ON)
|
2016-02-10 15:22:38 +03:00
|
|
|
option(OPTION_FILESYSTEM_SUPPORT "allow file system support" ON)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2015-04-26 00:42:51 +03:00
|
|
|
#######################################################################
|
|
|
|
if(DOXYGEN_FOUND)
|
|
|
|
option(OPTION_BUILD_HTML_DOCUMENTATION "build html docs" OFF)
|
|
|
|
option(OPTION_INSTALL_HTML_DOCUMENTATION "install html docs" OFF)
|
2018-12-29 22:04:38 +03:00
|
|
|
|
|
|
|
option(OPTION_INCLUDE_DRIVER_DOCUMENTATION "include driver (developer) docs" OFF)
|
|
|
|
mark_as_advanced(OPTION_INCLUDE_DRIVER_DOCUMENTATION)
|
|
|
|
|
2015-04-26 00:42:51 +03:00
|
|
|
if(LATEX_FOUND)
|
2018-12-23 00:01:20 +03:00
|
|
|
option(OPTION_BUILD_PDF_DOCUMENTATION "build pdf docs" OFF)
|
|
|
|
option(OPTION_INSTALL_PDF_DOCUMENTATION "install pdf docs" OFF)
|
2015-04-26 00:42:51 +03:00
|
|
|
endif(LATEX_FOUND)
|
|
|
|
endif(DOXYGEN_FOUND)
|
|
|
|
|
|
|
|
if(OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
|
|
|
|
add_subdirectory(documentation)
|
|
|
|
endif(OPTION_BUILD_HTML_DOCUMENTATION OR OPTION_BUILD_PDF_DOCUMENTATION)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
include(FindPkgConfig)
|
|
|
|
|
|
|
|
option(OPTION_CAIRO "use lib Cairo" OFF)
|
|
|
|
option(OPTION_CAIROEXT
|
2018-12-20 21:12:50 +03:00
|
|
|
"use FLTK code instrumentation for Cairo extended use" OFF
|
2014-02-09 22:41:29 +04:00
|
|
|
)
|
|
|
|
|
2018-12-20 21:12:50 +03:00
|
|
|
if ((OPTION_CAIRO OR OPTION_CAIROEXT) AND LIB_CAIRO)
|
2014-02-09 22:41:29 +04:00
|
|
|
pkg_search_module(PKG_CAIRO cairo)
|
2018-12-20 21:12:50 +03:00
|
|
|
endif ((OPTION_CAIRO OR OPTION_CAIROEXT) AND LIB_CAIRO)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-12-20 21:12:50 +03:00
|
|
|
if (PKG_CAIRO_FOUND)
|
|
|
|
set (FLTK_HAVE_CAIRO 1)
|
2014-02-09 22:41:29 +04:00
|
|
|
add_subdirectory(cairo)
|
|
|
|
list(APPEND FLTK_LDLIBS -lcairo -lpixman-1)
|
|
|
|
include_directories(${PKG_CAIRO_INCLUDE_DIRS})
|
|
|
|
string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}")
|
|
|
|
|
2018-12-22 17:26:56 +03:00
|
|
|
if (LIB_CAIRO AND OPTION_CAIROEXT)
|
2018-12-23 00:01:20 +03:00
|
|
|
set(FLTK_USE_CAIRO 1)
|
|
|
|
set(FLTK_CAIRO_FOUND TRUE)
|
2018-12-22 17:26:56 +03:00
|
|
|
else ()
|
2018-12-23 00:01:20 +03:00
|
|
|
set(FLTK_CAIRO_FOUND FALSE)
|
2018-12-22 17:26:56 +03:00
|
|
|
endif (LIB_CAIRO AND OPTION_CAIROEXT)
|
|
|
|
else ()
|
2018-12-22 19:35:52 +03:00
|
|
|
if (OPTION_CAIRO OR OPTION_CAIROEXT)
|
2018-12-23 00:01:20 +03:00
|
|
|
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.")
|
2018-12-22 19:35:52 +03:00
|
|
|
endif (OPTION_CAIRO OR OPTION_CAIROEXT)
|
2018-12-22 17:26:56 +03:00
|
|
|
endif (PKG_CAIRO_FOUND)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2017-09-03 16:14:25 +03:00
|
|
|
#######################################################################
|
|
|
|
option(OPTION_USE_NANOSVG "support SVG images" ON)
|
|
|
|
|
|
|
|
if(OPTION_USE_NANOSVG)
|
|
|
|
set(FLTK_USE_NANOSVG 1)
|
|
|
|
endif(OPTION_USE_NANOSVG)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
set(HAVE_GL LIB_GL OR LIB_MesaGL)
|
|
|
|
|
|
|
|
if(HAVE_GL)
|
|
|
|
option(OPTION_USE_GL "use OpenGL" ON)
|
|
|
|
endif(HAVE_GL)
|
|
|
|
|
|
|
|
if(OPTION_USE_GL)
|
2015-12-31 09:19:59 +03:00
|
|
|
if(OPTION_APPLE_X11)
|
2016-02-03 13:20:03 +03:00
|
|
|
set(OPENGL_FOUND TRUE)
|
|
|
|
set(OPENGL_LIBRARIES -L${PATH_TO_XLIBS} -lGLU -lGL)
|
2018-12-16 21:01:56 +03:00
|
|
|
set(HAVE_GL_GLU_H /opt/X11/include/GL/glu.h)
|
2016-03-02 03:54:37 +03:00
|
|
|
elseif(OPTION_APPLE_SDL)
|
|
|
|
set(OPENGL_FOUND FALSE)
|
2016-02-03 13:20:03 +03:00
|
|
|
else()
|
|
|
|
include(FindOpenGL)
|
2016-08-05 20:14:55 +03:00
|
|
|
if(APPLE)
|
|
|
|
set(HAVE_GL_GLU_H ${HAVE_OPENGL_GLU_H})
|
|
|
|
endif(APPLE)
|
2015-12-31 09:19:59 +03:00
|
|
|
endif(OPTION_APPLE_X11)
|
2018-02-24 16:44:06 +03:00
|
|
|
else ()
|
|
|
|
set(OPENGL_FOUND FALSE)
|
2014-02-09 22:41:29 +04:00
|
|
|
endif(OPTION_USE_GL)
|
|
|
|
|
2018-02-23 22:41:52 +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...
|
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (WIN32)
|
|
|
|
set (GLLIBS "-lglu32 -lopengl32")
|
2018-02-24 16:44:06 +03:00
|
|
|
elseif (APPLE AND NOT OPTION_APPLE_X11)
|
|
|
|
set (GLLIBS "-framework OpenGL")
|
2018-02-23 22:41:52 +03:00
|
|
|
else ()
|
|
|
|
set (GLLIBS "-lGLU -lGL")
|
2018-02-24 16:44:06 +03:00
|
|
|
endif (WIN32)
|
2015-12-30 17:37:35 +03:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
# check if function glXGetProcAddressARB exists
|
|
|
|
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
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
set (FLTK_GL_FOUND TRUE)
|
|
|
|
else ()
|
|
|
|
set (FLTK_GL_FOUND FALSE)
|
2018-02-24 16:44:06 +03:00
|
|
|
set (GLLIBS)
|
2018-02-23 22:41:52 +03:00
|
|
|
endif (OPENGL_FOUND)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-25 22:25:45 +03:00
|
|
|
#######################################################################
|
|
|
|
option (OPTION_LARGE_FILE "enable large file support" ON)
|
|
|
|
|
|
|
|
if (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 (OPTION_LARGE_FILE)
|
|
|
|
|
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).
|
|
|
|
|
|
|
|
if (WIN32 AND NOT CYGWIN)
|
|
|
|
# set(HAVE_PTHREAD_H 0) # (see resources.cmake)
|
|
|
|
set(OPTION_USE_THREADS FALSE)
|
|
|
|
else ()
|
|
|
|
option(OPTION_USE_THREADS "use multi-threading with pthreads" ON)
|
|
|
|
endif (WIN32 AND NOT CYGWIN)
|
|
|
|
|
|
|
|
# initialize more variables
|
|
|
|
set(USE_THREADS 0)
|
|
|
|
set(HAVE_PTHREAD 0)
|
|
|
|
set(FLTK_PTHREADS_FOUND FALSE)
|
|
|
|
|
|
|
|
if (OPTION_USE_THREADS)
|
|
|
|
|
|
|
|
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)
|
|
|
|
else()
|
|
|
|
set(HAVE_PTHREAD 0)
|
|
|
|
set(HAVE_PTHREAD_H 0)
|
|
|
|
set(FLTK_PTHREADS_FOUND FALSE)
|
|
|
|
endif(CMAKE_USE_PTHREADS_INIT AND NOT WIN32)
|
|
|
|
|
|
|
|
else (OPTION_USE_THREADS)
|
|
|
|
|
|
|
|
set(HAVE_PTHREAD_H 0)
|
|
|
|
|
|
|
|
endif (OPTION_USE_THREADS)
|
|
|
|
|
2018-02-09 23:51:15 +03:00
|
|
|
set (debug_threads 0) # set to 1 to show debug info
|
2016-12-06 22:20:34 +03:00
|
|
|
if (debug_threads)
|
|
|
|
message ("")
|
2018-02-09 23:51:15 +03:00
|
|
|
message (STATUS "options.cmake: set debug_threads to 0 to disable the following info:")
|
|
|
|
fl_debug_var(OPTION_USE_THREADS)
|
|
|
|
fl_debug_var(HAVE_PTHREAD)
|
|
|
|
fl_debug_var(HAVE_PTHREAD_H)
|
|
|
|
fl_debug_var(FLTK_THREADS_FOUND)
|
|
|
|
fl_debug_var(CMAKE_EXE_LINKER_FLAGS)
|
|
|
|
message (STATUS "options.cmake: end of debug_threads info.")
|
2016-12-06 22:20:34 +03:00
|
|
|
endif (debug_threads)
|
2018-02-09 23:51:15 +03:00
|
|
|
unset (debug_threads)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
2018-02-23 22:41:52 +03:00
|
|
|
option (OPTION_USE_SYSTEM_ZLIB "use system zlib" ON)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (OPTION_USE_SYSTEM_ZLIB)
|
|
|
|
include (FindZLIB)
|
|
|
|
endif (OPTION_USE_SYSTEM_ZLIB)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (ZLIB_FOUND)
|
|
|
|
set (FLTK_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
|
|
|
|
include_directories (${ZLIB_INCLUDE_DIRS})
|
|
|
|
set (FLTK_BUILTIN_ZLIB_FOUND FALSE)
|
2014-02-09 22:41:29 +04:00
|
|
|
else()
|
2018-02-23 22:41:52 +03:00
|
|
|
if (OPTION_USE_SYSTEM_ZLIB)
|
|
|
|
message(STATUS "\ncannot find system zlib library - using built-in\n")
|
|
|
|
endif (OPTION_USE_SYSTEM_ZLIB)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
add_subdirectory (zlib)
|
|
|
|
set (FLTK_ZLIB_LIBRARIES fltk_z)
|
|
|
|
set (ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zlib)
|
|
|
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/zlib)
|
|
|
|
set (FLTK_BUILTIN_ZLIB_FOUND TRUE)
|
|
|
|
endif (ZLIB_FOUND)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
set (HAVE_LIBZ 1)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2014-09-27 04:41:06 +04:00
|
|
|
#######################################################################
|
2018-02-23 22:41:52 +03:00
|
|
|
option (OPTION_USE_SYSTEM_LIBJPEG "use system libjpeg" ON)
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (OPTION_USE_SYSTEM_LIBJPEG)
|
|
|
|
include (FindJPEG)
|
|
|
|
endif (OPTION_USE_SYSTEM_LIBJPEG)
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (JPEG_FOUND)
|
|
|
|
set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
|
|
|
|
include_directories(${JPEG_INCLUDE_DIR})
|
|
|
|
set(FLTK_BUILTIN_JPEG_FOUND FALSE)
|
|
|
|
else ()
|
|
|
|
if (OPTION_USE_SYSTEM_LIBJPEG)
|
|
|
|
message (STATUS "\ncannot find system jpeg library - using built-in\n")
|
|
|
|
endif (OPTION_USE_SYSTEM_LIBJPEG)
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
add_subdirectory (jpeg)
|
|
|
|
set (FLTK_JPEG_LIBRARIES fltk_jpeg)
|
|
|
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/jpeg)
|
|
|
|
set (FLTK_BUILTIN_JPEG_FOUND TRUE)
|
|
|
|
endif (JPEG_FOUND)
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
set (HAVE_LIBJPEG 1)
|
2014-09-27 04:41:06 +04:00
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
2018-02-23 22:41:52 +03:00
|
|
|
option (OPTION_USE_SYSTEM_LIBPNG "use system libpng" ON)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (OPTION_USE_SYSTEM_LIBPNG)
|
|
|
|
include (FindPNG)
|
|
|
|
endif (OPTION_USE_SYSTEM_LIBPNG)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
if (PNG_FOUND)
|
|
|
|
set (FLTK_PNG_LIBRARIES ${PNG_LIBRARIES})
|
|
|
|
include_directories (${PNG_INCLUDE_DIR})
|
|
|
|
add_definitions (${PNG_DEFINITIONS})
|
|
|
|
set (FLTK_BUILTIN_PNG_FOUND FALSE)
|
2014-02-09 22:41:29 +04:00
|
|
|
else()
|
2018-02-23 22:41:52 +03:00
|
|
|
if (OPTION_USE_SYSTEM_LIBPNG)
|
|
|
|
message (STATUS "\ncannot find system png library - using built-in\n")
|
|
|
|
endif (OPTION_USE_SYSTEM_LIBPNG)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
add_subdirectory (png)
|
|
|
|
set (FLTK_PNG_LIBRARIES fltk_png)
|
|
|
|
set (HAVE_PNG_H 1)
|
|
|
|
set (HAVE_PNG_GET_VALID 1)
|
|
|
|
set (HAVE_PNG_SET_TRNS_TO_ALPHA 1)
|
|
|
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/png)
|
|
|
|
set (FLTK_BUILTIN_PNG_FOUND TRUE)
|
|
|
|
endif (PNG_FOUND)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
2018-02-23 22:41:52 +03:00
|
|
|
set (HAVE_LIBPNG 1)
|
2014-02-09 22:41:29 +04:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
if(X11_Xinerama_FOUND)
|
|
|
|
option(OPTION_USE_XINERAMA "use lib Xinerama" ON)
|
|
|
|
endif(X11_Xinerama_FOUND)
|
|
|
|
|
|
|
|
if(OPTION_USE_XINERAMA)
|
|
|
|
set(HAVE_XINERAMA ${X11_Xinerama_FOUND})
|
|
|
|
include_directories(${X11_Xinerama_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXinerama)
|
|
|
|
set(FLTK_XINERAMA_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(FLTK_XINERAMA_FOUND FALSE)
|
|
|
|
endif(OPTION_USE_XINERAMA)
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
if(X11_Xfixes_FOUND)
|
2015-02-06 19:01:14 +03:00
|
|
|
option(OPTION_USE_XFIXES "use lib Xfixes" ON)
|
2014-02-09 22:41:29 +04:00
|
|
|
endif(X11_Xfixes_FOUND)
|
|
|
|
|
|
|
|
if(OPTION_USE_XFIXES)
|
|
|
|
set(HAVE_XFIXES ${X11_Xfixes_FOUND})
|
|
|
|
include_directories(${X11_Xfixes_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXfixes)
|
|
|
|
set(FLTK_XFIXES_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(FLTK_XFIXES_FOUND FALSE)
|
|
|
|
endif(OPTION_USE_XFIXES)
|
|
|
|
|
2014-06-16 15:17:57 +04:00
|
|
|
#######################################################################
|
|
|
|
if(X11_Xcursor_FOUND)
|
2015-02-06 19:01:14 +03:00
|
|
|
option(OPTION_USE_XCURSOR "use lib Xcursor" ON)
|
2014-06-16 15:17:57 +04:00
|
|
|
endif(X11_Xcursor_FOUND)
|
|
|
|
|
|
|
|
if(OPTION_USE_XCURSOR)
|
|
|
|
set(HAVE_XCURSOR ${X11_Xcursor_FOUND})
|
|
|
|
include_directories(${X11_Xcursor_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXcursor)
|
|
|
|
set(FLTK_XCURSOR_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(FLTK_XCURSOR_FOUND FALSE)
|
|
|
|
endif(OPTION_USE_XCURSOR)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
if(X11_Xft_FOUND)
|
|
|
|
option(OPTION_USE_XFT "use lib Xft" ON)
|
2016-12-21 18:05:02 +03:00
|
|
|
option(OPTION_USE_PANGO "use lib Pango" OFF)
|
2014-02-09 22:41:29 +04:00
|
|
|
endif(X11_Xft_FOUND)
|
|
|
|
|
2018-01-14 22:34:39 +03:00
|
|
|
# test option compatibility: Pango requires Xft
|
|
|
|
if (OPTION_USE_PANGO)
|
|
|
|
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 OPTION_USE_PANGO.")
|
|
|
|
message(FATAL_ERROR "*** Aborting ***")
|
|
|
|
else ()
|
|
|
|
if (NOT OPTION_USE_XFT)
|
|
|
|
message(STATUS "Pango requires Xft but usage of Xft was disabled.")
|
|
|
|
message(STATUS "Please enable OPTION_USE_XFT and try again or disable OPTION_USE_PANGO.")
|
|
|
|
message(FATAL_ERROR "*** Aborting ***")
|
|
|
|
endif (NOT OPTION_USE_XFT)
|
|
|
|
endif (NOT X11_Xft_FOUND)
|
|
|
|
endif (OPTION_USE_PANGO)
|
|
|
|
|
2016-12-21 18:05:02 +03:00
|
|
|
#######################################################################
|
|
|
|
if(X11_Xft_FOUND AND OPTION_USE_PANGO)
|
|
|
|
#this covers Debian, Ubuntu, FreeBSD, NetBSD, Darwin
|
2018-12-23 00:01:20 +03:00
|
|
|
if(APPLE AND OPTION_APPLE_X11)
|
2019-10-30 20:57:47 +03:00
|
|
|
find_file(FINK_PREFIX NAMES /opt/sw /sw)
|
|
|
|
list(APPEND CMAKE_INCLUDE_PATH ${FINK_PREFIX}/include)
|
2019-10-31 09:30:39 +03:00
|
|
|
list(APPEND CMAKE_LIBRARY_PATH ${FINK_PREFIX}/lib)
|
2018-12-23 00:01:20 +03:00
|
|
|
endif(APPLE AND OPTION_APPLE_X11)
|
|
|
|
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})
|
2016-12-21 18:05:02 +03:00
|
|
|
|
|
|
|
if(HAVE_PANGO_H AND HAVE_PANGOXFT_H)
|
|
|
|
find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
find_library(HAVE_LIB_PANGOXFT pangoxft-1.0 ${CMAKE_LIBRARY_PATH})
|
|
|
|
if(APPLE)
|
2018-12-23 00:01:20 +03:00
|
|
|
set(HAVE_LIB_GOBJECT TRUE)
|
2016-12-21 18:05:02 +03:00
|
|
|
else()
|
2018-12-23 00:01:20 +03:00
|
|
|
find_library(HAVE_LIB_GOBJECT gobject-2.0 ${CMAKE_LIBRARY_PATH})
|
2016-12-21 18:05:02 +03:00
|
|
|
endif(APPLE)
|
|
|
|
endif(HAVE_PANGO_H AND HAVE_PANGOXFT_H)
|
|
|
|
if(HAVE_LIB_PANGO AND HAVE_LIB_PANGOXFT AND HAVE_LIB_GOBJECT)
|
|
|
|
set(USE_PANGO TRUE)
|
2018-01-14 22:34:39 +03:00
|
|
|
# message(STATUS "USE_PANGO=" ${USE_PANGO})
|
|
|
|
# remove last 3 components of HAVE_PANGO_H and put in PANGO_H_PREFIX
|
2016-12-21 18:05:02 +03:00
|
|
|
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)
|
2018-01-14 22:34:39 +03:00
|
|
|
# glib.h is usually in ${PANGO_H_PREFIX}/glib-2.0/ ...
|
2016-12-21 18:05:02 +03:00
|
|
|
find_path(GLIB_H_PATH glib.h ${PANGO_H_PREFIX}/glib-2.0)
|
|
|
|
if(NOT GLIB_H_PATH) # ... but not under NetBSD
|
2018-01-14 22:34:39 +03:00
|
|
|
find_path(GLIB_H_PATH glib.h ${PANGO_H_PREFIX}/glib/glib-2.0)
|
2016-12-21 18:05:02 +03:00
|
|
|
endif(NOT GLIB_H_PATH)
|
|
|
|
include_directories(${PANGO_H_PREFIX}/pango-1.0 ${GLIB_H_PATH} ${PANGOLIB_DIR}/glib-2.0/include)
|
2018-02-23 22:41:52 +03:00
|
|
|
list(APPEND FLTK_LDLIBS -lpango-1.0 -lpangoxft-1.0 -lgobject-2.0)
|
2018-03-16 17:12:05 +03:00
|
|
|
if (APPLE)
|
2019-10-31 09:30:39 +03:00
|
|
|
set(LDFLAGS "${LDFLAGS} -L${FINK_PREFIX}/lib")
|
2018-03-16 17:12:05 +03:00
|
|
|
endif (APPLE)
|
2016-12-21 18:05:02 +03:00
|
|
|
endif(HAVE_LIB_PANGO AND HAVE_LIB_PANGOXFT AND HAVE_LIB_GOBJECT)
|
|
|
|
endif(X11_Xft_FOUND AND OPTION_USE_PANGO)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
if(OPTION_USE_XFT)
|
|
|
|
set(USE_XFT X11_Xft_FOUND)
|
|
|
|
list(APPEND FLTK_LDLIBS -lXft)
|
|
|
|
set(FLTK_XFT_FOUND TRUE)
|
2018-01-08 23:52:48 +03:00
|
|
|
if(APPLE AND OPTION_APPLE_X11)
|
|
|
|
find_library(LIB_fontconfig fontconfig "/opt/X11/lib")
|
|
|
|
endif(APPLE AND OPTION_APPLE_X11)
|
2014-02-09 22:41:29 +04:00
|
|
|
else()
|
|
|
|
set(FLTK_XFT_FOUND FALSE)
|
|
|
|
endif(OPTION_USE_XFT)
|
|
|
|
|
2015-12-30 17:37:35 +03:00
|
|
|
#######################################################################
|
|
|
|
if(X11_Xrender_FOUND)
|
|
|
|
option(OPTION_USE_XRENDER "use lib Xrender" ON)
|
|
|
|
endif(X11_Xrender_FOUND)
|
|
|
|
|
|
|
|
if(OPTION_USE_XRENDER)
|
|
|
|
set(HAVE_XRENDER ${X11_Xrender_FOUND})
|
|
|
|
if(HAVE_XRENDER)
|
|
|
|
include_directories(${X11_Xrender_INCLUDE_PATH})
|
|
|
|
list(APPEND FLTK_LDLIBS -lXrender)
|
|
|
|
set(FLTK_XRENDER_FOUND TRUE)
|
|
|
|
else(HAVE_XRENDER)
|
|
|
|
set(FLTK_XRENDER_FOUND FALSE)
|
|
|
|
endif(HAVE_XRENDER)
|
|
|
|
else(OPTION_USE_XRENDER)
|
|
|
|
set(FLTK_XRENDER_FOUND FALSE)
|
|
|
|
endif(OPTION_USE_XRENDER)
|
|
|
|
|
2014-02-09 22:41:29 +04:00
|
|
|
#######################################################################
|
|
|
|
if(X11_FOUND)
|
|
|
|
option(OPTION_USE_XDBE "use lib Xdbe" ON)
|
|
|
|
endif(X11_FOUND)
|
|
|
|
|
|
|
|
if(OPTION_USE_XDBE AND HAVE_XDBE_H)
|
|
|
|
set(HAVE_XDBE 1)
|
|
|
|
set(FLTK_XDBE_FOUND TRUE)
|
|
|
|
else()
|
|
|
|
set(FLTK_XDBE_FOUND FALSE)
|
|
|
|
endif(OPTION_USE_XDBE AND HAVE_XDBE_H)
|
2015-02-06 20:34:23 +03:00
|
|
|
|
2016-02-05 19:34:42 +03:00
|
|
|
#######################################################################
|
2016-12-01 20:31:29 +03:00
|
|
|
set(FL_NO_PRINT_SUPPORT FALSE)
|
2016-02-05 19:34:42 +03:00
|
|
|
if(X11_FOUND AND NOT OPTION_PRINT_SUPPORT)
|
2016-12-01 20:31:29 +03:00
|
|
|
set(FL_NO_PRINT_SUPPORT TRUE)
|
2016-02-05 19:34:42 +03:00
|
|
|
endif(X11_FOUND AND NOT OPTION_PRINT_SUPPORT)
|
|
|
|
#######################################################################
|
|
|
|
|
2016-02-10 15:22:38 +03:00
|
|
|
#######################################################################
|
2016-02-10 16:04:24 +03:00
|
|
|
set(FL_CFG_NO_FILESYSTEM_SUPPORT TRUE)
|
2016-02-10 15:22:38 +03:00
|
|
|
if(OPTION_FILESYSTEM_SUPPORT)
|
2016-02-10 16:04:24 +03:00
|
|
|
set(FL_CFG_NO_FILESYSTEM_SUPPORT FALSE)
|
2016-02-10 15:22:38 +03:00
|
|
|
endif(OPTION_FILESYSTEM_SUPPORT)
|
|
|
|
#######################################################################
|
|
|
|
|
2019-01-15 01:27:34 +03:00
|
|
|
#######################################################################
|
|
|
|
option (OPTION_CREATE_ANDROID_STUDIO_IDE "create files needed to compile FLtk for Android" OFF)
|
|
|
|
#######################################################################
|
|
|
|
|
2015-04-26 01:57:17 +03:00
|
|
|
#######################################################################
|
|
|
|
# prior to CMake 3.0 this feature was buggy
|
|
|
|
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
|
|
|
|
option(CMAKE_SUPPRESS_REGENERATION
|
2018-12-23 00:01:20 +03:00
|
|
|
"suppress rules to re-run CMake on rebuild" OFF)
|
2015-04-26 01:57:17 +03:00
|
|
|
mark_as_advanced(CMAKE_SUPPRESS_REGENERATION)
|
|
|
|
endif(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
|
2018-02-23 22:41:52 +03:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Debugging ...
|
|
|
|
|
|
|
|
if (DEBUG_OPTIONS_CMAKE)
|
2018-02-24 16:44:06 +03:00
|
|
|
message (STATUS "") # empty line
|
2018-02-23 22:41:52 +03:00
|
|
|
fl_debug_var (WIN32)
|
|
|
|
fl_debug_var (LIBS)
|
|
|
|
fl_debug_var (GLLIBS)
|
|
|
|
fl_debug_var (FLTK_LDLIBS)
|
|
|
|
fl_debug_var (USE_FIND_FILE)
|
2018-02-24 16:44:06 +03:00
|
|
|
fl_debug_var (OPENGL_FOUND)
|
|
|
|
fl_debug_var (OPENGL_INCLUDE_DIR)
|
|
|
|
fl_debug_var (OPENGL_LIBRARIES)
|
2018-02-25 22:25:45 +03:00
|
|
|
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)
|
2018-02-23 22:41:52 +03:00
|
|
|
message (STATUS "[** end of options.cmake **]")
|
|
|
|
endif (DEBUG_OPTIONS_CMAKE)
|
|
|
|
unset (DEBUG_OPTIONS_CMAKE)
|