From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4B158A055D; Fri, 19 Feb 2021 12:59:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B482D1608FA; Fri, 19 Feb 2021 12:59:47 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 3B94D40395 for ; Fri, 19 Feb 2021 12:59:46 +0100 (CET) IronPort-SDR: 8nB5sxlnUWNGt9dNYOVwNJ2HNY0jAZu5tHWypzabEvC/IuolJLbQ7wMnsnSy+xiQ6+9SEjoLMX kSOUly4GPIDA== X-IronPort-AV: E=McAfee;i="6000,8403,9899"; a="163601130" X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="163601130" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 03:59:45 -0800 IronPort-SDR: nG9VVkNTM8cIBZqX9jIY5DcuKfHqVls1NsLbvN0dGyWkY/KCJn7ofjsyIXloNUsXWRcJzUE42M LtyjfKDHuFfA== X-IronPort-AV: E=Sophos;i="5.81,189,1610438400"; d="scan'208";a="401003192" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.213.215.223]) ([10.213.215.223]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2021 03:59:44 -0800 To: hamidreza Kheirabadi , dev@dpdk.org References: From: "Burakov, Anatoly" Message-ID: <53fbb26f-8daa-50b2-6733-d0fb3b3f1c11@intel.com> Date: Fri, 19 Feb 2021 11:59:41 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] cmake/Makefile sample application X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 18-Feb-21 6:56 PM, hamidreza Kheirabadi wrote: > Hi, > I'd like to change my dpdk-based application from a pure C to C++ version. > Can anybody help me with a sample cmake or Makefile? > Is there any performance degradation when compiling apps with g++ instead > of gcc? > Regards > Hi, We have documented examples for building external applications with Make and Meson [1], but not CMake. Still, i imagine it would be pretty straightforward because CMake will use pkg-config under the hood when resolving dependencies. If DPDK is installed onto your local system (using `ninja install` command), things should Just Work (tm). If you only have a local compiled version of DPDK, you may still compile/link against it using `/meson-uninstalled` directory which will have a pkg-config file that will allow you to get all necessary paths/includes. (you may need to set PKG_CONFIG_DIR environment variable, or its CMake equivalent, for pkg-config to find DPDK) The DPDK examples have Makefiles that is self-contained and should be a good basis for building any external application as well. As for the question of C++, I've written C++ DPDK applications before, and i haven't noticed any performance degradation. Obviously the kind of features you plan on using (e.g. exceptions, dynamic dispatch, etc.) will determine the performance impact you may or may not get, but seeing how C++ model is "not paying for abstractions you don't use", I imagine that a carefully designed C++ application will perform just as well as a C application, with roughly half the code :D [1] http://doc.dpdk.org/guides/linux_gsg/build_dpdk.html#building-applications-using-installed-dpdk -- Thanks, Anatoly