On 03/09/17 01:45, Albert Astals Cid wrote:
> El dissabte, 2 de setembre de 2017, a les 22:34:04 CEST, Adrian Johnson va 
> escriure:
>> As the autotools build will be dropped I've been gaining more experience
>> with the cmake build. I've found a few problems:
>>
>> 1) Is there any way to selectively disable the fontends? If I'm working
>> on core I like to minimize the rebuild times.
> 
> Not really, the "command line options" we support are around the
>   # command line switches
> of CMakeLists.txt. What I do when i don't want to rebuild everything is just 
> type make poppler for the lib or make pdfinfo so that pdfinfo (and the lib) 
> get recompiled.
> 
> If configure supports this and you really think it's a must i guess we could 
> add it, but I personally think its a good idea to have a build with 
> everything 
> configured, build selectively what you want (i.e. make pdfinfo) and then just 
> run a final make to make sure you didn't break something else by chance.

I think it is a good idea. The problem with "make pdfinfo" is I often
run multiple utils when testing. If I ran "make pdftocairo", I may run
pdfinfo forgetting that I didn't rebuild it.

I've attached a patch to implement this.

> 
>> 2) I usually install cairo git and poppler git to their own prefix for
>> testing. I compile popper with PKG_CONFIG_PATH set to this location so
>> it will link with cairo git. poppler-glib-demo is failing to link with
>> cairo. pdftocairo links fine. I noticed this because there is some new
>> API in cairo git and I have a poppler branch with support for this API.
>>
>> The problem is the poppler-glib-demo link command lists "-lcairo" then
>> the libcairo.so.
> 
> you mean it's there twice? one as -lcairo and one as libcairo.so?

Yes. The problem is -lcairo is always first so it links with the system
cairo.

> 
>> Manually running the link command without "-lcairo" (or
>> even just putting it after the libcairo.so) fixes the linking. The
>> pdftocairo link command does not have "-lcairo".
>>
>> I don't know how to fix this in cmake. I assume it is the linking with
>> gtk3 that is adding the -lcairo. I tried adding ${CAIRO_LIBRARIES}
>> before ${GTK3_LIBRARIES} in glib/demo/CMakeLists.txt but it still fails
>> to link.
> 
> does changing 
>   target_link_libraries(poppler-glib-demo poppler-glib ${GTK3_LIBRARIES})
> to
>   target_link_libraries(poppler-glib-demo ${GTK3_LIBRARIES} poppler-glib)
> help?

No. And I don't understand why

target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} poppler-glib
${GTK3_LIBRARIES})

doesn't make the libcairo.so appear before -lcairo.


> 
>>
>> 3) What is the preferred way to run cmake. In the top level dir? Or
>> create a build dir and run it in that? If I build in the top level dir,
>> git status shows a lot of build noise that has not been added to
>> .gitignore. I have to run git clean to clean it up. Whichever way is
>> best we should add the build output to .gitignore to hide it from git
>> status.
> 
> Yeah it's better just to create a build directory and run cmake .., this way 
> you can just nuke the builddir altogether if you want to make sure you're 
> running something totally clean. Some projects go to the extreme of 
> forbidding 
> a buildroot equal to the sourceroot (I think there's a relatively easy way to 
> do that in cmake) but i don't think we need to be that extreme, no?

I've attached a gitignore path to exclude the build dir. We can document
the use of the build dir in INSTALL when autoconf is removed.

> 
> Cheers,
>   Albert
> 
>> _______________________________________________
>> poppler mailing list
>> [email protected]
>> https://lists.freedesktop.org/mailman/listinfo/poppler
> 
> 
> _______________________________________________
> poppler mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/poppler
> 

>From efc242048e8b7ed7727c0fb5ca5c19e2e9831ed8 Mon Sep 17 00:00:00 2001
From: Adrian Johnson <[email protected]>
Date: Sun, 3 Sep 2017 08:57:06 +0930
Subject: [PATCH 1/2] cmake: add options to disable glib/qt4/qt5

---
 CMakeLists.txt | 75 +++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 45 insertions(+), 30 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4025a800..1779d685 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,6 +38,9 @@ option(BUILD_CPP_TESTS "Whether compile the CPP test programs." ON)
 option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
 option(ENABLE_UTILS "Compile poppler command line utils." ON)
 option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
+option(ENABLE_GLIB "Compile poppler glib wrapper." ON)
+option(ENABLE_QT4 "Compile poppler qt4 wrapper." ON)
+option(ENABLE_QT5 "Compile poppler qt5 wrapper." ON)
 set(ENABLE_LIBOPENJPEG "auto" CACHE STRING "Use libopenjpeg for JPX streams. Possible values: auto, openjpeg1, openjpeg2, unmaintained, none. 'auto' prefers openjpeg2 over openjpeg1 if both are available. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no JPX decoder at all. Default: auto")
 set(ENABLE_CMS "auto" CACHE STRING "Use color management system. Possible values: auto, lcms1, lcms2. 'auto' prefers lcms2 over lcms1 if both are available. Unset to disable color management system.")
 set(ENABLE_DCTDECODER "libjpeg" CACHE STRING "Use libjpeg for DCT streams. Possible values: libjpeg, unmaintained, none. will use libjpeg if available or fail if not. 'unmaintained' gives you the internal unmaintained decoder. Use at your own risk. 'none' compiles no DCT decoder at all. Default: libjpeg")
@@ -129,23 +132,31 @@ elseif(ENABLE_DCTDECODER STREQUAL "none")
 else()
   message(FATAL_ERROR "Invalid ENABLE_DCTDECODER value.")
 endif()
-macro_optional_find_package(Qt4)
-if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
-  find_package(Qt5Core)
-  find_package(Qt5Gui)
-  find_package(Qt5Xml)
-  find_package(Qt5Widgets)
-  find_package(Qt5Test)
-  if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
-    set(QT5_FOUND true)
-  else ()
-    message("-- Package Qt5Core or Qt5Gui or Qt5Xml or Qt5Widgets or Qt5Test not found")
+if (ENABLE_QT4 OR ENABLE_QT5)
+  macro_optional_find_package(Qt4)
+  if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+    find_package(Qt5Core)
+    find_package(Qt5Gui)
+    find_package(Qt5Xml)
+    find_package(Qt5Widgets)
+    find_package(Qt5Test)
+    if (Qt5Core_FOUND AND Qt5Gui_FOUND AND Qt5Xml_FOUND AND Qt5Widgets_FOUND AND Qt5Test_FOUND)
+      set(QT5_FOUND true)
+    else ()
+      message("-- Package Qt5Core or Qt5Gui or Qt5Xml or Qt5Widgets or Qt5Test not found")
+      set(QT5_FOUND false)
+    endif()
+  else(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
     set(QT5_FOUND false)
-  endif()
-else(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
-  set(QT5_FOUND false)
-  message("-- CMake >= 2.8.8 is needed to enable Qt5")
-endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+    message("-- CMake >= 2.8.8 is needed to enable Qt5")
+  endif(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} VERSION_GREATER 2.8.7)
+  if (NOT QT4_FOUND)
+    set(ENABLE_QT4 OFF)
+  endif (NOT QT4_FOUND)
+  if (NOT QT5_FOUND)
+    set(ENABLE_QT5 OFF)
+  endif (NOT QT5_FOUND)
+endif (ENABLE_QT4 OR ENABLE_QT5)
 
 macro_optional_find_package(Cairo ${CAIRO_VERSION})
 if(CAIRO_FOUND)
@@ -154,16 +165,20 @@ if(CAIRO_FOUND)
   set(CAIRO_REQ "cairo")
   set(POPPLER_GLIB_DISABLE_DEPRECATED "")
   set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "")
-  macro_optional_find_package(GLIB)
-  if(GLIB_FOUND)
-    set(ENABLE_GLIB ON)
+  if(ENABLE_GLIB)
+    macro_optional_find_package(GLIB)
+    if(NOT GLIB_FOUND)
+      set(ENABLE_GLIB OFF)
+    endif(NOT GLIB_FOUND)
+  endif(ENABLE_GLIB)
+  if(ENABLE_GLIB)
     # Check for introspection
     macro_optional_find_package(GObjectIntrospection 0.9.12)
     set(HAVE_INTROSPECTION ${INTROSPECTION_FOUND})
     set(POPPLER_GLIB_DISABLE_DEPRECATED "${POPPLER_GLIB_DISABLE_DEPRECATED} -DG_DISABLE_DEPRECATED")
     set(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES "${POPPLER_GLIB_DISABLE_SINGLE_INCLUDES} -DG_DISABLE_SINGLE_INCLUDES")
     macro_optional_find_package(GTK)
-  endif(GLIB_FOUND)
+  endif(ENABLE_GLIB)
 else(CAIRO_FOUND)
   set(CAIRO_FEATURE "#undef POPPLER_HAS_CAIRO")
 endif(CAIRO_FOUND)
@@ -721,12 +736,12 @@ if(ENABLE_GLIB)
   add_subdirectory(glib)
 endif(ENABLE_GLIB)
 add_subdirectory(test)
-if(QT4_FOUND)
+if(ENABLE_QT4)
   add_subdirectory(qt4)
-endif(QT4_FOUND)
-if(QT5_FOUND)
+endif(ENABLE_QT4)
+if(ENABLE_QT5)
   add_subdirectory(qt5)
-endif(QT5_FOUND)
+endif(ENABLE_QT5)
 if(ENABLE_CPP)
   add_subdirectory(cpp)
 endif(ENABLE_CPP)
@@ -748,12 +763,12 @@ poppler_create_install_pkgconfig(poppler.pc lib${LIB_SUFFIX}/pkgconfig)
 if(ENABLE_SPLASH)
   poppler_create_install_pkgconfig(poppler-splash.pc lib${LIB_SUFFIX}/pkgconfig)
 endif(ENABLE_SPLASH)
-if(QT4_FOUND)
+if(ENABLE_QT4)
   poppler_create_install_pkgconfig(poppler-qt4.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(QT4_FOUND)
-if(QT5_FOUND)
+endif(ENABLE_QT4)
+if(ENABLE_QT5)
   poppler_create_install_pkgconfig(poppler-qt5.pc lib${LIB_SUFFIX}/pkgconfig)
-endif(QT5_FOUND)
+endif(ENABLE_QT5)
 if(ENABLE_GLIB)
   poppler_create_install_pkgconfig(poppler-glib.pc lib${LIB_SUFFIX}/pkgconfig)
 endif(ENABLE_GLIB)
@@ -772,8 +787,8 @@ if(SPLASH_CMYK)
   message("      with CMYK support")
 endif()
 show_end_message_yesno("cairo output" CAIRO_FOUND)
-show_end_message_yesno("qt4 wrapper" QT4_FOUND)
-show_end_message_yesno("qt5 wrapper" QT5_FOUND)
+show_end_message_yesno("qt4 wrapper" ENABLE_QT4)
+show_end_message_yesno("qt5 wrapper" ENABLE_QT5)
 show_end_message_yesno("glib wrapper" ENABLE_GLIB)
 show_end_message_yesno("  introspection" INTROSPECTION_FOUND)
 show_end_message_yesno("cpp wrapper" ENABLE_CPP)
-- 
2.11.0

>From f7f02e04d85ff09effebf25912270984bf3aeaea Mon Sep 17 00:00:00 2001
From: Adrian Johnson <[email protected]>
Date: Sun, 3 Sep 2017 08:59:53 +0930
Subject: [PATCH 2/2] ignore build directory

---
 .gitignore | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitignore b/.gitignore
index 2e27da28..6557d491 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,5 @@ poppler-qt4-uninstalled.pc
 poppler-qt5-uninstalled.pc
 poppler-splash-uninstalled.pc
 poppler-uninstalled.pc
+/build/
+
-- 
2.11.0

_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to