From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id mJd7HbfrF2ftPgEAe85BDQ:P1 (envelope-from ) for ; Tue, 22 Oct 2024 18:15:19 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id mJd7HbfrF2ftPgEAe85BDQ (envelope-from ) for ; Tue, 22 Oct 2024 20:15:19 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="oA/2Lx0t"; dkim=fail ("headers rsa verify failed") header.d=greghogan-com.20230601.gappssmtp.com header.s=20230601 header.b=PpQkbBLP; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1729620919; a=rsa-sha256; cv=none; b=lww/HoNT3tW+mOBrP8USGCL2qtG6jbkyeAqe4iOiCOfZcyr7+hcJPJ3mXQKXlQFxDYE3aC D6Owc3X3yd1LIRK2r4MNs/Bf1nHAWhEpxAgbHvCyLmsZdBZxvUvs+Vx088pDbSZxLDhtv8 CkgXke1pqcqb5APVUPqAPVFFRizWHszZOrl4xzvGZfVPFB/zsFQPB980flugOOGRdOqtuX OlX2Lt75hrXMks2mvVT4vb00TaGI/3P4ibVg1Ot9JiSIMBDxP03Y2Pif5MOZ4WkxEmAWO7 g6stz0GQnfwg1iuqgfEFEUDhbARxSN0qv+8j5ClcapqlLKgAhyJw1L/vzMzYdQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="oA/2Lx0t"; dkim=fail ("headers rsa verify failed") header.d=greghogan-com.20230601.gappssmtp.com header.s=20230601 header.b=PpQkbBLP; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1729620919; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+B304sbgo/+zaBskPXqwm7an+z0PsaORtK9AofR3yI8=; b=l9A3cHsjSsp/3cS7FAHjOxxz66vsge50Oa34Ru8/9NA3UDUJBi72yd5LskudGijws/Bgaj A6HEulsBI5Y+kZl+e1EFwVmLW7hmtGPRppuW7JhwCjc05Bar2bmoKMrYk+WLy+RUK3DcHi 1VTnw6wZWc3j5n9sdfIfij3MWcpuTY6/MZA83iTinyuPJRK75kCLIePiaN1PAS3CTSHlcP 1k0zauMT5VQn3gnykzbBhxquduwfBCwvut3IRrJcs9eXVdm4rZLTlk7HljQCEHwmZInRGL 7lJWdkwTbq/RkKs04bn22O9S7LaO/vrZEKJhwau8r1Wzj6sCIi9CuzqgPOsCnA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 47A23796A7 for ; Tue, 22 Oct 2024 20:15:19 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t3JNH-0006j0-PN; Tue, 22 Oct 2024 14:12:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t3JN0-0006X4-Au for guix-patches@gnu.org; Tue, 22 Oct 2024 14:12:38 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t3JN0-0007ye-2K for guix-patches@gnu.org; Tue, 22 Oct 2024 14:12:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=+B304sbgo/+zaBskPXqwm7an+z0PsaORtK9AofR3yI8=; b=oA/2Lx0tSvwoeXtidQw7WBc4UkWKQFy9yItMZAORrTdfajT02XSHfNTURWh4OwFRPotSnokl50CC2NmVZS7JbyWNFtNjqvOVHH7ElMdSN7P3UYqeHqFj8OAtsOpzjVHtylyiR9gRm94EPpw6r+Ns0Deo0Xfg3+ZywbD8qjXljNWZ3xVvAU2ocs3LScGEvUkArpPHJhBDUXD5XltbsggiVLwcSw2PU/SLzl/RcBGv7X+S3aBReT/iNJI6vjRsaQUL0BVGGAd3dG2wMfk+lUzGKzsSAZb/YNm1P+8+F8z5kstiYzJ51vIlWFxtw6FPRfHOOQhDFH4pKFblUesZJHCzog==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t3JNR-0008K5-OA for guix-patches@gnu.org; Tue, 22 Oct 2024 14:13:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70031] [PATCH v2 10/65] build-system/cmake: Optionally build tests. Resent-From: Greg Hogan Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 22 Oct 2024 18:13:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70031 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70031@debbugs.gnu.org Cc: Greg Hogan Received: via spool by 70031-submit@debbugs.gnu.org id=B70031.172962073931536 (code B ref 70031); Tue, 22 Oct 2024 18:13:05 +0000 Received: (at 70031) by debbugs.gnu.org; 22 Oct 2024 18:12:19 +0000 Received: from localhost ([127.0.0.1]:57258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3JMg-0008CP-MA for submit@debbugs.gnu.org; Tue, 22 Oct 2024 14:12:19 -0400 Received: from mail-qk1-f182.google.com ([209.85.222.182]:59801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t3JMQ-00086Y-O0 for 70031@debbugs.gnu.org; Tue, 22 Oct 2024 14:12:04 -0400 Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-7b153047b29so351951185a.3 for <70031@debbugs.gnu.org>; Tue, 22 Oct 2024 11:11:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greghogan-com.20230601.gappssmtp.com; s=20230601; t=1729620629; x=1730225429; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+B304sbgo/+zaBskPXqwm7an+z0PsaORtK9AofR3yI8=; b=PpQkbBLPiwqKnPdPlAa9Y9yHYQXsqstQjbLxXoHP2MerUtXBCEQ+2lkTQSKxUWDz75 eblrsY1J9uEGvZMFWG1KN+OJCcrlvBvjWUuJt41K9XwVob0IAK45GJVMU3oEmTbnXDIf qFij4uaFmBgl4CUk6mSD+jr+mrDz8vrtWazdurlkCW9FGEVMmGjWTM5isg3CL5cA4OCj UxGyo/1SuR9XugdYUrgPGzZprfdAOUkVD4SY6xOD1GjLnoS/GPMA8pTTOR/DiepTYKnU ISRrZRNjrpc6p9fYBFilLdLLDkqba6OOeRB/K/vGDR9ih1Ff7y5+XjLR4Zke1XNJeLBI uJ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729620629; x=1730225429; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+B304sbgo/+zaBskPXqwm7an+z0PsaORtK9AofR3yI8=; b=JzeFS6q/hhVJFvMy7UaJpP6S9Y0+O7Ogn18Plb/TNnh1UXjmqnKaACGFnbYTVQt2W5 C7oZqk0HVViGRuXz4wOjz7Xh5kR+fWELTmwezezUK9Us+rcMz40e5Y/HEtaw6amgfFyH dUN7PZilJpumJM8lcmsuez98xk6pT+kuX5pNCQZyFIMKmtAf3GvgyKamR3h2LW8LgN8x c8WJgfuREjCELR65SKN5Rs/aTcPz9bnO5vFJ9UYZOvCiak++GDmTOAYTk+o0EsIA9xaD bQs93CkSoj44iSCRr/36A41EYhY/VDy86jvtsOXg1bDbWKaTsyPH0cemttTvfVyqOTEg FCbA== X-Gm-Message-State: AOJu0Yz/3MyBNSKxpvFrRE8NtYkvF7cyIxqF9u6k2MvkvDTFZl4j1/X9 4vYxpbU80k4NsHDifWrt+1BwI5za4Hzi/SF2NOKZcr98DIO1Fw7NO4BB1wUBaHk2ZGN6JI7y11T + X-Google-Smtp-Source: AGHT+IG6TYaWH1+3qLueQEH0ZuEc6AfBiZg5H9kTTjSncBbEj0RpOZSBGSluBMhcyKgNYWwtf/CxPw== X-Received: by 2002:a05:620a:4620:b0:7ac:b89f:5308 with SMTP id af79cd13be357-7b157b40dc6mr2119965585a.7.1729620628673; Tue, 22 Oct 2024 11:10:28 -0700 (PDT) Received: from ip-10-114-89-186.evoforge.org (ec2-52-70-167-183.compute-1.amazonaws.com. [52.70.167.183]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b1659bb836sm302360785a.10.2024.10.22.11.10.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 11:10:28 -0700 (PDT) From: Greg Hogan Date: Tue, 22 Oct 2024 18:09:00 +0000 Message-ID: <1c3f2eb08c2b228381a059cfe1f359841a8bcbe9.1729619913.git.code@greghogan.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.28 X-Spam-Score: -4.28 X-Migadu-Queue-Id: 47A23796A7 X-Migadu-Scanner: mx10.migadu.com X-TUID: ENoPsEvGAHtp * guix/build/cmake-build-system.scm (configure): Create and use CMake variable cache file. Set the CMake variable BUILD_TESTING to the value of TESTS? so that a package can optionally build tests. Set CMAKE_COLOR_DIAGNOSTICS to ON. Change-Id: Ia69de938a56733f717d4b4c6207b499bcee524ff --- guix/build/cmake-build-system.scm | 75 ++++++++++++++++++------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm index b90a0c14a9..0933801ecb 100644 --- a/guix/build/cmake-build-system.scm +++ b/guix/build/cmake-build-system.scm @@ -35,7 +35,7 @@ (define-module (guix build cmake-build-system) ;; Code: (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t) - build-type target generator + build-type target generator (tests? #t) #:allow-other-keys) "Configure the given package." (let* ((out (assoc-ref outputs "out")) @@ -50,37 +50,50 @@ (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t) (chdir "../build")) (format #t "build directory: ~s~%" (getcwd)) - (let ((args `(,srcdir - ,@(if generator - (list (string-append "-G" generator)) - '()) - ,@(if build-type - (list (string-append "-DCMAKE_BUILD_TYPE=" - build-type)) - '()) - ,(string-append "-DCMAKE_INSTALL_PREFIX=" out) - ;; ensure that the libraries are installed into /lib - "-DCMAKE_INSTALL_LIBDIR=lib" - ;; add input libraries to rpath - "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" - ;; add (other) libraries of the project itself to rpath - ,(string-append "-DCMAKE_INSTALL_RPATH=" out "/lib") - ;; enable verbose output from builds - "-DCMAKE_VERBOSE_MAKEFILE=ON" + (call-with-temporary-output-file + (lambda (temp port) + (let ((args `(,srcdir + ;; Load variables into the the cache to prevent + ;; warnings about unused manually-specified variables. + ,(string-append "-C " temp) + ,@(if generator + (list (string-append "-G" generator)) + '()) + ,@configure-flags))) - ;; Cross-build - ,@(if target - (list (string-append "-DCMAKE_C_COMPILER=" - target "-gcc") - (string-append "-DCMAKE_CXX_COMPILER=" - target "-g++") - (if (string-contains target "mingw") - "-DCMAKE_SYSTEM_NAME=Windows" - "-DCMAKE_SYSTEM_NAME=Linux")) - '()) - ,@configure-flags))) - (format #t "running 'cmake' with arguments ~s~%" args) - (apply invoke "cmake" args)))) + (define save-to-cache + (lambda* (name value) + ;; and arguments are used only by CMake GUIs. + (format port "set(~a \"~a\" CACHE STRING \"\")~%" name value))) + + (if build-type + (save-to-cache "CMAKE_BUILD_TYPE" build-type)) + (save-to-cache "CMAKE_INSTALL_PREFIX" out) + ;; Ensure that the libraries are installed into /lib. + (save-to-cache "CMAKE_INSTALL_LIBDIR" "lib") + ;; Add input libraries to rpath. + (save-to-cache "CMAKE_INSTALL_RPATH_USE_LINK_PATH" "TRUE") + ;; Add (other) libraries of the project itself to rpath. + (save-to-cache "CMAKE_INSTALL_RPATH" (string-append out "/lib")) + ;; Enable verbose output from builds. + (save-to-cache "CMAKE_VERBOSE_MAKEFILE" "ON") + ;; Enable colored compiler diagnostics. + (save-to-cache "CMAKE_COLOR_DIAGNOSTICS" "ON") + ;; BUILD_TESTING in an option of CMake's CTest module. + (save-to-cache "BUILD_TESTING" (if tests? "ON" "OFF")) + + ;; Cross-build + (if target + (begin + (save-to-cache "CMAKE_C_COMPILER" (string-append target "-gcc")) + (save-to-cache "CMAKE_CXX_COMPILER" (string-append target "-g++")) + (if (string-contains target "mingw") + (save-to-cache "CMAKE_SYSTEM_NAME" "Windows") + (save-to-cache "CMAKE_SYSTEM_NAME" "Linux")))) + + (close-port port) + (format #t "running 'cmake' with arguments ~s~%" args) + (apply invoke "cmake" args)))))) (define* (build #:key (parallel-build? #t) #:allow-other-keys) (apply invoke "cmake" -- 2.46.1