On 06/09/17 03:03, Albert Astals Cid wrote:
> El dimarts, 5 de setembre de 2017, a les 8:14:56 CEST, Adrian Johnson va
> escriure:
>> On 05/09/17 06:39, Albert Astals Cid wrote:
>>> El dilluns, 4 de setembre de 2017, a les 7:52:39 CEST, Adrian Johnson va
> escriure:
>>>> On 04/09/17 06:12, Albert Astals Cid wrote:
>>>>> El diumenge, 3 de setembre de 2017, a les 14:24:16 CEST, Adrian Johnson
>>>>> va
>>>>>
>>>>> escriure:
>>>>>> I managed to get it working. See attached patch. The problem seems to
>>>>>> be
>>>>>> that pkg_check_modules does not return the absolute path of the shared
>>>>>> libraries. There is a bug for this at
>>>>>> https://cmake.org/Bug/view.php?id=15804.
>>>>>>
>>>>>> Is there a better way to handle this?
>>>>>
>>>>> That's a really weird patch, cna you tell me exactly how is your setup
>>>>> so
>>>>> i
>>>>> can try reproducing the problem you have?
>>>>
>>>> Attached is a script to reproduce it. It downloads and installs the
>>>> latest cairo development snapshot to a custom prefix. Then patches
>>>> poppler to use the new API in this version of cairo and tries to build
>>>> it.
>>>
>>> Another fix is using this patch.
>>
>> That works. Although I thought I tried that before. Probably also needs
>> freetype listed as I sometimes build freetype from git.
>
> Ok, i'll commit, let's add freetype if needed when you can try that scenario,
> maybe it's not needed (don't know if gtk libraries pulls freetype).
So now I've run into the same problem with freetype. Cairo 1.15.8 uses
FT_Get_Var_Design_Coordinates() if freetype >= 2.8.0. With these
versions of cairo and freetype installed to a custom location and
PKG_CONFIG_PATH pointing at them, linking pdftocairo fails because
poppler has found my custom built cairo but is linking with the system
freetype.
I tried adding FREETYPE_LIBRARIES to the target_link_libraries but this
did not work. The problem seems to be poppler is using find_package() to
find freetype. But find_package() doesn't use pkg-config and finds the
system freetype instead.
I changed CMakeLists.txt to use pkg_check_modules to find freetype. Now
it finds my custom freetype but still tries to link with the system
freetype because it doesn't have the absolute path to the freetype
library. Which is due to this bug https://cmake.org/Bug/view.php?id=15804.
The attached patch works for me. Is there a standard cmake way of
handling pkg-config based libraries in non standard locations? I expect
the same problem will occur with every pkg-config based library we use
>
> Cheers,
> Albert
>
>>
>>> Seems less bad than the last one you sent (which tbh i didn't undestand at
>>> all), no?
>> I was trying to avoid listing both "-lcairo" and /path/to/my/libcairo.so
>> in the linker command line. FindCairo.cmake was using find_library to
>> get the absolute path while FindGTK.cmake was not.
>>
>>> 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
>
>
> _______________________________________________
> poppler mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/poppler
>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4288be38..2dc12891 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -110,7 +110,8 @@ set(CAIRO_VERSION "1.10.0")
set(GLIB_REQUIRED "2.41")
macro_bool_to_01(ENABLE_SPLASH HAVE_SPLASH)
-find_package(Freetype REQUIRED)
+pkg_check_modules(FREETYPE freetype2 REQUIRED)
+find_library(FREETYPE_LIBRARY freetype PATHS ${FREETYPE_LIBRARY_DIRS} NO_DEFAULT_PATH)
if(WITH_FONTCONFIGURATION_FONTCONFIG)
find_package(Fontconfig REQUIRED)
endif()
diff --git a/glib/demo/CMakeLists.txt b/glib/demo/CMakeLists.txt
index 8ccbb449..34cf6c10 100644
--- a/glib/demo/CMakeLists.txt
+++ b/glib/demo/CMakeLists.txt
@@ -26,4 +26,4 @@ set(poppler_glib_demo_SRCS
taggedstruct.c
)
poppler_add_test(poppler-glib-demo BUILD_GTK_TESTS ${poppler_glib_demo_SRCS})
-target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} poppler-glib ${GTK3_LIBRARIES})
+target_link_libraries(poppler-glib-demo ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARY} poppler-glib ${GTK3_LIBRARIES})
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 5bae1c7b..ed981948 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -28,7 +28,7 @@ if (GTK_FOUND)
gtk-test.cc
)
poppler_add_test(gtk-test BUILD_GTK_TESTS ${gtk_splash_test_SRCS})
- target_link_libraries(gtk-test ${CAIRO_LIBRARIES} poppler-glib ${GTK3_LIBRARIES})
+ target_link_libraries(gtk-test ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARY} poppler-glib ${GTK3_LIBRARIES})
if (HAVE_CAIRO)
@@ -36,7 +36,7 @@ if (GTK_FOUND)
pdf-inspector.cc
)
poppler_add_test(pdf-inspector BUILD_GTK_TESTS ${pdf_inspector_SRCS})
- target_link_libraries(pdf-inspector ${CAIRO_LIBRARIES} poppler-glib ${GTK3_LIBRARIES})
+ target_link_libraries(pdf-inspector ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARY} poppler-glib ${GTK3_LIBRARIES})
endif ()
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 2925eb25..7c630d4e 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -33,7 +33,7 @@ if (HAVE_CAIRO)
)
add_definitions(${CAIRO_CFLAGS})
add_executable(pdftocairo ${pdftocairo_SOURCES})
- target_link_libraries(pdftocairo ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES} ${common_libs})
+ target_link_libraries(pdftocairo ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARY} ${common_libs})
if(LCMS_FOUND)
target_link_libraries(pdftocairo ${LCMS_LIBRARIES})
endif()
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler