'compile'에 해당되는 글 1건
2008/12/24 19:06
[컴퓨팅환경]
이번에는 Emacs에서 Xcode project를 build하는 것이다.
다음의 emacs lisp 코드를 .emacs 파일안에 넣어놓으면 M-x xcode-compile이나 F10키로 바로 컴파일이 가능하다.
(defvar xcode-compile-sdks nil)
(defvar xcode-compile-sdk-history nil)
(dolist (line
(split-string
(with-temp-buffer
(call-process "xcodebuild" nil t nil "-showsdks")
(buffer-string))
"\n" t)
)
(let ((comps (split-string line "-sdk " t)))
(if (> (length comps) 1)
(add-to-list 'xcode-compile-sdks (car (last comps)))
)
)
)
(defun xcode-compile ()
(interactive)
(let ((command "xcodebuild -activeconfiguration -activetarget"))
(setq command
(concat
command
(if xcode-compile-sdks
(let ((default-sdk (or (car xcode-compile-sdk-history) (car xcode-compile-sdks))))
(concat
" -sdk "
(completing-read
(format "Compile with sdk (default %s): " default-sdk)
xcode-compile-sdks
nil
t
nil
'xcode-compile-sdk-history
default-sdk
)
)
)
)
(let ((dir ".") (files nil))
(while
(progn
(setq files (directory-files dir nil "\\.xcodeproj\\'"))
(and (not (string-equal "/" (expand-file-name dir))) (null files))
)
(setq dir (concat (file-name-as-directory dir) ".."))
)
(unless (null files) (concat " -project " (file-name-as-directory dir) (car files)))
)
)
)
(compile (read-string "Compile command: " (concat command " ")))
)
)
(define-key global-map [f10] 'xcode-compile)
이 글은 스프링노트에서 작성되었습니다.


