From patchwork Wed Jun 19 15:06:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1482 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 35B8061A0C for ; Wed, 19 Jun 2019 17:06:59 +0200 (CEST) Received: from pendragon.bb.dnainternet.fi (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BE2D2333 for ; Wed, 19 Jun 2019 17:06:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1560956818; bh=ZXqlSP0Na945IFblPU93OTtBCqDcjHEUDZHspy0e2HU=; h=From:To:Subject:Date:From; b=Qrq9vjHUmPWbbVt0nbpDPh90WMcHjl7VCZRHNRvw+ZY7o4NM0sEglcFhJ+FhPRNHg XTsuG+cDwa/o9jodogkBrewvJRbYrZUcFZuK7NiQFkwnwdd52n13j2a+i8lBrBNmsN YaVMYiPkiU3TCk5tHcNA84+zp5nQpioeNc/JZeNI= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Wed, 19 Jun 2019 18:06:36 +0300 Message-Id: <20190619150636.30172-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] meson: Link against libc++ with compiling with clang X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jun 2019 15:06:59 -0000 libc++ is used by Chrome OS, and likely as well by other environments based on clang. Using it by default if available when compiling with clang will help extending the compile-testing coverage. The drawback is that issues specific to clang with libstdc++ will not be caught as easily, but based on the experience with clang so far, code compiling correctly with gcc/libstdc++ has failed with clang due to either clang-specific or libc++-specific behaviour, never due only to the combination of clang with libstdc++. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- meson.build | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meson.build b/meson.build index 4d3e99d3e58f..64a26e896a24 100644 --- a/meson.build +++ b/meson.build @@ -28,8 +28,17 @@ common_arguments = [ c_arguments = common_arguments cpp_arguments = common_arguments +# Use libc++ by default if available instead of libstdc++ when compiling with +# clang. +if cc.get_id() == 'clang' and cc.find_library('libc++').found() + cpp_arguments += [ + '-stdlib=libc++', + ] +endif + add_project_arguments(c_arguments, language : 'c') add_project_arguments(cpp_arguments, language : 'cpp') +add_project_link_arguments(cpp_arguments, language : 'cpp') libcamera_includes = include_directories('include')