[libcamera-devel] [RFC PATCH] ipa: rpi: Make boost optional

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Sep 24 12:27:44 CEST 2020


Hi Jacopo,

On 24/09/2020 11:27, Jacopo Mondi wrote:
> Hi Kieran
> 
> On Thu, Sep 24, 2020 at 11:02:01AM +0100, Kieran Bingham wrote:
>> By default the Raspberry Pi pipeline handler is enabled when
>> configuring the build.
>>
>> The Raspberry Pi IPA currently depends upon 'boost' which is a large
>> dependency to bring in.
>>
>> Make the IPA compilation dependant upon the availabilty of the boost
>> library, but display a warning when the pipeline is enabled and the
>> dependency is not found.
>>
>> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>> ---
>>
>> This is mostly posted to promote discussion on this topic.
>>
>> The requirement for boost is really heavy (+100MB package for a few
>> headers), and is only used for the RPi IPA.
>>
>> This patch automatically disables the IPA while printing a message if it
>> was selected if the boost library is not available.
>>
>> Doing all of this in a clean way seems quite difficult because of the
>> way the meson options works ... so ...
>>
>> 3 ... 2 ... 1 ....
>>
>>    Discuss...
> 
> I really like the idea of depending on boost only if RPi is enabled.
> 
>>
>>
>>  src/ipa/raspberrypi/meson.build | 40 +++++++++++++++++++--------------
>>  1 file changed, 23 insertions(+), 17 deletions(-)
>>
>> diff --git a/src/ipa/raspberrypi/meson.build b/src/ipa/raspberrypi/meson.build
>> index 9445cd097df5..b284378c9621 100644
>> --- a/src/ipa/raspberrypi/meson.build
>> +++ b/src/ipa/raspberrypi/meson.build
>> @@ -2,9 +2,11 @@
>>
>>  ipa_name = 'ipa_rpi'
>>
>> +boost = dependency('boost', required : false)
>> +
>>  rpi_ipa_deps = [
>>      libcamera_dep,
>> -    dependency('boost'),
>> +    boost,
>>      libatomic,
>>  ]
>>
>> @@ -41,22 +43,26 @@ rpi_ipa_sources = files([
>>      'controller/pwl.cpp',
>>  ])
>>
>> -mod = shared_module(ipa_name,
>> -                    rpi_ipa_sources,
>> -                    name_prefix : '',
>> -                    include_directories : rpi_ipa_includes,
>> -                    dependencies : rpi_ipa_deps,
>> -                    link_with : libipa,
>> -                    install : true,
>> -                    install_dir : ipa_install_dir)
>> -
>> -if ipa_sign_module
>> -    custom_target(ipa_name + '.so.sign',
>> -                  input : mod,
>> -                  output : ipa_name + '.so.sign',
>> -                  command : [ ipa_sign, ipa_priv_key, '@INPUT@', '@OUTPUT@' ],
>> -                  install : false,
>> -                  build_by_default : true)
>> +if boost.found()
>> +    mod = shared_module(ipa_name,
>> +                        rpi_ipa_sources,
>> +                        name_prefix : '',
>> +                        include_directories : rpi_ipa_includes,
>> +                        dependencies : rpi_ipa_deps,
>> +                        link_with : libipa,
>> +                        install : true,
>> +                        install_dir : ipa_install_dir)
>> +
>> +    if ipa_sign_module
>> +        custom_target(ipa_name + '.so.sign',
>> +                      input : mod,
>> +                      output : ipa_name + '.so.sign',
>> +                      command : [ ipa_sign, ipa_priv_key, '@INPUT@', '@OUTPUT@' ],
>> +                      install : false,
>> +                      build_by_default : true)
>> +    endif
>> +else
>> +    warning('The Raspberry Pi pipeline is enabled, but dependency "boost" was not found')
> 
> 
> I know nothing about meson, but can we have a contruct that
>         if !boost.found
>                 error "..."
> 
> and the build fails ?

We can of course have the build fail if the RPi pipeline is enabled, and
boost is not found, but that's not what this patch does.

In fact, I think you're describing the current behaviour of libcamera ;-)

This patch disables the RPi IPA *only* even if the RPi Pipeline is
enabled, but boost is not found, (because it is enabled, by default).
--
Kieran


>>  endif
>>
>>  subdir('data')
>> --
>> 2.25.1
>>
>> _______________________________________________
>> libcamera-devel mailing list
>> libcamera-devel at lists.libcamera.org
>> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list