From patchwork Wed Dec 20 12:36:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3532 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:d588:b0:100:28a5:529c with SMTP id ev8csp1512757dyc; Wed, 20 Dec 2023 04:37:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPP00SlXZNGimR4Id2GIktq3MNEfLoynCWoB5o2C7jpfEwBWr1eyjoZIsgfl1iI1X2niEp X-Received: by 2002:a05:6a20:7d8e:b0:187:df59:5c43 with SMTP id v14-20020a056a207d8e00b00187df595c43mr42296064pzj.2.1703075867829; Wed, 20 Dec 2023 04:37:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703075867; cv=none; d=google.com; s=arc-20160816; b=j2eQsSnc9Mx7B5+n0bUbU0DBzhbf7PTUizjOY3QCAhQ4QGrOBzJuHGUiTBM+DRn/k8 jMmzvt7qXOM+vf+FZV9de7o5xD+QsPtvPGjdNzjiF8OJgBFk9JPbkslvEwQlPD4sv+iH ZCK4rCH6lhtYWVkxFFD1ib19GVcyQavam86m4ioYGEzfONN6npXs5TPNa7baRpXFo8SU k2J7hITt4aKhLpWfaHabxD6lJdgSCHnqmodYMA6oa7IQw/kI6mHQbXgi2MQsSFppyEgb anNE4s6k5j0a26xIula/yvYujIJgbtTlKrFUZJf0d0h7z0Vtc51EArc6k9ypgc1G38y/ p+5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=B/v+/d5gKpqYGEUOFFsRZhJwKLx4RYlEw5mjE7lzz4o=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Fb7pdNdL56WRkSDoybFli4V0T4GzaIculharIddV5anDn4PMdsla0Pi3221R6iw1Fs WTLEv7FcizzRIjiAmiKiLJ5AJtQmoyG0kTXvkNvTNXlt9o+keWLpLRsxubwwqZgqA9fP UXjUffnqIoYphq9zq1TlyBSSq08c3jrf62tW5gmi+46NhalJDkQV4x9ED7bB062bKw0J jr3JA4puakdXkbjtlkPeorDkV5+/9efskhr5pYZSQ2mJMV5gizXZ6nUESrWL4cqvnIMB YpxKgZxbgtUCCapGs77l0Rm4LKaRCCxkSpP0xn44OFzcicfAee+tGEAQhHYhODIo9LTI FzjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="P1/yOR3z"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=B9iEvs4j; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=cRASfsPu; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id q4-20020a63e944000000b005c659dc546csi21393578pgj.24.2023.12.20.04.37.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2023 04:37:47 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="P1/yOR3z"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=B9iEvs4j; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=cRASfsPu; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1rFvp7-0005uD-G4; Wed, 20 Dec 2023 12:37:17 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rFvp3-0005u6-Tw for openvpn-devel@lists.sourceforge.net; Wed, 20 Dec 2023 12:37:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kZxihm/oUxicMmAG4xlaDfyFiagRntlgLIF1ZDEozvE=; b=P1/yOR3zvyGlKgUU/qgZg+heRN 0rq0bhm1O0j+ZbJrmx7xgjflPPtgvKAT7isNylU1uoQ/m1acsXsgltV2BKfga8IX2Xy9I+tpAPThF SwPm/mQDKA0cjp8RE2JJIw8VJvxQ5LyX6uOWqz/CwytDEZ78k8KruVhqzbWwkrISLdYE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=kZxihm/oUxicMmAG4xlaDfyFiagRntlgLIF1ZDEozvE=; b=B9iEvs4jElfKlcDnkr5tFQR6W3 jldErDath8OoK7yMdpwNuq5e5EjdBDtBqUOTYPzqoUd1uC2EOtX29Fg6LYmY4uJ7fvxk6IKbH2Gyw THNSqnr34v4bGe6pVtqV1FBxcZiL/Uo88hkWeNZyeYym8G48VK9P4om6EWR54pHpFdsQ=; Received: from mout-p-103.mailbox.org ([80.241.56.161]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1rFvoz-0004sB-8S for openvpn-devel@lists.sourceforge.net; Wed, 20 Dec 2023 12:37:13 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4SwCk46QJtz9sTx; Wed, 20 Dec 2023 13:37:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1703075820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kZxihm/oUxicMmAG4xlaDfyFiagRntlgLIF1ZDEozvE=; b=cRASfsPuR+wlUvuxqVbvoS0p9FlwPb1+1Ww+v/VNLIUQUt/RrjJPryTDgycbsnmnmaqtnN f/3pBTrQd4M4pHsNJzelxg6ScHP0h1uFQwBiM4aEjfZf5eAR7d5wcfpHgXLaPEu/rdXvgA XjKB7jVKOZICZP+zazcbOX8e/mw4/eK17HDEVpur0BUSrLjkCx/671t1/y1H+hQhwY4lFD /bAwGw4STXYSgHkWLvPGyBmwsIUSIc0RwKARQ0KBQ4UDsI9qHs1wB0ORStl5cdUj4mFJjg QNv6eDry1zbPC/nsLb7GeURL4xVMb68E0aJ4Hoqq5i7qVanNwbjLujOjZ+cbiQ== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Wed, 20 Dec 2023 13:36:59 +0100 Message-Id: <20231220123659.55542-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4SwCk46QJtz9sTx X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Heiko Hund CMake has support to create a json file which contains exact information how each file in the project is compiled. This file can be consumed by clangd, which in turn provides precise symbol informatio [...] Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.161 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1rFvoz-0004sB-8S Subject: [Openvpn-devel] [PATCH v4] cmake: create and link compile_commands.json file X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1785804481038312042?= X-GMAIL-MSGID: =?utf-8?q?1785804481038312042?= From: Heiko Hund CMake has support to create a json file which contains exact information how each file in the project is compiled. This file can be consumed by clangd, which in turn provides precise symbol information to IDEs for better code navigation and contextual information. I use it with vscode to be able to quickly switch between native Linux and mingw builds and have the symbols info change dynamically with it. So handy that I think it is useful for others as well. Bump required CMake version for CREATE_LINK. Change-Id: Ib14c1161b4b0c9df797b9932ad14739e202cea64 Signed-off-by: Heiko Hund Acked-by: Frank Lichtenheld --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/483 This mail reflects revision 4 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/.gitignore b/.gitignore index a1da366..4153a3e 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ m4/ltversion.m4 m4/lt~obsolete.m4 +compile_commands.json doc/openvpn-examples.5 doc/openvpn-examples.5.html doc/openvpn.8 diff --git a/CMakeLists.txt b/CMakeLists.txt index d40b213..bc46c27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.14) set(CMAKE_CONFIGURATION_TYPES "Release;Debug;ASAN") project(openvpn) @@ -42,6 +42,11 @@ set(PLUGIN_DIR /usr/local/lib/openvpn/plugins CACHE FILEPATH "Location of the plugin directory") +# Create machine readable compile commands +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) +file(CREATE_LINK ${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json + ${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json SYMBOLIC) + # AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN set(CMAKE_C_FLAGS_ASAN "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1"