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.
This commit is contained in:
Ludovic Courtès 2014-10-04 22:59:38 +02:00
parent 3dcd78109c
commit 9849cfc12c
3 changed files with 15 additions and 1 deletions

View file

@ -1621,6 +1621,13 @@ implements the build procedure for packages using the
It automatically adds the @code{cmake} package to the set of inputs. It automatically adds the @code{cmake} package to the set of inputs.
Which package is used can be specified with the @code{#:cmake} Which package is used can be specified with the @code{#:cmake}
parameter. 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 @end defvr
@defvr {Scheme Variable} python-build-system @defvr {Scheme Variable} python-build-system

View file

@ -49,6 +49,7 @@ (define* (cmake-build store name source inputs
(make-flags ''()) (make-flags ''())
(cmake (default-cmake)) (cmake (default-cmake))
(out-of-source? #t) (out-of-source? #t)
(build-type "RelWithDebInfo")
(tests? #t) (tests? #t)
(test-target "test") (test-target "test")
(parallel-build? #t) (parallel-tests? #f) (parallel-build? #t) (parallel-tests? #f)
@ -83,6 +84,7 @@ (define builder
#:configure-flags ,configure-flags #:configure-flags ,configure-flags
#:make-flags ,make-flags #:make-flags ,make-flags
#:out-of-source? ,out-of-source? #:out-of-source? ,out-of-source?
#:build-type ,build-type
#:tests? ,tests? #:tests? ,tests?
#:test-target ,test-target #:test-target ,test-target
#:parallel-build? ,parallel-build? #:parallel-build? ,parallel-build?

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com> ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
;;; ;;;
@ -32,6 +32,7 @@ (define-module (guix build cmake-build-system)
;; Code: ;; Code:
(define* (configure #:key outputs (configure-flags '()) (out-of-source? #t) (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
build-type
#:allow-other-keys) #:allow-other-keys)
"Configure the given package." "Configure the given package."
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
@ -47,6 +48,10 @@ (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
(format #t "build directory: ~s~%" (getcwd)) (format #t "build directory: ~s~%" (getcwd))
(let ((args `(,srcdir (let ((args `(,srcdir
,@(if build-type
(list (string-append "-DCMAKE_BUILD_TYPE="
build-type))
'())
,(string-append "-DCMAKE_INSTALL_PREFIX=" out) ,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
;; add input libraries to rpath ;; add input libraries to rpath
"-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE"