From 9f21af693c0cebc5ddfb94dfc1eef9287ae892db Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 9 Dec 2018 15:51:14 +0100 Subject: [PATCH 01/10] CMake: Install wxrc on all platforms, closes #18289 --- build/cmake/utils/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt index a242fdec66..21acfa3dfe 100644 --- a/build/cmake/utils/CMakeLists.txt +++ b/build/cmake/utils/CMakeLists.txt @@ -20,8 +20,8 @@ if(wxUSE_XRC) set_target_properties(wxrc PROPERTIES FOLDER "Utilities") + wx_install(TARGETS wxrc RUNTIME DESTINATION "bin") if(UNIX) - wx_install(TARGETS wxrc RUNTIME DESTINATION "bin") install(CODE "execute_process( \ COMMAND ${CMAKE_COMMAND} -E rename \ ${CMAKE_INSTALL_PREFIX}/bin/wxrc \ From 981555b7889a3d31f874915d01c5b36d2b6e4175 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sun, 9 Dec 2018 15:55:04 +0100 Subject: [PATCH 02/10] CMake: Do not add -pthread to link flags with clang on Windows It causes argument unused warnings. --- build/cmake/functions.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index 088d685eb2..dfab1ccc95 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -105,9 +105,13 @@ function(wx_set_common_target_properties target_name) endif() # TODO: add warning flags for other compilers endif() + if(CMAKE_USE_PTHREADS_INIT) target_compile_options(${target_name} PRIVATE "-pthread") - set_target_properties(${target_name} PROPERTIES LINK_FLAGS "-pthread") + # clang++.exe: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument] + if(NOT (WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")) + set_target_properties(${target_name} PROPERTIES LINK_FLAGS "-pthread") + endif() endif() endfunction() From 0665db6c1d8004978bedda4e58d934c014688396 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 11 Dec 2018 20:36:47 +0100 Subject: [PATCH 03/10] CMake: Fix html zip sample dependency check --- build/cmake/samples/html.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/cmake/samples/html.cmake b/build/cmake/samples/html.cmake index 402d0618d2..a13c405e9f 100644 --- a/build/cmake/samples/html.cmake +++ b/build/cmake/samples/html.cmake @@ -37,7 +37,7 @@ wx_add_sample(test LIBRARIES net html NAME htmltest) wx_add_sample(virtual DATA start.htm LIBRARIES html) wx_add_sample(widget DATA start.htm LIBRARIES html) -wx_add_sample(zip DATA pages.zip start.htm LIBRARIES html DEPENDS wxUSE_FSZIP) +wx_add_sample(zip DATA pages.zip start.htm LIBRARIES html DEPENDS wxUSE_FS_ZIP) set(wxSAMPLE_SUBDIR) set(wxSAMPLE_FOLDER) From 79344fc5b6f0a561b4ec6e6ec52e4149929ab9f6 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 11 Dec 2018 20:37:41 +0100 Subject: [PATCH 04/10] CMake: Fix locale_t type check Test failed when xlocale.h did not exist. --- build/cmake/setup.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 5656b9dc30..c3d66de91e 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -641,7 +641,10 @@ endif() if(wxUSE_XLOCALE) check_include_file(xlocale.h HAVE_XLOCALE_H) - set(CMAKE_EXTRA_INCLUDE_FILES xlocale.h locale.h) + set(CMAKE_EXTRA_INCLUDE_FILES locale.h) + if(HAVE_XLOCALE_H) + list(APPEND CMAKE_EXTRA_INCLUDE_FILES xlocale.h) + endif() check_type_size(locale_t LOCALE_T) set(CMAKE_EXTRA_INCLUDE_FILES) endif() From 14570b4fa3f385c979601148d4804a66bab09209 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Tue, 11 Dec 2018 20:49:14 +0100 Subject: [PATCH 05/10] CMake: Find more external libraries Check for LibNotify, MSpack, XTest and GnomeVFS2. --- build/cmake/init.cmake | 53 +++++++++++++++ build/cmake/lib/core/CMakeLists.txt | 4 ++ build/cmake/lib/html/CMakeLists.txt | 7 +- build/cmake/modules/FindGnomeVFS2.cmake | 90 +++++++++++++++++++++++++ build/cmake/modules/FindLibNotify.cmake | 55 +++++++++++++++ build/cmake/modules/FindMSPACK.cmake | 40 +++++++++++ build/cmake/modules/FindXTest.cmake | 51 ++++++++++++++ build/cmake/options.cmake | 6 +- 8 files changed, 304 insertions(+), 2 deletions(-) create mode 100644 build/cmake/modules/FindGnomeVFS2.cmake create mode 100644 build/cmake/modules/FindLibNotify.cmake create mode 100644 build/cmake/modules/FindMSPACK.cmake create mode 100644 build/cmake/modules/FindXTest.cmake 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() # --------------------------------------------------------------------------- From b9d31dffc5e3c97c54a3569e1700506aa0c33543 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 12 Dec 2018 20:37:14 +0100 Subject: [PATCH 06/10] CMake: Improve finding Iconv Continue when Iconv can not be found. Silence warnings when testing if second argument for iconv() is const. Use correct include dir. --- build/cmake/init.cmake | 26 ++++++++++++++++++-------- build/cmake/lib/base/CMakeLists.txt | 4 ++-- build/cmake/modules/FindIconv.cmake | 2 ++ build/cmake/setup.cmake | 9 ++++----- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 462bb50729..9738f69859 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -154,15 +154,25 @@ if(wxUSE_LIBLZMA) find_package(LibLZMA REQUIRED) endif() -if(UNIX AND wxUSE_SECRETSTORE) - # The required APIs are always available under MSW and OS X but we must - # have GNOME libsecret under Unix to be able to compile this class. - find_package(Libsecret REQUIRED) - if(NOT LIBSECRET_FOUND) - message(WARNING "libsecret not found, wxSecretStore won't be available") - wx_option_force_value(wxUSE_SECRETSTORE OFF) +if(UNIX) + if(wxUSE_SECRETSTORE) + # The required APIs are always available under MSW and OS X but we must + # have GNOME libsecret under Unix to be able to compile this class. + find_package(Libsecret REQUIRED) + if(NOT LIBSECRET_FOUND) + message(WARNING "libsecret not found, wxSecretStore won't be available") + wx_option_force_value(wxUSE_SECRETSTORE OFF) + endif() endif() -endif() + + if(wxUSE_LIBICONV) + find_package(Iconv) + if(NOT ICONV_FOUND) + message(WARNING "iconv not found") + wx_option_force_value(wxUSE_LIBICONV OFF) + endif() + endif() +endif(UNIX) if(wxUSE_GUI) if(WXMSW AND wxUSE_METAFILE) diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt index 8f526afebe..08a1f74f22 100644 --- a/build/cmake/lib/base/CMakeLists.txt +++ b/build/cmake/lib/base/CMakeLists.txt @@ -48,8 +48,8 @@ if(UNIX AND wxUSE_SECRETSTORE) wx_lib_include_directories(base PRIVATE ${LIBSECRET_INCLUDE_DIRS}) wx_lib_link_libraries(base PRIVATE ${LIBSECRET_LIBRARIES}) endif() -if(wxUSE_LIBICONV AND ICONV_FOUND) - wx_lib_include_directories(base PRIVATE ${ICONV_INCLUDE_DIRS}) +if(wxUSE_LIBICONV) + wx_lib_include_directories(base PRIVATE ${ICONV_INCLUDE_DIR}) wx_lib_link_libraries(base PRIVATE ${ICONV_LIBRARIES}) endif() if(wxUSE_THREADS AND CMAKE_THREAD_LIBS_INIT) diff --git a/build/cmake/modules/FindIconv.cmake b/build/cmake/modules/FindIconv.cmake index 79e4b34f37..9d95da030b 100644 --- a/build/cmake/modules/FindIconv.cmake +++ b/build/cmake/modules/FindIconv.cmake @@ -25,6 +25,7 @@ ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +set(CMAKE_REQUIRED_QUIET ON) IF(ICONV_FOUND) check_cxx_source_compiles(" #include @@ -41,6 +42,7 @@ IF(ICONV_FOUND) ENDIF(ICONV_FOUND) set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) +set(CMAKE_REQUIRED_QUIET) IF(ICONV_FOUND) IF(NOT ICONV_FIND_QUIETLY) diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index c3d66de91e..a102731af9 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -217,9 +217,8 @@ macro(wx_get_socket_param_type name code) endmacro() # the following tests are for Unix(like) systems only -if(NOT WIN32) - if(wxUSE_LIBICONV AND NOT APPLE) - find_package(Iconv REQUIRED) +if(UNIX) + if(wxUSE_LIBICONV) set(HAVE_ICONV ON) set(ICONV_CONST " ") if(ICONV_SECOND_ARGUMENT_IS_CONST) @@ -419,8 +418,8 @@ if(NOT WIN32) check_symbol_exists(getservbyname netdb.h HAVE_GETSERVBYNAME) check_symbol_exists(inet_aton arpa/inet.h HAVE_INET_ATON) check_symbol_exists(inet_addr arpa/inet.h HAVE_INET_ADDR) - endif() # wxUSE_SOCKETS -endif() # NOT WIN32 + endif(wxUSE_SOCKETS) +endif(UNIX) if(CMAKE_USE_PTHREADS_INIT) cmake_push_check_state(RESET) From 042b17512ec222cf597692c042b33dfdf697e797 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 12 Dec 2018 20:38:32 +0100 Subject: [PATCH 07/10] CMake: Check for libSDL only on Unix --- build/cmake/lib/core/CMakeLists.txt | 2 +- build/cmake/options.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 439b4c567b..e991c3d3e3 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -77,7 +77,7 @@ if(WXGTK AND wxUSE_PRIVATE_FONTS) wx_lib_include_directories(core PUBLIC ${FONTCONFIG_INCLUDE_DIR}) wx_lib_link_libraries(core PUBLIC ${FONTCONFIG_LIBRARIES}) endif() -if(UNIX AND wxUSE_LIBSDL) +if(wxUSE_LIBSDL) if(SDL2_FOUND) wx_lib_include_directories(core PUBLIC ${SDL2_INCLUDE_DIR}) wx_lib_link_libraries(core PUBLIC ${SDL2_LIBRARY}) diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index df57e1023b..948e1fa414 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -74,9 +74,9 @@ wx_option(wxUSE_LIBLZMA "use LZMA compression" OFF) set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBLZMA "use liblzma for LZMA compression") wx_option(wxUSE_OPENGL "use OpenGL (or Mesa)") -wx_option(wxUSE_LIBSDL "use SDL for audio on Unix") if(UNIX) + wx_option(wxUSE_LIBSDL "use SDL for audio on Unix") wx_option(wxUSE_LIBICONV "use libiconv (character conversion)") wx_option(wxUSE_LIBNOTIFY "use libnotify for notifications") wx_option(wxUSE_XTEST "use XTest extension") From 91b6305dcd057faaa922e8ed645b732410ce2a92 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 12 Dec 2018 20:41:37 +0100 Subject: [PATCH 08/10] CMake: Improve checking for external libraries Do not abort when libLZMA or libSecret can not be found, just show a warning. Do not search for libSecret on macOS. Disable libraries internally (not in cache) when not searching for them. --- build/cmake/init.cmake | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 9738f69859..2d67e48c90 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -151,14 +151,18 @@ if(wxUSE_THREADS) endif() if(wxUSE_LIBLZMA) - find_package(LibLZMA REQUIRED) + find_package(LibLZMA) + if(NOT LIBLZMA_FOUND) + message(WARNING "libLZMA not found, LZMA compression won't be available") + wx_option_force_value(wxUSE_LIBLZMA OFF) + endif() endif() if(UNIX) - if(wxUSE_SECRETSTORE) + if(wxUSE_SECRETSTORE AND NOT APPLE) # The required APIs are always available under MSW and OS X but we must # have GNOME libsecret under Unix to be able to compile this class. - find_package(Libsecret REQUIRED) + find_package(Libsecret) if(NOT LIBSECRET_FOUND) message(WARNING "libsecret not found, wxSecretStore won't be available") wx_option_force_value(wxUSE_SECRETSTORE OFF) @@ -293,9 +297,12 @@ if(wxUSE_GUI) message(WARNING "GStreamer not found, wxMediaCtrl won't be available") wx_option_force_value(wxUSE_MEDIACTRL OFF) endif() + else() + set(wxUSE_GSTREAMER OFF) + set(wxUSE_GSTREAMER_PLAYER OFF) endif() - if(UNIX AND wxUSE_LIBSDL) + if(wxUSE_SOUND AND UNIX AND wxUSE_LIBSDL) find_package(SDL2) if(NOT SDL2_FOUND) find_package(SDL) @@ -304,6 +311,8 @@ if(wxUSE_GUI) message(WARNING "SDL not found, SDL Audio back-end won't be available") wx_option_force_value(wxUSE_LIBSDL OFF) endif() + else() + set(wxUSE_LIBSDL OFF) endif() if(wxUSE_NOTIFICATION_MESSAGE AND UNIX AND WXGTK2 AND wxUSE_LIBNOTIFY) @@ -314,6 +323,8 @@ if(wxUSE_GUI) elseif((LIBNOTIFY_VERSION GREATER 0.7) OR (LIBNOTIFY_VERSION EQUAL 0.7)) set(wxUSE_LIBNOTIFY_0_7 ON) endif() + else() + set(wxUSE_LIBNOTIFY OFF) endif() if(wxUSE_UIACTIONSIMULATOR AND UNIX AND WXGTK) @@ -346,6 +357,8 @@ if(wxUSE_GUI) message(STATUS "libmspack not found") wx_option_force_value(wxUSE_LIBMSPACK OFF) endif() + else() + set(wxUSE_LIBMSPACK OFF) endif() if(WXGTK2 AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS) @@ -357,5 +370,7 @@ if(wxUSE_GUI) message(STATUS "libgnomevfs not found, library won't be used to associate MIME type") wx_option_force_value(wxUSE_LIBGNOMEVFS OFF) endif() + else() + set(wxUSE_LIBGNOMEVFS OFF) endif() endif() From 5348b4fa3b4b91e7fedbbe42cc95fc862b081153 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 12 Dec 2018 20:43:17 +0100 Subject: [PATCH 09/10] CMake: Improve layout of third party libraries summary Add more external libraries to the summary, like configure does. --- build/cmake/functions.cmake | 32 ++++++++++++++++++++++++++------ build/cmake/options.cmake | 4 ++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index dfab1ccc95..6e0e528c0d 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -524,16 +524,36 @@ function(wx_add_thirdparty_library var_name lib_name help_str) endfunction() function(wx_print_thirdparty_library_summary) + set(nameLength 0) + set(nameValLength 0) set(var_name) - set(message "Which libraries should wxWidgets use?\n") - foreach(entry IN - LISTS wxTHIRD_PARTY_LIBRARIES - ITEMS wxUSE_STL "Use C++ STL classes") - + foreach(entry IN LISTS wxTHIRD_PARTY_LIBRARIES) if(NOT var_name) set(var_name ${entry}) else() - wx_string_append(message " ${var_name}: ${${var_name}} (${entry})\n") + string(LENGTH ${var_name} len) + if(len GREATER nameLength) + set(nameLength ${len}) + endif() + string(LENGTH ${${var_name}} len) + if(len GREATER nameValLength) + set(nameValLength ${len}) + endif() + set(var_name) + endif() + endforeach() + math(EXPR nameLength "${nameLength}+1") # account for : + + set(message "Which libraries should wxWidgets use?\n") + foreach(entry IN LISTS wxTHIRD_PARTY_LIBRARIES) + if(NOT var_name) + set(var_name ${entry}) + else() + set(namestr "${var_name}: ") + set(nameval "${${var_name}} ") + string(SUBSTRING ${namestr} 0 ${nameLength} namestr) + string(SUBSTRING ${nameval} 0 ${nameValLength} nameval) + wx_string_append(message " ${namestr} ${nameval} (${entry})\n") set(var_name) endif() endforeach() diff --git a/build/cmake/options.cmake b/build/cmake/options.cmake index 948e1fa414..3a2a13d42a 100644 --- a/build/cmake/options.cmake +++ b/build/cmake/options.cmake @@ -46,6 +46,7 @@ endif() # STL options wx_option(wxUSE_STL "use standard C++ classes for everything" OFF) +set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_STL "use C++ STL classes") wx_dependent_option(wxUSE_STD_CONTAINERS "use standard C++ container classes" ON "wxUSE_STL" OFF) wx_option(wxUSE_UNICODE "compile with Unicode support (NOT RECOMMENDED to be turned off)") @@ -82,6 +83,9 @@ if(UNIX) 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") + + set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBSDL "use SDL for audio on Unix") + set(wxTHIRD_PARTY_LIBRARIES ${wxTHIRD_PARTY_LIBRARIES} wxUSE_LIBMSPACK "use libmspack (CHM help files loading)") endif() # --------------------------------------------------------------------------- From c1013d9bfcd0bf826d91fded00d7b682bbe9a63b Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 12 Dec 2018 20:43:50 +0100 Subject: [PATCH 10/10] CMake: Add more option validity checks --- build/cmake/init.cmake | 57 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 2d67e48c90..cbbdb81dbf 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -134,9 +134,6 @@ if(NOT wxUSE_EXPAT) set(wxUSE_XRC OFF) endif() set(wxUSE_XML ${wxUSE_XRC}) -if(wxUSE_CONFIG) - set(wxUSE_CONFIG_NATIVE ON) -endif() if(DEFINED wxUSE_OLE AND wxUSE_OLE) set(wxUSE_OLE_AUTOMATION ON) @@ -146,6 +143,60 @@ if(wxUSE_OPENGL) set(wxUSE_GLCANVAS ON) endif() +if(wxUSE_ARCHIVE_STREAMS AND NOT wxUSE_STREAMS) + message(WARNING "wxArchive requires wxStreams... disabled") + wx_option_force_value(wxUSE_ARCHIVE_STREAMS OFF) +endif() + +if(wxUSE_ZIPSTREAM AND (NOT wxUSE_ARCHIVE_STREAMS OR NOT wxUSE_ZLIB)) + message(WARNING "wxZip requires wxArchive or wxZlib... disabled") + wx_option_force_value(wxUSE_ZIPSTREAM OFF) +endif() + +if(wxUSE_TARSTREAM AND NOT wxUSE_ARCHIVE_STREAMS) + message(WARNING "wxTar requires wxArchive... disabled") + wx_option_force_value(wxUSE_TARSTREAM OFF) +endif() + +if(wxUSE_FILESYSTEM AND (NOT wxUSE_STREAMS OR (NOT wxUSE_FILE AND NOT wxUSE_FFILE))) + message(WARNING "wxFileSystem requires wxStreams and wxFile or wxFFile... disabled") + wx_option_force_value(wxUSE_FILESYSTEM OFF) +endif() + +if(wxUSE_FS_ARCHIVE AND (NOT wxUSE_FILESYSTEM OR NOT wxUSE_ARCHIVE_STREAMS)) + message(WARNING "wxArchiveFSHandler requires wxArchive and wxFileSystem... disabled") + wx_option_force_value(wxUSE_FS_ARCHIVE OFF) +endif() + +if(wxUSE_FS_ARCHIVE AND (NOT wxUSE_FILESYSTEM OR NOT wxUSE_ARCHIVE_STREAMS)) + message(WARNING "wxArchiveFSHandler requires wxArchive and wxFileSystem... disabled") + wx_option_force_value(wxUSE_FS_ARCHIVE OFF) +endif() + +if(wxUSE_FS_ZIP AND NOT wxUSE_FS_ARCHIVE) + message(WARNING "wxZipFSHandler requires wxArchiveFSHandler... disabled") + wx_option_force_value(wxUSE_FS_ZIP OFF) +endif() + +if(wxUSE_TEXTFILE AND (NOT wxUSE_FILE OR NOT wxUSE_TEXTBUFFER)) + message(WARNING "wxTextFile requires wxFile and wxTextBuffer... disabled") + wx_option_force_value(wxUSE_TEXTFILE OFF) +endif() + +if(wxUSE_CONFIG) + if(NOT wxUSE_TEXTFILE) + message(WARNING "wxConfig requires wxTextFile... disabled") + wx_option_force_value(wxUSE_CONFIG OFF) + else() + set(wxUSE_CONFIG_NATIVE ON) + endif() +endif() + +if(wxUSE_INTL AND NOT wxUSE_FILE) + message(WARNING "I18n code requires wxFile... disabled") + wx_option_force_value(wxUSE_INTL OFF) +endif() + if(wxUSE_THREADS) find_package(Threads REQUIRED) endif()