Last active
October 7, 2016 16:19
-
-
Save lionicsheriff/5971015 to your computer and use it in GitHub Desktop.
Emacs: Compile visual studio projects from within emacs (M-x compile)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun mbg/devenv-compile nil | |
"Set up compile command for Visual Studio" | |
(interactive) | |
(let ((vsvars (shell-quote-argument "C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\vsvars32.bat")) | |
(solution-file (shell-quote-argument | |
;; awesomely, locate-dominating-file returns the directory for the file | |
;; so when you use a pattern to find a file, you need to run it again in | |
;; the directory itself to get the file name. Who knew. | |
(car (directory-files | |
(locate-dominating-file default-directory | |
(lambda (dir) | |
(directory-files dir | |
nil | |
".*\\.sln$" | |
t))) | |
t | |
".*\\.sln$")))) | |
(build-config "Debug")) | |
(message (concat "sln: " solution-file " @ Config: " build-config)) | |
(setq compile-command (concat "call " vsvars " && devenv " solution-file " /Build " build-config)))) |
TODO
- add as hook for c# mode
- set up compilation-error-regexp-alist (as hook for compile-mode)
- create real repo
- create elpa package
- make it easier to switch visual studio versions (auto detect installed?)
- read sln and provide the list of build configs?
- read sln and provide a list of projects to build individually?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
M-x mbg/devenv-compile
this sets up the compile-command
M-x compile