From patchwork Tue Aug 9 13:44:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 17038 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 C496EBE173 for ; Tue, 9 Aug 2022 13:44:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E030A6332B; Tue, 9 Aug 2022 15:44:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1660052670; bh=IhI8Y9DulcDwGTce+dEkUT4E6jYbKGdIEuDZxeLdYws=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=qcvYNOp/nbXXPXi2r8GO/idIvgeNJtrKNAAv0h9PmWRknXVNWjlzB1ExL0roUWdHL V6thfF4lf/zoKwqj5cyzy42LZHQnGQlhR3c/pwimgp00UOGxKXslzssa/gciHXskVQ jufom1KDZwhlnaeOdRBZsJOobuT/k20YQO/O2Y2LbzL8YXaMB+qmPMkuhdo0xJ9G+d 5YNYYacJvYGg0ABe8pHuLgTFnwcdu82Q1lYDzrs76kmZD3rthQHxuP52YzRCBZGa3t r/BI/KdYBk1Qo6eiYs5c13ezl9PCJyx+pJTqvXxV9G3sX7PEqBMLh6iQwRF8sf7l9C gwHQ3qjGptb8w== 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 D084061FAA for ; Tue, 9 Aug 2022 15:44:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="WxWHd6st"; 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 46711481; Tue, 9 Aug 2022 15:44:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1660052669; bh=IhI8Y9DulcDwGTce+dEkUT4E6jYbKGdIEuDZxeLdYws=; h=From:To:Cc:Subject:Date:From; b=WxWHd6stt10erk7cJWZZwH6rJLB/dOSI/Kftg8e47skGV2eu/mXUTD8L275+8Nins eIEzlhNcv/MCbDZSbm0M2muV0EOBRz6byUPhMXgGhd1jbPLQifJqDhHjARctYGIrdU S9lh2Js/tnQDi9A6IH1UieFXzeU+hD8RvrKQm+KY= To: libcamera devel Date: Tue, 9 Aug 2022 14:44:23 +0100 Message-Id: <20220809134423.2092524-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [libcamera-devel] [SimpleCam PATCH v2] 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 Reviewed-by: Laurent Pinchart --- v2: - Add compiler flags - Fix 'it's' - Remove stray leftovers - Remove version number 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..2a86b55ebeea --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.6) + +project(SimpleCam + DESCRIPTION "A small and documented example application for libcamera" + LANGUAGES CXX) + +set (CMAKE_CXX_STANDARD 17) + +set (CMAKE_CXX_FLAGS "-Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Werror -Wno-unused-parameter") + +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 its 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)