me
/
guix
Archived
1
0
Fork 0

build-system/cmake: Build out of source tree by default.

* guix/build-system/cmake.scm (cmake-build): Change 'out-of-source?' to
  default to #t.
* guix/build/cmake-build-system.scm (configure): Add 'out-of-source?'
  keyword parameter and honor it.
master
Ludovic Courtès 2013-11-27 23:50:37 +01:00
parent b4f0bb1771
commit 977f03ffd3
2 changed files with 21 additions and 11 deletions

View File

@ -48,7 +48,7 @@
(search-paths '()) (search-paths '())
(make-flags ''()) (make-flags ''())
(cmake (default-cmake)) (cmake (default-cmake))
(out-of-source? #f) (out-of-source? #t)
(tests? #t) (tests? #t)
(test-target "test") (test-target "test")
(parallel-build? #t) (parallel-tests? #f) (parallel-build? #t) (parallel-tests? #f)

View File

@ -31,18 +31,28 @@
;; ;;
;; Code: ;; Code:
(define* (configure #:key outputs (configure-flags '()) (define* (configure #:key outputs (configure-flags '()) (out-of-source? #t)
#: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"))
(if (file-exists? "CMakeLists.txt") (abs-srcdir (getcwd))
(let ((args `(,(string-append "-DCMAKE_INSTALL_PREFIX=" out) (srcdir (if out-of-source?
,@configure-flags))) (string-append "../" (basename abs-srcdir))
(setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH")) ".")))
(setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH")) (format #t "source directory: ~s (relative from build: ~s)~%"
(format #t "running 'cmake' with arguments ~s~%" args) abs-srcdir srcdir)
(zero? (apply system* "cmake" args))) (when out-of-source?
(error "no CMakeLists.txt found")))) (mkdir "../build")
(chdir "../build"))
(format #t "build directory: ~s~%" (getcwd))
(let ((args `(,srcdir
,(string-append "-DCMAKE_INSTALL_PREFIX=" out)
,@configure-flags)))
(setenv "CMAKE_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
(setenv "CMAKE_INCLUDE_PATH" (getenv "CPATH"))
(format #t "running 'cmake' with arguments ~s~%" args)
(zero? (apply system* "cmake" args)))))
(define* (check #:key (tests? #t) (parallel-tests? #t) (test-target "test") (define* (check #:key (tests? #t) (parallel-tests? #t) (test-target "test")
#:allow-other-keys) #:allow-other-keys)