[poppler] cmake issues

Adrian Johnson ajohnson at redneon.com
Sun Sep 3 00:55:20 UTC 2017


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
>> poppler at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/poppler
> 
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cmake-add-options-to-disable-glib-qt4-qt5.patch
Type: text/x-patch
Size: 6205 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170903/a8711f6b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ignore-build-directory.patch
Type: text/x-patch
Size: 509 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20170903/a8711f6b/attachment-0001.bin>


More information about the poppler mailing list