[poppler] 4 commits - CMakeLists.txt cmake/modules glib/tests poppler-cairo.pc.cmake poppler-glib.pc.cmake poppler-splash.pc.cmake qt5/tests qt6/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Nov 14 10:35:10 UTC 2020


 CMakeLists.txt                         |   44 ++++--------
 cmake/modules/MacroBoolTo01.cmake      |   20 -----
 cmake/modules/MacroEnsureVersion.cmake |  117 ---------------------------------
 cmake/modules/PopplerMacros.cmake      |   23 ------
 glib/tests/CMakeLists.txt              |    3 
 poppler-cairo.pc.cmake                 |    8 --
 poppler-glib.pc.cmake                  |    2 
 poppler-splash.pc.cmake                |    8 --
 qt5/tests/CMakeLists.txt               |    3 
 qt6/tests/CMakeLists.txt               |    3 
 10 files changed, 25 insertions(+), 206 deletions(-)

New commits:
commit f4d640d7ad00b30797acce47299cf7a7a59ad505
Author: Kyle Auble <kyle.auble at outlook.com>
Date:   Thu Nov 12 19:46:15 2020 -0500

    cmake: Remove redundant unit-test macro
    
    poppler_add_unittest was only used 3 times & effectively differed from
    poppler_add_test by just a CMake add_test call.

diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index 0950791d..707e7497 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -5,6 +5,8 @@
 
 macro(POPPLER_ADD_TEST exe build_flag)
   set(build_test ${${build_flag}})
+
+  # Omit the disabled test binaries from the "all" target
   if(NOT build_test)
     set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)
   endif(NOT build_test)
@@ -12,6 +14,7 @@ macro(POPPLER_ADD_TEST exe build_flag)
   add_executable(${exe} ${_add_executable_param} ${ARGN})
 
   # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
+  # Don't try to use custom targets if building with Visual Studio
   if(NOT build_test AND NOT MSVC_IDE)
     get_property(_buildtestsAdded GLOBAL PROPERTY BUILDTESTS_ADDED)
     if(NOT _buildtestsAdded)
@@ -22,26 +25,6 @@ macro(POPPLER_ADD_TEST exe build_flag)
   endif(NOT build_test AND NOT MSVC_IDE)
 endmacro(POPPLER_ADD_TEST)
 
-macro(POPPLER_ADD_UNITTEST exe build_flag)
-  set(build_test ${${build_flag}})
-  if(NOT build_test)
-    set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)
-  endif(NOT build_test)
-
-  add_executable(${exe} ${_add_executable_param} ${ARGN})
-  add_test(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
-
-  # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
-  if(NOT build_test)
-    get_property(_buildtestsAdded GLOBAL PROPERTY BUILDTESTS_ADDED)
-    if(NOT _buildtestsAdded)
-      add_custom_target(buildtests)
-      set_property(GLOBAL PROPERTY BUILDTESTS_ADDED TRUE)
-    endif(NOT _buildtestsAdded)
-    add_dependencies(buildtests ${exe})
-  endif(NOT build_test)
-endmacro(POPPLER_ADD_UNITTEST)
-
 macro(POPPLER_CREATE_INSTALL_PKGCONFIG generated_file install_location)
   configure_file(${generated_file}.cmake ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} @ONLY)
   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${generated_file} DESTINATION ${install_location})
diff --git a/glib/tests/CMakeLists.txt b/glib/tests/CMakeLists.txt
index acac077d..32eefd01 100644
--- a/glib/tests/CMakeLists.txt
+++ b/glib/tests/CMakeLists.txt
@@ -12,7 +12,8 @@ add_definitions(-DTESTDATADIR=\"${TESTDATADIR}\")
 set(poppler_check_text_SRCS
   check_text.c
 )
-poppler_add_unittest(poppler-check-text BUILD_GTK_TESTS ${poppler_check_text_SRCS})
+poppler_add_test(poppler-check-text BUILD_GTK_TESTS ${poppler_check_text_SRCS})
+add_test(poppler-check-text ${EXECUTABLE_OUTPUT_PATH}/poppler-check-text)
 
 set(poppler_check_bb_SRCS
   check_bb.c
diff --git a/qt5/tests/CMakeLists.txt b/qt5/tests/CMakeLists.txt
index b01d0835..5f542440 100644
--- a/qt5/tests/CMakeLists.txt
+++ b/qt5/tests/CMakeLists.txt
@@ -34,7 +34,8 @@ macro(QT5_ADD_QTEST exe source)
     set(${test_name}_SOURCES
       ${source}
     )
-    poppler_add_unittest(${exe} BUILD_QT5_TESTS ${${test_name}_SOURCES})
+    poppler_add_test(${exe} BUILD_QT5_TESTS ${${test_name}_SOURCES})
+    add_test(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
     target_link_libraries(${exe} poppler-qt5 ${Qt5Widgets_LIBRARIES} ${Qt5Test_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES})
     if(MSVC)
       target_link_libraries(${exe} poppler ${poppler_LIBS})
diff --git a/qt6/tests/CMakeLists.txt b/qt6/tests/CMakeLists.txt
index 96f10e12..7f9e749e 100644
--- a/qt6/tests/CMakeLists.txt
+++ b/qt6/tests/CMakeLists.txt
@@ -23,7 +23,8 @@ macro(QT6_ADD_QTEST exe source)
     set(${test_name}_SOURCES
       ${source}
     )
-    poppler_add_unittest(${exe} BUILD_QT6_TESTS ${${test_name}_SOURCES})
+    poppler_add_test(${exe} BUILD_QT6_TESTS ${${test_name}_SOURCES})
+    add_test(${exe} ${EXECUTABLE_OUTPUT_PATH}/${exe})
     target_link_libraries(${exe} poppler-qt6 Qt6::Widgets Qt6::Test Qt6::Gui)
     if(MSVC)
       target_link_libraries(${exe} poppler ${poppler_LIBS})
commit 85f6354f36d5d4f6bb7c1708f408d7522a9356d6
Author: Kyle Auble <kyle.auble at outlook.com>
Date:   Tue Nov 10 23:57:19 2020 -0500

    Remove .pc files for private back-ends

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2ef0285..c4c272cd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -765,18 +765,12 @@ set(PC_REQUIRES_PRIVATE "Requires.private: poppler = ${POPPLER_VERSION}")
 
 if(PKG_CONFIG_EXECUTABLE)
   poppler_create_install_pkgconfig(poppler.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-  if(ENABLE_SPLASH)
-    poppler_create_install_pkgconfig(poppler-splash.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-  endif()
   if(ENABLE_QT5)
     poppler_create_install_pkgconfig(poppler-qt5.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
   endif()
   if(ENABLE_GLIB)
     poppler_create_install_pkgconfig(poppler-glib.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
   endif()
-  if(CAIRO_FOUND)
-    poppler_create_install_pkgconfig(poppler-cairo.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-  endif()
   if(ENABLE_CPP)
     poppler_create_install_pkgconfig(poppler-cpp.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
   endif()
diff --git a/poppler-cairo.pc.cmake b/poppler-cairo.pc.cmake
deleted file mode 100644
index e68cceab..00000000
--- a/poppler-cairo.pc.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@
-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
-
-Name: poppler-cairo
-Description: Cairo backend for Poppler PDF rendering library
-Version: @POPPLER_VERSION@
-Requires: poppler = @POPPLER_VERSION@ cairo >= @CAIRO_VERSION@
diff --git a/poppler-glib.pc.cmake b/poppler-glib.pc.cmake
index ac248192..b096cbef 100644
--- a/poppler-glib.pc.cmake
+++ b/poppler-glib.pc.cmake
@@ -5,7 +5,7 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
 Name: poppler-glib
 Description: GLib wrapper for poppler
 Version: @POPPLER_VERSION@
-Requires: glib-2.0 >= @GLIB_REQUIRED@ gobject-2.0 >= @GLIB_REQUIRED@ cairo >= @CAIRO_VERSION@
+Requires: glib-2.0 >= @GLIB_REQUIRED@ gobject-2.0 >= @GLIB_REQUIRED@ cairo >= @CAIRO_VERSION@ @PC_REQUIRES@
 @PC_REQUIRES_PRIVATE@
 
 Libs: -L${libdir} -lpoppler-glib
diff --git a/poppler-splash.pc.cmake b/poppler-splash.pc.cmake
deleted file mode 100644
index f9eceebe..00000000
--- a/poppler-splash.pc.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@
-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
-
-Name: poppler-splash
-Description: Splash backend for Poppler PDF rendering library
-Version: @POPPLER_VERSION@
-Requires: poppler = @POPPLER_VERSION@
commit 268696ebf5ff01164e8e530b625af327c09ff133
Author: Kyle Auble <kyle.auble at outlook.com>
Date:   Sun Nov 8 16:31:56 2020 -0500

    cmake: Remove obsolete version-check macro
    
    Only used once to check pkgconfig >= 0.18 (released in 2005 at latest).

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1fee7dff..b2ef0285 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,6 @@ include(PopplerDefaults)
 include(PopplerMacros)
 include(MacroOptionalFindPackage)
 find_package(PkgConfig)
-include(MacroEnsureVersion)
 if (WIN32)
   message("-- Using win32 threads")
 else()
@@ -760,18 +759,9 @@ if(ENABLE_CPP)
   add_subdirectory(cpp)
 endif()
 
-set(PKG_CONFIG_VERSION_0_18 TRUE)
-if(PKG_CONFIG_EXECUTABLE)
-  exec_program(${PKG_CONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE _output_VAR)
-  macro_ensure_version("0.18" "${_output_VAR}" PKG_CONFIG_VERSION_0_18)
-endif()
-if(PKG_CONFIG_VERSION_0_18)
-  set(PC_REQUIRES "")
-  set(PC_REQUIRES_PRIVATE "Requires.private: poppler = ${POPPLER_VERSION}")
-else()
-  set(PC_REQUIRES "poppler = ${POPPLER_VERSION}")
-  set(PC_REQUIRES_PRIVATE "")
-endif()
+# Configure "Requires" field & install .pc files for packagers
+set(PC_REQUIRES "")
+set(PC_REQUIRES_PRIVATE "Requires.private: poppler = ${POPPLER_VERSION}")
 
 if(PKG_CONFIG_EXECUTABLE)
   poppler_create_install_pkgconfig(poppler.pc ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
@@ -794,6 +784,7 @@ else()
   MESSAGE(STATUS ".pc files will not be installed becasue of missing 'pkg-config'!")
 endif()
 
+# Summarize build options & display warnings for user
 message("Building Poppler with support for:")
 show_end_message("font configuration" ${font_configuration})
 show_end_message_yesno("splash output" ENABLE_SPLASH)
diff --git a/cmake/modules/MacroEnsureVersion.cmake b/cmake/modules/MacroEnsureVersion.cmake
deleted file mode 100644
index 6797e5b7..00000000
--- a/cmake/modules/MacroEnsureVersion.cmake
+++ /dev/null
@@ -1,117 +0,0 @@
-# This file defines the following macros for developers to use in ensuring
-# that installed software is of the right version:
-#
-# MACRO_ENSURE_VERSION        - test that a version number is greater than
-#                               or equal to some minimum
-# MACRO_ENSURE_VERSION_RANGE - test that a version number is greater than
-#                               or equal to some minimum and less than some
-#                               maximum
-# MACRO_ENSURE_VERSION2       - deprecated, do not use in new code
-#
-
-# MACRO_ENSURE_VERSION
-# This macro compares version numbers of the form "x.y.z" or "x.y"
-# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
-# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
-# Leading and trailing text is ok, e.g.
-# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
-# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
-
-# Copyright (c) 2006, David Faure, <faure at kde.org>
-# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# MACRO_ENSURE_VERSION_RANGE
-# This macro ensures that a version number of the form
-# "x.y.z" or "x.y" falls within a range defined by
-# min_version <= found_version < max_version.
-# If this expression holds, FOO_VERSION_OK will be set TRUE
-#
-# Example: MACRO_ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
-#
-# This macro will break silently if any of x,y,z are greater than 100.
-#
-# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# NORMALIZE_VERSION
-# Helper macro to convert version numbers of the form "x.y.z"
-# to an integer equal to 10^4 * x + 10^2 * y + z
-#
-# This macro will break silently if any of x,y,z are greater than 100.
-#
-# Copyright (c) 2006, David Faure, <faure at kde.org>
-# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# CHECK_RANGE_INCLUSIVE_LOWER
-# Helper macro to check whether x <= y < z
-#
-# Copyright (c) 2007, Will Stephenson <wstephenson at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
-    STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
-    if (_threePartMatch)
-    # parse the parts of the version string
-        STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
-        STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
-        STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
-    else (_threePartMatch)
-        STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
-        STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
-        set(_patch_vers "0")
-    endif (_threePartMatch)
-
-    # compute an overall version number which can be compared at once
-    MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
-ENDMACRO(NORMALIZE_VERSION)
-
-MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
-   if (${_value} LESS ${_lower_limit})
-      set( ${_ok} FALSE )
-  elseif (${_value} EQUAL ${_lower_limit})
-      set( ${_ok} TRUE )
-  elseif (${_value} EQUAL ${_upper_limit})
-      set( ${_ok} FALSE )
-  elseif (${_value} GREATER ${_upper_limit})
-      set( ${_ok} FALSE )
-  else (${_value} LESS ${_lower_limit})
-      set( ${_ok} TRUE )
-  endif (${_value} LESS ${_lower_limit})
-ENDMACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER)
-
-MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
-    NORMALIZE_VERSION( ${requested_version} req_vers_num )
-    NORMALIZE_VERSION( ${found_version} found_vers_num )
-
-    if (found_vers_num LESS req_vers_num)
-        set( ${var_too_old} FALSE )
-    else (found_vers_num LESS req_vers_num)
-        set( ${var_too_old} TRUE )
-    endif (found_vers_num LESS req_vers_num)
-
-ENDMACRO(MACRO_ENSURE_VERSION)
-
-MACRO(MACRO_ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
-    MACRO_ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
-ENDMACRO(MACRO_ENSURE_VERSION2)
-
-MACRO(MACRO_ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
-    NORMALIZE_VERSION( ${min_version} req_vers_num )
-    NORMALIZE_VERSION( ${found_version} found_vers_num )
-    NORMALIZE_VERSION( ${max_version} max_vers_num )
-
-    MACRO_CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
-ENDMACRO(MACRO_ENSURE_VERSION_RANGE)
-
-
commit 89f219c8f72b826d4c0ab4e3fc9a6962005d5151
Author: Kyle Auble <kyle.auble at outlook.com>
Date:   Sun Nov 8 16:31:00 2020 -0500

    cmake: Remove obsolete bool-to-binary macro
    
    Only used once & no longer needed; CMake configure_file converts
    True/False to def/undef transparently now.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96b7d0aa..1fee7dff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,7 +9,6 @@ include(PopplerMacros)
 include(MacroOptionalFindPackage)
 find_package(PkgConfig)
 include(MacroEnsureVersion)
-include(MacroBoolTo01)
 if (WIN32)
   message("-- Using win32 threads")
 else()
@@ -130,7 +129,6 @@ set(GLIB_REQUIRED "2.41")
 set(GTK_REQUIRED "3.8")
 set(GDK_PIXBUF_REQUIRED "2.8")
 
-macro_bool_to_01(ENABLE_SPLASH HAVE_SPLASH)
 find_package(Freetype REQUIRED)
 if(WITH_FONTCONFIGURATION_FONTCONFIG)
   find_package(Fontconfig REQUIRED)
@@ -177,7 +175,18 @@ if (ENABLE_QT6)
   endif()
 endif()
 
+# Check for rendering backends (Splash included unless disabled)
+set(HAVE_SPLASH ${ENABLE_SPLASH})
 macro_optional_find_package(Cairo ${CAIRO_VERSION})
+
+if(ENABLE_SPLASH)
+  find_package(Boost 1.58.0)
+  if(Boost_FOUND)
+    include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
+    set(USE_BOOST_HEADERS ON)
+  endif()
+endif()
+
 if(CAIRO_FOUND)
   set(HAVE_CAIRO ${CAIRO_FOUND})
   set(CAIRO_FEATURE "#define POPPLER_HAS_CAIRO 1")
@@ -311,14 +320,6 @@ if(LCMS2_FOUND)
   include_directories(SYSTEM ${LCMS2_INCLUDE_DIR})
 endif()
 
-if(ENABLE_SPLASH)
-  find_package(Boost 1.58.0)
-  if(Boost_FOUND)
-    include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
-    set(USE_BOOST_HEADERS ON)
-  endif()
-endif()
-
 # Recent versions of poppler-data install a .pc file.
 # Use it to determine the encoding data path, if available.
 # Default to the same prefix otherwise.
diff --git a/cmake/modules/MacroBoolTo01.cmake b/cmake/modules/MacroBoolTo01.cmake
deleted file mode 100644
index 63b98526..00000000
--- a/cmake/modules/MacroBoolTo01.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-# MACRO_BOOL_TO_01( VAR RESULT0 ... RESULTN )
-# This macro evaluates its first argument
-# and sets all the given vaiables either to 0 or 1
-# depending on the value of the first one
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-MACRO(MACRO_BOOL_TO_01 FOUND_VAR )
-   FOREACH (_current_VAR ${ARGN})
-      IF(${FOUND_VAR})
-         SET(${_current_VAR} 1)
-      ELSE(${FOUND_VAR})
-         SET(${_current_VAR} 0)
-      ENDIF(${FOUND_VAR})
-   ENDFOREACH(_current_VAR)
-ENDMACRO(MACRO_BOOL_TO_01)


More information about the poppler mailing list