[libcamera-devel] [PATCH] build: Add 'std=c++11' compiler flag to libcamera
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Dec 12 15:01:00 CET 2018
Hi Jacopo,
On 12/12/2018 13:51, jacopo mondi wrote:
> Hi Kieran,
>
> On Wed, Dec 12, 2018 at 01:35:31PM +0000, Kieran Bingham wrote:
>> Hi Jacopo,
>>
>> On 12/12/2018 13:31, Jacopo Mondi wrote:
>>> Building the current master branch fails with:
>>> ./src/libcamera/include/log.h:25:34:
>>> error: defaulted and deleted functions only available with -std=c++11 \
>>> or -std=gnu++11 [-Werror]
>>> LogMessage(const LogMessage&) = delete;
>>>
>>> Fix this by adding the 'std=c++11' compiler argument to the src/libcamera
>>> build file.
>>>
>>> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
>>> ---
>>> src/libcamera/meson.build | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build
>>> index 0c44b5a..4457cde 100644
>>> --- a/src/libcamera/meson.build
>>> +++ b/src/libcamera/meson.build
>>> @@ -16,4 +16,5 @@ includes = [
>>> libcamera = shared_library('camera',
>>> libcamera_sources,
>>> install : true,
>>> - include_directories : includes)
>>> + include_directories : includes,
>>> + cpp_args : '-std=c++11')
>>
>>
>> Does this override - or add to the arguments I've already created in the
>> top level meson.build ?
>
> That's the ninja verbose output when building libcamera
>
> [1/10] ccache c++ -Isrc/libcamera/src at libcamera@@camera at sha -Isrc/libcamera -I../src/libcamera -Iinclude -I../include -I../src/libcamera/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -g -Wall -Wextra -Werror -Wno-unused-parameter -fPIC -std=c++11 -MD -MQ 'src/libcamera/src at libcamera@@camera at sha/log.cpp.o' -MF 'src/libcamera/src at libcamera@@camera at sha/log.cpp.o.d' -o 'src/libcamera/src at libcamera@@camera at sha/log.cpp.o' -c ../src/libcamera/log.cpp
>
> sorry, it sucks, but I see here both the globals:
> -Wall -Wextra -Werror -Wno-unused-parameter
>
> and the new:
> -std=c++11
>
Ok - good - so it's an append.
>> As this will be a project wide requirement - could you add that argument
>> to the global cpp_arguments before they get added to the project please?
>>
>
> I ended up setting it only for src/libcamera target because otherwise:
>
> ccache cc -Iutils/ipu3/utils at ipu3@@ipu3-unpack at exe ...
> cc1: warning: command line option ‘-std=c++11’ is valid for C++/ObjC++ but not for C
>
> when building utils/
>
> It's true that I added it as part of the 'common_arguments' array, but
> from the documentation and a few other attempts I've made, the meson's
> 'cpp_args' field is available only inside the target argument list
> https://mesonbuild.com/Adding-arguments.html
>
Sure - we don't want this added to C files.
How about :
diff --git a/meson.build b/meson.build
index 2fdb166cac60..1b0268079262 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,8 @@ common_arguments = [
c_arguments = common_arguments
cpp_arguments = common_arguments
+cpp_arguments += '-std=c++11'
+
add_project_arguments(c_arguments, language: 'c')
add_project_arguments(cpp_arguments, language: 'cpp')
Then this is a cpp specific thing in the global space.
My main reasoning here is so that any other C++ 'projects' beyond the
shared library will then have this as well - whereas your addition adds
only to the shared-library objects.
That may not be an issue - but it could affect us when we start adding
(c++) test applications and unit-tests.
--
Kieran
>>
>>
>>> --
>>> 2.7.4
>>>
>>> _______________________________________________
>>> libcamera-devel mailing list
>>> libcamera-devel at lists.libcamera.org
>>> https://lists.libcamera.org/listinfo/libcamera-devel
>>>
>>
>> --
>> Regards
>> --
>> Kieran
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list