msvc-mode.el

msvc-mode.el v0.1 [téléchargé 245 fois]

Voici un fichier lisp contenant le minimum vital pour pouvoir utiliser emacs avec Visual Studio.

.emacs

(defun add-to-env (var val)
  (setenv var (concat (getenv var) ";" val )))
;;les 5 premieres variables sont a modifier
;; VS install PATH see vsvcvar.bat
(setenv "VSINSTALLDIR" "H:\\Program Files\\Microsoft Visual Studio .NET\\Common7\\IDE")
(setenv "VCINSTALLDIR" "H:\\Program Files\\Microsoft Visual Studio .NET")
(setenv "FrameworkDir" "H:\\WINNT\\Microsoft.NET\\Framework")
(setenv "FrameworkSDKDir" "H:\\Program Files\\Microsoft Visual Studio .NET\\FrameworkSDK")
;; .Net version
(setenv "FrameworkVersion" "v1.0.3705")


(setenv "DevEnvDir" (getenv "VSINSTALLDIR"))
(setenv "MSVCDir" (concat (getenv "VCINSTALLDIR") "\\VC7"))

;; export PATH
(add-to-env "PATH" (getenv "DevEnvDir" ))
(add-to-env "PATH" (concat (getenv "MSVCDir" ) "\\BIN"))
(add-to-env "PATH" (concat (getenv "VCINSTALLDIR" ) "\\Common7\\Tools"))
(add-to-env "PATH" (concat (getenv "VCINSTALLDIR" ) "\\Common7\\Tools\\bin"))
(add-to-env "PATH" (concat (getenv "VCINSTALLDIR" ) "\\Common7\\Tools\\bin\\prerelease"))
(add-to-env "PATH" (concat (getenv "FrameworkSDKDir" ) "\\bin"))
(add-to-env "PATH" (concat (getenv "FrameworkKDir" ) "\\" (getenv "FrameworkVersion")))

;; export INCLUDE PATH
(add-to-env "INCLUDE" (concat (getenv "MSVCDir" ) "\\ATLMFC\\INCLUDE"))
(add-to-env "INCLUDE" (concat (getenv "MSVCDir" ) "\\INCLUDE"))
(add-to-env "INCLUDE" (concat (getenv "MSVCDir" ) "\\PlatformSDK\\include"))
(add-to-env "INCLUDE" (concat (getenv "MSVCDir" ) "\\PlatformSDK\\include\\prerelease"))
(add-to-env "INCLUDE" (concat (getenv "FrameworkSDK" ) "\\INCLUDE"))

;; export LIB PATH
(add-to-env "LIB" (concat (getenv "MSVCDir" ) "\\ATLMFC\\LIB"))
(add-to-env "LIB" (concat (getenv "MSVCDir" ) "\\LIB"))
(add-to-env "LIB" (concat (getenv "MSVCDir" ) "\\PlatformSDK\\lib"))
(add-to-env "LIB" (concat (getenv "MSVCDir" ) "\\PlatformSDK\\lib\\prerelease"))
(add-to-env "LIB" (concat (getenv "FrameworkSDK" ) "\\lib"))
(require 'msvc-mode)

fonctions disponibles

  • msvc-sln-build
    specifie la solution a compiler. Les solutions sont parametrables par un
    customize-option RET msvc-sln-working-sln RET
  • msvc-sln-project-build
    permet de specifier la solution et le projet a compiler
  • msvc-compile-current
    compile le cpp ouvert avec les options de compilation globale. les .obj sont mis dans le repertoire .build
  • msvc-link-current
    link tous les .obj dans le repertoire .build et y mais le fichier a.exe
  • msvc-target-debug
    passe en mode debug
  • msvc-target-release
    passe en mode release

options

msvc-cc-code-generation-basic-runtime-check
msvc-cc-code-generation-buffer-security-check
msvc-cc-code-generation-enable-c++-exceptions
msvc-cc-code-generation-enable-function-level-linking
msvc-cc-code-generation-enable-minimal-rebuild
msvc-cc-code-generation-runtime-library
msvc-cc-code-generation-smaller-type-check
msvc-cc-code-generation-string-pooling
msvc-cc-general-64bit-portability	 
msvc-cc-general-debug-information-format
msvc-cc-general-include						 
msvc-cc-general-startup-banner
msvc-cc-general-warning-as-error	
msvc-cc-general-warning-level
msvc-cc-generation								 
msvc-cc-language-enable-run-time-type-info
msvc-cc-optimisation-enable-intrinsic-functions
msvc-cc-optimization-global-optimization
msvc-cc-optimization-inline-function-expension
msvc-cc-optimization-optimization	
msvc-cc-preprocessor-macro
msvc-cc-release									
msvc-cc-system
msvc-link-additional-lib				
msvc-link-additional-lib-path
msvc-link-default-lib						
msvc-sln-working-sln
la plus importante est msvc-sln-working-sln. on y specifie toutes les solution compilable sous emacs.
ex :
Msvc Sln Working Sln: Hide
INS DEL List:
            additional solution path: d:/users/martin/cvs/v2src/
            additional solution name: OpenglDemo
            Repeat:
            INS DEL additional project: Engine
            INS DEL additional project: BumpPlugin
            INS DEL additional project: IKPlugin
            INS 
ensuite on pourra compiler la solution en utilisant :
msvc-sln-build OpenGLDemo
ou uniquement un projet avec : msvc-sln-project-build OpenGLDemo RET Engine RET
note : la completion fonctionne.