Skip to content

Commit

Permalink
added commands to run xcodebuild and list the available sdks
Browse files Browse the repository at this point in the history
  • Loading branch information
senny committed Oct 11, 2009
1 parent d2e2318 commit b453ef9
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions emacs-xcode.el
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
(defvar *xcode-project-root* nil)

(defun xcode--project-root ()
(message (or *xcode-project-root*
(setq *xcode-project-root* (xcode--project-lookup)))))
(or *xcode-project-root*
(setq *xcode-project-root* (xcode--project-lookup))))

(defun xcode--project-lookup (&optional current-directory)
(when (null current-directory) (setq current-directory default-directory))
Expand All @@ -45,6 +45,28 @@
(if (> (length file) 10)
(when (string-equal (substring file -10) ".xcodeproj") (setq project-file file))))))

(defun xcode--project-command (options)
(concat "cd " (xcode--project-root) "; " options))

(defun xcode/build-compile ()
(interactive)
(compile (xcode--project-command (xcode--build-command))))

(defun xcode/build-list-sdks ()
(interactive)
(message (shell-command-to-string (xcode--project-command "xcodebuild -showsdks"))))

(defun xcode--build-command (&optional target configuration sdk)
(let ((build-command "xcodebuild"))
(if (not target)
(setq build-command (concat build-command " -activetarget"))
(setq build-command (concat build-command " -target " target)))
(if (not configuration)
(setq build-command (concat build-command " -activeconfiguration"))
(setq build-command (concat build-command " -configuration " configuration)))
(when sdk (setq build-command (concat build-command " -sdk " sdk)))
build-command))

(defun bh-compile ()
(interactive)
(let ((df (directory-files "."))
Expand Down

0 comments on commit b453ef9

Please sign in to comment.