diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index b5b207924a..462bb50729 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -295,4 +295,57 @@ if(wxUSE_GUI) wx_option_force_value(wxUSE_LIBSDL OFF) endif() endif() + + if(wxUSE_NOTIFICATION_MESSAGE AND UNIX AND WXGTK2 AND wxUSE_LIBNOTIFY) + find_package(LibNotify) + if(NOT LIBNOTIFY_FOUND) + message(WARNING "Libnotify not found, it won't be used for notifications") + wx_option_force_value(wxUSE_LIBNOTIFY OFF) + elseif((LIBNOTIFY_VERSION GREATER 0.7) OR (LIBNOTIFY_VERSION EQUAL 0.7)) + set(wxUSE_LIBNOTIFY_0_7 ON) + endif() + endif() + + if(wxUSE_UIACTIONSIMULATOR AND UNIX AND WXGTK) + if(wxUSE_XTEST) + find_package(XTest) + if(XTEST_FOUND) + list(APPEND wxTOOLKIT_INCLUDE_DIRS ${XTEST_INCLUDE_DIRS}) + list(APPEND wxTOOLKIT_LIBRARIES ${XTEST_LIBRARIES}) + else() + if(WXGTK3) + # This class can't work without XTest with GTK+ 3 + # which uses XInput2 and so ignores XSendEvent(). + message(STATUS "XTest not found, wxUIActionSimulator won't be available") + wx_option_force_value(wxUSE_UIACTIONSIMULATOR OFF) + endif() + # The other ports can use XSendEvent(), so don't warn + wx_option_force_value(wxUSE_XTEST OFF) + endif() + else(WXGTK3) + # As per above, wxUIActionSimulator can't be used in this case, + # but there is no need to warn, presumably the user knows what + # he's doing if wxUSE_XTEST was explicitly disabled. + wx_option_force_value(wxUSE_UIACTIONSIMULATOR OFF) + endif() + endif() + + if(wxUSE_HTML AND UNIX AND wxUSE_LIBMSPACK) + find_package(MSPACK) + if(NOT MSPACK_FOUND) + message(STATUS "libmspack not found") + wx_option_force_value(wxUSE_LIBMSPACK OFF) + endif() + endif() + + if(WXGTK2 AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS) + find_package(GnomeVFS2) + if(GNOMEVFS2_FOUND) + list(APPEND wxTOOLKIT_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS}) + list(APPEND wxTOOLKIT_LIBRARIES ${GNOMEVFS2_LIBRARIES}) + else() + message(STATUS "libgnomevfs not found, library won't be used to associate MIME type") + wx_option_force_value(wxUSE_LIBGNOMEVFS OFF) + endif() + endif() endif() diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 54c2810051..439b4c567b 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -86,5 +86,9 @@ if(UNIX AND wxUSE_LIBSDL) wx_lib_link_libraries(core PUBLIC ${SDL_LIBRARY}) endif() endif() +if(wxUSE_LIBNOTIFY) + wx_lib_include_directories(core PUBLIC ${LIBNOTIFY_INCLUDE_DIRS}) + wx_lib_link_libraries(core PUBLIC ${LIBNOTIFY_LIBRARIES}) +endif() wx_finalize_lib(core) diff --git a/build/cmake/lib/html/CMakeLists.txt b/build/cmake/lib/html/CMakeLists.txt index b9dbd5a553..d4b8b6d19c 100644 --- a/build/cmake/lib/html/CMakeLists.txt +++ b/build/cmake/lib/html/CMakeLists.txt @@ -11,10 +11,15 @@ include(../../source_groups.cmake) wx_append_sources(HTML_FILES HTML_CMN) -if(WIN32) +if(WIN32 OR wxUSE_LIBMSPACK) wx_append_sources(HTML_FILES HTML_MSW) endif() wx_add_library(html ${HTML_FILES}) +if(wxUSE_LIBMSPACK) + wx_lib_include_directories(html PRIVATE ${MSPACK_INCLUDE_DIRS}) + wx_lib_link_libraries(html PRIVATE ${MSPACK_LIBRARIES}) +endif() + wx_finalize_lib(html) diff --git a/build/cmake/modules/FindGnomeVFS2.cmake b/build/cmake/modules/FindGnomeVFS2.cmake new file mode 100644 index 0000000000..d942addac3 --- /dev/null +++ b/build/cmake/modules/FindGnomeVFS2.cmake @@ -0,0 +1,90 @@ +# - Try to find GnomeVFS2 +# Once done this will define +# +# GNOMEVFS2_FOUND - system has GnomeVFS2 +# GNOMEVFS2_INCLUDE_DIRS - the GnomeVFS2 include directory +# GNOMEVFS2_LIBRARIES - Link these to use GnomeVFS2 +# GNOMEVFS2_DEFINITIONS - Compiler switches required for using GnomeVFS2 +# +# Copyright (c) 2008 Joshua L. Blocher +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + + +if (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS) + # in cache already + set(GNOMEVFS2_FOUND TRUE) +else (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + include(UsePkgConfig) + pkgconfig(gnome-vfs-2.0 _GNOMEVFS2_INCLUDEDIR _GNOMEVFS2_LIBDIR _GNOMEVFS2_LDFLAGS _GNOMEVFS2_CFLAGS) + else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(_GNOMEVFS2 gnome-vfs-2.0) + endif (PKG_CONFIG_FOUND) + endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_path(GNOMEVFS2_INCLUDE_DIR + NAMES + libgnomevfs/gnome-vfs.h + PATHS + ${_GNOMEVFS2_INCLUDEDIR} + /usr/include + /usr/local/include + /opt/local/include + /sw/include + $ENV{DEVLIBS_PATH}//include// + PATH_SUFFIXES + gnome-vfs-2.0 + ) + + find_library(GNOMEVFS-2_LIBRARY + NAMES + gnomevfs-2 + PATHS + ${_GNOMEVFS2_LIBDIR} + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + if (GNOMEVFS-2_LIBRARY) + set(GNOMEVFS-2_FOUND TRUE) + endif (GNOMEVFS-2_LIBRARY) + + set(GNOMEVFS2_INCLUDE_DIRS + ${GNOMEVFS2_INCLUDE_DIR} + ) + + if (GNOMEVFS-2_FOUND) + set(GNOMEVFS2_LIBRARIES + ${GNOMEVFS2_LIBRARIES} + ${GNOMEVFS-2_LIBRARY} + ) + endif (GNOMEVFS-2_FOUND) + + if (GNOMEVFS2_INCLUDE_DIRS AND GNOMEVFS2_LIBRARIES) + set(GNOMEVFS2_FOUND TRUE) + endif (GNOMEVFS2_INCLUDE_DIRS AND GNOMEVFS2_LIBRARIES) + + if (GNOMEVFS2_FOUND) + if (NOT GnomeVFS2_FIND_QUIETLY) + message(STATUS "Found GnomeVFS2: ${GNOMEVFS2_LIBRARIES}") + endif (NOT GnomeVFS2_FIND_QUIETLY) + else (GNOMEVFS2_FOUND) + if (GnomeVFS2_FIND_REQUIRED) + message(FATAL_ERROR "Could not find GnomeVFS2") + endif (GnomeVFS2_FIND_REQUIRED) + endif (GNOMEVFS2_FOUND) + + # show the GNOMEVFS2_INCLUDE_DIRS and GNOMEVFS2_LIBRARIES variables only in the advanced view + mark_as_advanced(GNOMEVFS2_INCLUDE_DIRS GNOMEVFS2_LIBRARIES) + +endif (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS) + diff --git a/build/cmake/modules/FindLibNotify.cmake b/build/cmake/modules/FindLibNotify.cmake new file mode 100644 index 0000000000..e76b199ba7 --- /dev/null +++ b/build/cmake/modules/FindLibNotify.cmake @@ -0,0 +1,55 @@ +# - Try to find LibNotify +# This module defines the following variables: +# +# LIBNOTIFY_FOUND - LibNotify was found +# LIBNOTIFY_INCLUDE_DIRS - the LibNotify include directories +# LIBNOTIFY_LIBRARIES - link these to use LibNotify +# +# Copyright (C) 2012 Raphael Kubo da Costa +# Copyright (C) 2014 Collabora Ltd. +# +# 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 above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``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 COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS 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. + +find_package(PkgConfig) +pkg_check_modules(LIBNOTIFY QUIET libnotify) + +find_path(LIBNOTIFY_INCLUDE_DIRS + NAMES notify.h + HINTS ${LIBNOTIFY_INCLUDEDIR} + ${LIBNOTIFY_INCLUDE_DIRS} + PATH_SUFFIXES libnotify +) + +find_library(LIBNOTIFY_LIBRARIES + NAMES notify + HINTS ${LIBNOTIFY_LIBDIR} + ${LIBNOTIFY_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibNotify REQUIRED_VARS LIBNOTIFY_INCLUDE_DIRS LIBNOTIFY_LIBRARIES + VERSION_VAR LIBNOTIFY_VERSION) + +mark_as_advanced( + LIBNOTIFY_INCLUDE_DIRS + LIBNOTIFY_LIBRARIES +) diff --git a/build/cmake/modules/FindMSPACK.cmake b/build/cmake/modules/FindMSPACK.cmake new file mode 100644 index 0000000000..c82e8caa60 --- /dev/null +++ b/build/cmake/modules/FindMSPACK.cmake @@ -0,0 +1,40 @@ +## FindMSPACK.cmake +## +## Copyright (C) 2016 Christian Schenk +## +## This file is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation; either version 2, or (at your +## option) any later version. +## +## This file is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this file; if not, write to the Free Software +## Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, +## USA. + +find_path(MSPACK_INCLUDE_DIR + NAMES + mspack.h +) + +find_library(MSPACK_LIBRARY + NAMES + mspack +) + +find_package_handle_standard_args(MSPACK DEFAULT_MSG MSPACK_LIBRARY MSPACK_INCLUDE_DIR) + +if(MSPACK_FOUND) + set(MSPACK_INCLUDE_DIRS ${MSPACK_INCLUDE_DIR}) + set(MSPACK_LIBRARIES ${MSPACK_LIBRARY}) +else() + set(MSPACK_INCLUDE_DIRS) + set(MSPACK_LIBRARIES) +endif() + +mark_as_advanced(MSPACK_LIBRARY MSPACK_INCLUDE_DIR) diff --git a/build/cmake/modules/FindXTest.cmake b/build/cmake/modules/FindXTest.cmake new file mode 100644 index 0000000000..8fb21f682e --- /dev/null +++ b/build/cmake/modules/FindXTest.cmake @@ -0,0 +1,51 @@ +# - Find XTEST +# Find the XTEST libraries +# +# This module defines the following variables: +# XTEST_FOUND - true if XTEST_INCLUDE_DIR & XTEST_LIBRARY are found +# XTEST_LIBRARIES - Set when XTEST_LIBRARY is found +# XTEST_INCLUDE_DIRS - Set when XTEST_INCLUDE_DIR is found +# +# XTEST_INCLUDE_DIR - where to find XTest.h, etc. +# XTEST_LIBRARY - the XTEST library +# + +#============================================================================= +# Copyright 2011 O.S. Systems Software Ltda. +# Copyright 2011 Otavio Salvador +# Copyright 2011 Marc-Andre Moreau +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +find_path(XTEST_INCLUDE_DIR NAMES X11/extensions/XTest.h + PATH_SUFFIXES X11/extensions + PATHS /opt/X11/include + DOC "The XTest include directory" +) + +find_library(XTEST_LIBRARY NAMES Xtst + PATHS /opt/X11/lib + DOC "The XTest library" +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XTest DEFAULT_MSG XTEST_LIBRARY XTEST_INCLUDE_DIR) + +if(XTEST_FOUND) + set( XTEST_LIBRARIES ${XTEST_LIBRARY} ) + set( XTEST_INCLUDE_DIRS ${XTEST_INCLUDE_DIR} ) +endif() + +mark_as_advanced(XTEST_INCLUDE_DIR XTEST_LIBRARY) + diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 1ea8458bda..df57e1023b 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -76,8 +76,12 @@ set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzm wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)") wx_option(wxUSE_LIBSDL "use SDL for audio on Unix") -if(NOT WIN32) +if(UNIX) wx_option(wxUSE_LIBICONV "use libiconv (character conversion)") + wx_option(wxUSE_LIBNOTIFY "use libnotify for notifications") + wx_option(wxUSE_XTEST "use XTest extension") + wx_option(wxUSE_LIBMSPACK "use libmspack (CHM help files loading)") + wx_option(wxUSE_LIBGNOMEVFS "use GNOME VFS for associating MIME types") endif() # ---------------------------------------------------------------------------