[libcamera-devel] [PATCH 2/2] libcamera: Use compile optimisation by default

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Apr 29 14:47:51 CEST 2019


Hi Kieran,

On Mon, Apr 29, 2019 at 01:37:55PM +0100, Kieran Bingham wrote:
> On 29/04/2019 00:12, Laurent Pinchart wrote:
> > Set the compiler optimisation level to 2 by default.
> 
> Isn't this handled already by the buildtype?
> 
> buildtype {plain, debug, debugoptimized, release, minsize, custom}
> 
> The default buildtype is 'debug', which I would expect to have an
> optimization level of '0' or 'g' to make debugging in GDB easier.
> 
> 
> Looking at https://mesonbuild.com/Running-Meson.html, it states that the
> buildtype has the following effects:
> 
> ========================================================================
> You can specify a different type of build with the --buildtype command
> line argument. It can have one of the following values.
> 
> value	 	meaning
> 
> plain		no extra build flags are used, even for compiler
> 		warnings, useful for distro packagers and other cases
> 		where you need to specify all arguments by yourself
> 
> debug		debug info is generated but the result is not optimized,
> 		this is the default
> 
> debugoptimized	debug info is generated and the code is optimized (on
> 		most compilers this means -g -O2)
> 
> release		full optimization, no debug info
> ========================================================================
> 
> So I think this patch is unnecessary.

I've tested this before and the optimisation level wasn't set
appropriately, but I think I made a mistake somewhere, as testing it now
produces the expected results. I thus agree with you, I'll drop this
patch.

Given that optimised builds use _FORTIFY_SOURCE by default with gcc,
should we enable that in the libcamera buildroot package ? Or does
buildroot handle that internally ?

> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > ---
> >  meson.build | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/meson.build b/meson.build
> > index d272ff33b100..a11a1e4c238e 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -5,6 +5,7 @@ project('libcamera', 'c', 'cpp',
> >      'werror=true',
> >      'warning_level=2',
> >      'cpp_std=c++11',
> > +    'optimization=2',
> >    ],
> >    license : 'LGPL 2.1+')
> >  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list