Fixing OpenAL and libsndfile dependencies in kdegames (Was `Re: KDE/kdegames')

Raphael Kubo da Costa kubito at gmail.com
Wed May 18 18:35:13 CEST 2011


Raphael Kubo da Costa <kubito at gmail.com> writes:

> CC'ing kde-buildsystem to this thread.
>
> Ian Wadham <iandw.au at gmail.com> writes:
>> SVN commit 1232491 by ianw:
>>
>> Make the dependency of Granatier and KGoldrunner on OpenAL and SndFile
>> optional. The dependency should really be REQUIRED, but that kills the
>> whole KDE Games build if OpenAL or SndFile is not present. If OpenAL
>> is absent, Granatier will not be built and KGoldrunner will be built
>> but with sound completely disabled.
>>
>>  M  +5 -0      CMakeLists.txt  
>>  M  +3 -7      kgoldrunner/CMakeLists.txt  
>>  M  +0 -2      kgoldrunner/src/kgrglobals.h  
>
> Hi, Ian,
>
> I saw the commit message by chance in #kde-commits and decided to take a
> look.
>
> From what I understood, you want both libsndfile and OpenAL to be hard
> (ie. required) dependencies for Granatier and KGoldRunner, but only if
> they are built (ie. if one passes -DBUILD_granatier=OFF and
> -DBUILD_kgoldrunner=OFF), kdegames should build just fine without
> libsndfile and OpenAL installed in the system.
>
> In this case, wouldn't it be enough to call find_package(SndFile) and
> find_package(OpenAL) and then add the respective macro_log_feature()
> calls with the `REQUIRED' parameter set to TRUE instead of FALSE?
>
> By putting these commands inside granatier/CMakeLists.txt and
> kgoldrunner/CMakeLists.txt, you avoid calling them when granatier and
> kgoldrunner are not build, while still failing to build when they are
> not found.

Hey there again,

I'm replying to this list and thread instead of release-team@ as the
subject is more appropriate to be discussed here. I also suggest
subscribing to this list, as more people might want to give their
suggestions and they might forget to CC you.

So what I have in mind is the following:

  * Granatier and KGoldRunner are optional parts of kdegames (ie. one
    can call cmake with -DBUILD_granatier=OFF and
    -DBUILD_kgoldrunner=OFF and none of them will be built).
  * If one chooses not to build Granatier and KGoldRunner, CMake must
    not check for libsndfile and OpenAL.
  * If one does choose to build Granatier and/or KGoldRunner, CMake must
    check for both libsndfile and OpenAL, and fail at the end of the
    configuration phase (ie. after cmake runs and before you run make)
    if either of them (or both) is not found.

So the attached patch:

  * Moves FindSndFile.cmake to the top-level cmake/modules directory
    (you might want to avoid this as kdegames is splitting in git).
  * Unconditionally adds
        macro_optional_add_subdirectory(granatier)
        macro_optional_add_subdirectory(kgoldrunner)
    to the top-level CMakeLists.txt
  * In {granatier,kgoldrunner}/CMakeLists.txt it calls
    find_package()+macro_log_feature() for both OpenAL and
    libsndfile. As `REQUIRED' is not passed to find_package(), CMake
    keeps going until the end, when the build fails if the dependencies
    are not met, as macro_log_feature() is called with required=TRUE.

Is it clear now?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdegames-openal-sndfile-deps.diff
Type: text/x-patch
Size: 8265 bytes
Desc: Proposed patch
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20110518/957fca7f/attachment.diff 


More information about the Kde-buildsystem mailing list