User libraries are added to PATH for windows system.

Also, if the buffer is not saved then user is notified about that instead of compiling the version on disk.
This commit is contained in:
2013-06-22 23:00:42 +04:00
parent 96acfe3416
commit 0c99ee6dfd

View File

@@ -22,7 +22,7 @@ function! s:CompileMSVC() "{{{2
let exename=expand("%:p:r:s,$,.exe,")
let srcname=expand("%")
" compile it
let ccline="cl ".$CXXFLAGS." ".g:cppflags." ".g:wcppflags." ".srcname." /Fe".exename." /link ".$LDFLAGS
let ccline="cl ".g:cppflags." ".g:wcppflags." ".srcname." /Fe".exename." /link ".g:ldflags
echo ccline
let cout = system( ccline )
if v:shell_error
@@ -31,9 +31,10 @@ function! s:CompileMSVC() "{{{2
endif
echo cout
" run it
let cmd = exename . " " . g:argv
echo cmd
let eout = system( cmd )
let cmdline="\"set PATH=".g:ldlibpath.$PATH." && ".exename." ".g:argv."\""
echo exename." ".g:argv
"echo cmdline
let eout = system( cmdline )
echo eout
endfunction
@@ -72,7 +73,7 @@ function! s:CompileGCC() "{{{2
let exename=expand("%:p:r:s,$,.exe,")
let srcname=expand("%")
" compile it
let ccline="g++ ".g:cppflags." ".g:lcppflags." ".srcname." -o".exename
let ccline="g++ ".g:cppflags." ".g:lcppflags." ".g:ldflags." ".srcname." -o".exename
call s:appendOutput(ccline)
let cout = system( ccline )
if v:shell_error
@@ -152,12 +153,17 @@ function! s:initDefaults()
let g:cppflags=""
let g:wcppflags="/O2 /EHsc /DWIN32"
let g:lcppflags="-O2"
let g:ldflags=""
let g:ldlibpath=""
endfunction
"
" Load compile instructions and call window or linux compiler. {{{1
"
function! CF5Compile()
if &modified == 1
echo "The buffer is not saved. First save it."
return
endif
"
" First init global variables to let cf5-opt override it.
"