diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index f967050c5a..919ce4c570 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -165,6 +165,25 @@ if(wxUSE_GUI) endif() endif() + # WXGTK checks, match include/wx/gtk/chkconf.h + if(WXGTK) + wx_option_force_value(wxUSE_METAFILE OFF) + + if(WIN32) + wx_option_force_value(wxUSE_CAIRO ON) + wx_option_force_value(wxUSE_ACCESSIBILITY OFF) + wx_option_force_value(wxUSE_OWNER_DRAWN OFF) + endif() + + if(NOT UNIX) + wx_option_force_value(wxUSE_WEBVIEW OFF) + wx_option_force_value(wxUSE_MEDIACTRL OFF) + wx_option_force_value(wxUSE_UIACTIONSIMULATOR OFF) + wx_option_force_value(wxUSE_OPENGL OFF) + set(wxUSE_GLCANVAS OFF) + endif() + endif() + # extra dependencies if(wxUSE_OPENGL) find_package(OpenGL) @@ -183,6 +202,14 @@ if(wxUSE_GUI) endif() endif() + if(wxUSE_PRIVATE_FONTS AND WXGTK) + find_package(Fontconfig) + if(NOT FONTCONFIG_FOUND) + message(WARNING "Fontconfig not found, Private fonts won't be available") + wx_option_force_value(wxUSE_PRIVATE_FONTS OFF) + endif() + endif() + if(wxUSE_MEDIACTRL AND UNIX AND NOT APPLE AND NOT WIN32) find_package(GStreamer) if(NOT GSTREAMER_FOUND) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 20e4636cbf..e7ed60ef67 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -71,5 +71,13 @@ if(WXOSX_COCOA) "-framework AudioToolbox" ) endif() +if(WXGTK AND wxUSE_PRIVATE_FONTS) + wx_lib_include_directories(core PUBLIC + ${FONTCONFIG_INCLUDE_DIR} + ) + wx_lib_link_libraries(core PUBLIC + ${FONTCONFIG_LIBRARIES} + ) +endif() wx_finalize_lib(core) diff --git a/build/cmake/modules/FindFontconfig.cmake b/build/cmake/modules/FindFontconfig.cmake new file mode 100644 index 0000000000..e6fa81d8ef --- /dev/null +++ b/build/cmake/modules/FindFontconfig.cmake @@ -0,0 +1,69 @@ +# - Try to find the Fontconfig +# Once done this will define +# +# FONTCONFIG_FOUND - system has Fontconfig +# FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers +# FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG +# FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG + +# Copyright (c) 2006,2007 Laurent Montel, +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) + + # in cache already + set(FONTCONFIG_FOUND TRUE) + +else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) + + if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_FONTCONFIG fontconfig) + + set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) + endif (NOT WIN32) + + find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h + PATHS + ${PC_FONTCONFIG_INCLUDEDIR} + ${PC_FONTCONFIG_INCLUDE_DIRS} + /usr/X11/include + ) + + find_library(FONTCONFIG_LIBRARIES NAMES fontconfig + PATHS + ${PC_FONTCONFIG_LIBDIR} + ${PC_FONTCONFIG_LIBRARY_DIRS} + ) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR ) + + mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR) + +endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR)