[{"id":24473,"web_url":"https://patchwork.libcamera.org/comment/24473/","msgid":"<YvJadtx3xig7bFTk@pendragon.ideasonboard.com>","date":"2022-08-09T13:00:38","subject":"Re: [libcamera-devel] [SimpleCam PATCH] cmake: Provide a sample\n\tCMakeLists.txt","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Tue, Aug 09, 2022 at 01:10:44PM +0100, Kieran Bingham via libcamera-devel wrote:\n> While libcamera uses meson as its build infrastructure, applications are\n> free to use other make systems. CMake is widely used, so add an example\n> CMakeLists.txt to support building simple-cam and linking against\n> libcamera using cmake.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++\n>  1 file changed, 32 insertions(+)\n>  create mode 100644 CMakeLists.txt\n> \n> diff --git a/CMakeLists.txt b/CMakeLists.txt\n> new file mode 100644\n> index 000000000000..fc8e734bdf59\n> --- /dev/null\n> +++ b/CMakeLists.txt\n> @@ -0,0 +1,32 @@\n> +cmake_minimum_required(VERSION 3.6)\n> +\n> +project(SimpleCam\n> +\tVERSION 1.0\n\nShould meson.build also set version to 1.0 ?\n\n> +\tDESCRIPTION \"A small and documented example application for libcamera\"\n> +\tLANGUAGES CXX)\n> +\n> +#set (CMAKE_EXPORT_COMPILE_COMMANDS ON)\n\nShould this line be dropped ? If you want to keep it as an example, I\nwould add a comment before it.\n\n> +set (CMAKE_CXX_STANDARD 17)\n> +\n> +find_package(PkgConfig)\n> +\n> +pkg_check_modules(LIBCAMERA REQUIRED IMPORTED_TARGET libcamera)\n> +message(STATUS \"libcamera library found:\")\n> +message(STATUS \"    version: ${LIBCAMERA_VERSION}\")\n> +message(STATUS \"    libraries: ${LIBCAMERA_LINK_LIBRARIES}\")\n> +message(STATUS \"    include path: ${LIBCAMERA_INCLUDE_DIRS}\")\n> +\n> +# libevent is used specifically by simple-cam as it's event loop.\n\ns/it's/its/\n\n> +# Applications may use a different event handling implementation.\n> +pkg_check_modules(LIBEVENT REQUIRED IMPORTED_TARGET libevent_pthreads)\n> +message(STATUS \"libevent_pthreads library found:\")\n> +message(STATUS \"    version: ${LIBEVENT_VERSION}\")\n> +message(STATUS \"    libraries: ${LIBEVENT_LINK_LIBRARIES}\")\n> +message(STATUS \"    include path: ${LIBEVENT_INCLUDE_DIRS}\")\n> +\n> +include_directories(${CMAKE_SOURCE_DIR} ${LIBCAMERA_INCLUDE_DIRS} ${LIBEVENT_INCLUDE_DIRS})\n> +\n> +add_executable(simple-cam simple-cam.cpp event_loop.cpp)\n> +\n> +target_link_libraries(simple-cam PkgConfig::LIBEVENT)\n> +target_link_libraries(simple-cam PkgConfig::LIBCAMERA)\n\nCould you also add the following compiler flags to match what we do in\nmeson.build ?\n\n-Wall\n-Winvalid-pch\n-Wnon-virtual-dtor\n-Wextra\n-Werror\n-Wno-unused-parameter","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5611FC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Aug 2022 13:00:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9AD946332B;\n\tTue,  9 Aug 2022 15:00:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9634461FAA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Aug 2022 15:00:50 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ED6DA481;\n\tTue,  9 Aug 2022 15:00:49 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660050051;\n\tbh=h3hThpCzbpzwd/Oht0DwHx3SUuefpd/t0PnRu1Pn9ew=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=BFLwNCrFnq/y16RwKXFneYThOSg7NNR8prSYOVFFUGgG5Kyb+fOmQhVmCMxYTmduq\n\tknvO5nnYbJaRcULV7RAinKjw8d+XmVv6DGFxzsHuty305p+L79G3m8aT1r5kFsBLnJ\n\toZlcQarYElnYbOGkYeVhTh74qxVHIiXaDOftb6BsnMpNGxyRKDUKD8beunr692FuT7\n\t+QJ8CP4bnRVatCFQjSYfw9taGTxPC+xLm/VsbeNRblFvV4mZfqFd6DUll8bYaOnx+N\n\tb0cxzpFLm/fLHY8UU7HQFRT23SYMvLUOolWqndk8o5YuRltGMZ/jB5QG70sSxRGuib\n\tg3kaO6CCq1YVQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660050050;\n\tbh=h3hThpCzbpzwd/Oht0DwHx3SUuefpd/t0PnRu1Pn9ew=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OvONCTPTJbVOql8kceL9OIXYA61cgTR4zlq83HeOs8Dio0fKfWl2AOOQFr0gW49Gn\n\tkxMVRrECv7FccnndkWPEPIlWvBWygigCpRcJwCiJjRVqwlOxVsWbAnEiuMc+1WUsVA\n\tC4v7QWlXZypMD26OHaXR4XJJYSi5fP288xeu3NDY="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"OvONCTPT\"; dkim-atps=neutral","Date":"Tue, 9 Aug 2022 16:00:38 +0300","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YvJadtx3xig7bFTk@pendragon.ideasonboard.com>","References":"<20220809121044.2039635-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20220809121044.2039635-1-kieran.bingham@ideasonboard.com>","Subject":"Re: [libcamera-devel] [SimpleCam PATCH] cmake: Provide a sample\n\tCMakeLists.txt","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24476,"web_url":"https://patchwork.libcamera.org/comment/24476/","msgid":"<166005169836.2190824.11024624303614989180@Monstersaurus>","date":"2022-08-09T13:28:18","subject":"Re: [libcamera-devel] [SimpleCam PATCH] cmake: Provide a sample\n\tCMakeLists.txt","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2022-08-09 14:00:38)\n> Hi Kieran,\n> \n> Thank you for the patch.\n> \n> On Tue, Aug 09, 2022 at 01:10:44PM +0100, Kieran Bingham via libcamera-devel wrote:\n> > While libcamera uses meson as its build infrastructure, applications are\n> > free to use other make systems. CMake is widely used, so add an example\n> > CMakeLists.txt to support building simple-cam and linking against\n> > libcamera using cmake.\n> > \n> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++\n> >  1 file changed, 32 insertions(+)\n> >  create mode 100644 CMakeLists.txt\n> > \n> > diff --git a/CMakeLists.txt b/CMakeLists.txt\n> > new file mode 100644\n> > index 000000000000..fc8e734bdf59\n> > --- /dev/null\n> > +++ b/CMakeLists.txt\n> > @@ -0,0 +1,32 @@\n> > +cmake_minimum_required(VERSION 3.6)\n> > +\n> > +project(SimpleCam\n> > +     VERSION 1.0\n> \n> Should meson.build also set version to 1.0 ?\n\nI don't think I care about it ;-)\n\nI think I can drop the statement.\n\n> > +     DESCRIPTION \"A small and documented example application for libcamera\"\n> > +     LANGUAGES CXX)\n> > +\n> > +#set (CMAKE_EXPORT_COMPILE_COMMANDS ON)\n> \n> Should this line be dropped ? If you want to keep it as an example, I\n> would add a comment before it.\n\nYes, this is just a leftover.\n\n> > +set (CMAKE_CXX_STANDARD 17)\n> > +\n> > +find_package(PkgConfig)\n> > +\n> > +pkg_check_modules(LIBCAMERA REQUIRED IMPORTED_TARGET libcamera)\n> > +message(STATUS \"libcamera library found:\")\n> > +message(STATUS \"    version: ${LIBCAMERA_VERSION}\")\n> > +message(STATUS \"    libraries: ${LIBCAMERA_LINK_LIBRARIES}\")\n> > +message(STATUS \"    include path: ${LIBCAMERA_INCLUDE_DIRS}\")\n> > +\n> > +# libevent is used specifically by simple-cam as it's event loop.\n> \n> s/it's/its/\n> \n> > +# Applications may use a different event handling implementation.\n> > +pkg_check_modules(LIBEVENT REQUIRED IMPORTED_TARGET libevent_pthreads)\n> > +message(STATUS \"libevent_pthreads library found:\")\n> > +message(STATUS \"    version: ${LIBEVENT_VERSION}\")\n> > +message(STATUS \"    libraries: ${LIBEVENT_LINK_LIBRARIES}\")\n> > +message(STATUS \"    include path: ${LIBEVENT_INCLUDE_DIRS}\")\n> > +\n> > +include_directories(${CMAKE_SOURCE_DIR} ${LIBCAMERA_INCLUDE_DIRS} ${LIBEVENT_INCLUDE_DIRS})\n> > +\n> > +add_executable(simple-cam simple-cam.cpp event_loop.cpp)\n> > +\n> > +target_link_libraries(simple-cam PkgConfig::LIBEVENT)\n> > +target_link_libraries(simple-cam PkgConfig::LIBCAMERA)\n> \n> Could you also add the following compiler flags to match what we do in\n> meson.build ?\n\nYes, I'll figure out how to add it.\n\n> \n> -Wall\n> -Winvalid-pch\n> -Wnon-virtual-dtor\n> -Wextra\n> -Werror\n> -Wno-unused-parameter\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7D3ECBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Aug 2022 13:28:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E6AC76332B;\n\tTue,  9 Aug 2022 15:28:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 511F761FAA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Aug 2022 15:28:21 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C9BD2481;\n\tTue,  9 Aug 2022 15:28:20 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660051702;\n\tbh=jEwMI+L3K/EsI4evTDMrkQe/1ZxX4rN8cY7QrB3Hhc0=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=04XOi3G10wk9dQfo59cM8/47zP0mw2lPECSd8ew9bItFbyuWkT5n5VVVARccQnFVF\n\tJ62or6RXsvMG4MCWtEKAUEf9i23rUk9mz8V8iB3Ahb9IQE6udeR6csH8eHyypiN8hV\n\tPxCr1+1zxTalLeEfmSTMOhaFAIMO1T/AsY7HRPZoIG4MMqHU8G1yTNQNTrY45lCMOj\n\tUqq+e5QAWkFP/3ujXaHLDG0IANK5UQqsIC6Kwp0sibBVtmiL9ECkUXFHHjnNuvHGui\n\tq7Epy2yyOpoIVDWtsQFHevnf1uwtAtHCBlwoRAq+rLcijlLzFiFfhr55mTFEG3flu0\n\t+9kTtJM0fhesw==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1660051700;\n\tbh=jEwMI+L3K/EsI4evTDMrkQe/1ZxX4rN8cY7QrB3Hhc0=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=wafrA7LVaHaXBFQSky6EV2pLB5gUqa0/sst89AAnpPn6BjAZoIlVkNt6QaD4+DtB/\n\tpfNgi4OSzS9w15oBjzZS9UTAjZAekQAydaumhKJfYcqyrSOExL9JrySP8bzjJCW/AG\n\tDlQZC3HSKEWYq+XPlaKoeGjJxDPLb6fAJr8PK0F4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"wafrA7LV\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<YvJadtx3xig7bFTk@pendragon.ideasonboard.com>","References":"<20220809121044.2039635-1-kieran.bingham@ideasonboard.com>\n\t<YvJadtx3xig7bFTk@pendragon.ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Tue, 09 Aug 2022 14:28:18 +0100","Message-ID":"<166005169836.2190824.11024624303614989180@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [SimpleCam PATCH] cmake: Provide a sample\n\tCMakeLists.txt","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]