[x265] [PATCH] cmake: generate and install pkgconfig file

Rafaël Carré funman at videolan.org
Wed Oct 23 16:05:26 CEST 2013


Le 23/10/2013 06:12, Steve Borho a écrit :
> On Tue, Oct 22, 2013 at 5:59 PM, Rafaël Carré <funman at videolan.org> wrote:
> 
>> Hi Steve,
>>
>> Le 23/10/2013 00:20, Steve Borho a écrit :
>>> # HG changeset patch
>>> # User Steve Borho <steve at borho.org>
>>> # Date 1382480398 18000
>>> #      Tue Oct 22 17:19:58 2013 -0500
>>> # Node ID f51a70b352878bb64c71cbcdc40898a9706db2cf
>>> # Parent  6d96d64c4e9a2c526b57274760a7147241328cb3
>>> cmake: generate and install pkgconfig file
>>>
>>> Feedback appreciated; what is this missing?
>>>
>>> diff -r 6d96d64c4e9a -r f51a70b35287 source/CMakeLists.txt
>>> --- a/source/CMakeLists.txt   Tue Oct 22 23:36:36 2013 +0530
>>> +++ b/source/CMakeLists.txt   Tue Oct 22 17:19:58 2013 -0500
>>> @@ -189,6 +189,13 @@
>>>          ARCHIVE DESTINATION lib)
>>>  install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION
>> include)
>>>
>>> +if(UNIX AND NOT APPLE)
>>
>> Hm this should always be installed, think about cross compilation.
>>
>> In VLC we use pkg-config on both OSX and when cross compiling our
>> Windows binaries (with custom install prefixes in both cases).
>>
>> Is it possible to disable installation only when targetting MSVC ?
>>
> 
> dead easy; but would it be better if I checked for whether pkgconfig was
> available?

Not sure if it is a good idea as pkg-config is not necessarily present.

e.g. debian packages are often made in a chroot with only the strict
minimal build requirements, and as x265 only depends on yasm pkg-config
would not be installed.

>>> +  # Produce a pkg-config file for linking against the shared lib
>>> +  configure_file("x265.pc.in" "x265.pc" @ONLY)
>>> +  install(FILES       "${CMAKE_CURRENT_BINARY_DIR}/x265.pc"
>>> +          DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}/pkgconfig")
>>
>> PROJECT_LIBRARY_INSTALL_DIR is not defined for me, I replaced it with
>> ${CMAKE_INSTALL_PREFIX}/lib locally.
>>
> 
> ok
> 
> 
>>
>>> +endif()
>>> +
>>>  if(NOT WIN32)
>>>      configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/
>> cmake_uninstall.cmake.in"
>>>
>> "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
>>> diff -r 6d96d64c4e9a -r f51a70b35287 source/x265.pc.in
>>> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/source/x265.pc.in       Tue Oct 22 17:19:58 2013 -0500
>>> @@ -0,0 +1,10 @@
>>> +prefix=@CMAKE_INSTALL_PREFIX@
>>> +exec_prefix=${prefix}
>>> +libdir=${exec_prefix}/lib
>>> +includedir=${prefix}/include
>>> +
>>> +Name: @CMAKE_PROJECT_NAME@
>>> +Description: H.265/HEVC video encoder
>>> +Version: @X265_LATEST_TAG@
>>> +Libs: -L${libdir} -lx265
>>
>> For static linking to work, this also needs:
>>
>> Libs.private: -lstdc++ -lm -lpthread
>>
> 
> Does this work?
> 
> Libs.private: @CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@ @PLATFORM_LIBS@

Some processing is needed: this expands to
Libs.private: stdc++;m;c pthread;m;rt


More information about the x265-devel mailing list