From 9849cfc12cada96759af779a105f6999d6cc04c8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 4 Oct 2014 22:59:38 +0200 Subject: build-system/cmake: Add #:build-type parameter, default to "RelWithDebInfo". * guix/build-system/cmake.scm (cmake-build): Add #:build-type. Pass it in BUILDER. * guix/build/cmake-build-system.scm (configure): Add #:build-type parameter and honor it. * doc/guix.texi (Build Systems): Document #:configure-flags and #:build-type for CMake. --- doc/guix.texi | 7 +++++++ guix/build-system/cmake.scm | 2 ++ guix/build/cmake-build-system.scm | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5e8f8e6eb5..c75ca0c2c8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1621,6 +1621,13 @@ implements the build procedure for packages using the It automatically adds the @code{cmake} package to the set of inputs. Which package is used can be specified with the @code{#:cmake} parameter. + +The @code{#:configure-flags} parameter is taken as a list of flags +passed to the @command{cmake} command. The @code{#:build-type} +parameter specifies in abstract terms the flags passed to the compiler; +it defaults to @code{"RelWithDebInfo"} (short for ``release mode with +debugging information''), which roughly means that code is compiled with +@code{-O2 -g}, as is the case for Autoconf-based packages by default. @end defvr @defvr {Scheme Variable} python-build-system diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm index 0fc7b62c1b..5673ad5aeb 100644 --- a/guix/build-system/cmake.scm +++ b/guix/build-system/cmake.scm @@ -49,6 +49,7 @@ (make-flags ''()) (cmake (default-cmake)) (out-of-source? #t) + (build-type "RelWithDebInfo") (tests? #t) (test-target "test") (parallel-build? #t) (parallel-tests? #f) @@ -83,6 +84,7 @@ provides a 'CMakeLists.txt' file as its build system." #:configure-flags ,configure-flags #:make-flags ,make-flags #:out-of-source? ,out-of-source? + #:build-type ,build-type #:tests? ,tests? #:test-target ,test-target #:parallel-build? ,parallel-build? diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm index 7d60ab7aa9..74b4f01425 100644 --- a/guix/build/cmake-build-system.scm +++ b/guix/build/cmake-build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013 Ludovic Courtès +;;; Copyright © 2013, 2014 Ludovic Courtès ;;; Copyright © 2013 Cyril Roelandt ;;; Copyright © 2014 Andreas Enge ;;; @@ -32,6 +32,7 @@ ;; Code: (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t) + build-type #:allow-other-keys) "Configure the given package." (let* ((out (assoc-ref outputs "out")) @@ -47,6 +48,10 @@ (format #t "build directory: ~s~%" (getcwd)) (let ((args `(,srcdir + ,@(if build-type + (list (string-append "-DCMAKE_BUILD_TYPE=" + build-type)) + '()) ,(string-append "-DCMAKE_INSTALL_PREFIX=" out) ;; add input libraries to rpath "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" -- cgit v1.2.3