From patchwork Tue Aug 9 12:10:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 17036 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D5E5AC3272 for ; Tue, 9 Aug 2022 12:10:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 09F3063328; Tue, 9 Aug 2022 14:10:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660047051; bh=cWExAJ15wXCEWL2VIdaExaj9cbJTDFM1aH4a/TSMfVg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PmnM3q99kn7Ll5sd5shbi7I1rMt0mHe9KWPBRTv3XpqanaSV43XU+hRgxH54fWAK9 oOgFrFvheTtsqouTqpGlVGdlj72GTzkEMoybM7OrQ7mIl36TwU18FkEX/uuD2Jysu5 72TxnonNY8XG5J5mWJHEKU0fKiO79dSuoZS/bq3i8UyWsnlYmChFh8iHJO+O9NKYvy YHWitQdqJ2QDFQghEJRUWcR+5jlKdSAyPKkAGOaKMQvScYNkph0iv6L2KECyIWoBHG XhW2fIbnLdB4uOHKt1JVw7ZQH3HHx7+Da3AbOGuGKvZdtuE6xVL8t7c023vL8233IA tY/sXoFRXWFpg== 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 D48CC600EA for ; Tue, 9 Aug 2022 14:10:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lebJgwMl"; dkim-atps=neutral Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 50D5A481; Tue, 9 Aug 2022 14:10:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1660047049; bh=cWExAJ15wXCEWL2VIdaExaj9cbJTDFM1aH4a/TSMfVg=; h=From:To:Cc:Subject:Date:From; b=lebJgwMlS2dkGbjqz/PANSYC1flk07knbSICHcYRR3esjI63Yk8cZVQO+0qvhMnwo 8lOuVxNH/XtEarTI3mKL3ocKK/ts5MDZkrLiqYm2X/FeeyoxiJ5rZhjiWZQAfsWKFX kG/6/8x2HgKe87WckDZOYZ+YYN523SHoRjoxVXZA= To: libcamera devel Date: Tue, 9 Aug 2022 13:10:44 +0100 Message-Id: <20220809121044.2039635-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [SimpleCam PATCH] cmake: Provide a sample CMakeLists.txt X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" While libcamera uses meson as its build infrastructure, applications are free to use other make systems. CMake is widely used, so add an example CMakeLists.txt to support building simple-cam and linking against libcamera using cmake. Signed-off-by: Kieran Bingham --- CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000000..fc8e734bdf59 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.6) + +project(SimpleCam + VERSION 1.0 + DESCRIPTION "A small and documented example application for libcamera" + LANGUAGES CXX) + +#set (CMAKE_EXPORT_COMPILE_COMMANDS ON) +set (CMAKE_CXX_STANDARD 17) + +find_package(PkgConfig) + +pkg_check_modules(LIBCAMERA REQUIRED IMPORTED_TARGET libcamera) +message(STATUS "libcamera library found:") +message(STATUS " version: ${LIBCAMERA_VERSION}") +message(STATUS " libraries: ${LIBCAMERA_LINK_LIBRARIES}") +message(STATUS " include path: ${LIBCAMERA_INCLUDE_DIRS}") + +# libevent is used specifically by simple-cam as it's event loop. +# Applications may use a different event handling implementation. +pkg_check_modules(LIBEVENT REQUIRED IMPORTED_TARGET libevent_pthreads) +message(STATUS "libevent_pthreads library found:") +message(STATUS " version: ${LIBEVENT_VERSION}") +message(STATUS " libraries: ${LIBEVENT_LINK_LIBRARIES}") +message(STATUS " include path: ${LIBEVENT_INCLUDE_DIRS}") + +include_directories(${CMAKE_SOURCE_DIR} ${LIBCAMERA_INCLUDE_DIRS} ${LIBEVENT_INCLUDE_DIRS}) + +add_executable(simple-cam simple-cam.cpp event_loop.cpp) + +target_link_libraries(simple-cam PkgConfig::LIBEVENT) +target_link_libraries(simple-cam PkgConfig::LIBCAMERA)