improve toptica::c-make

This commit is contained in:
Stefan Liebl 2023-07-10 10:19:11 +02:00
parent c3d483312c
commit fe1588978c
2 changed files with 18 additions and 11 deletions

View File

@ -186,6 +186,7 @@ function s:ProjectSet(project_type, project_base_dir)
let g:SshOpts = ""
let g:SshOpts2 = ""
execute 'set path+=' . g:GccRoot . s:oselas_include
let $PATH = $PATH.':'.g:GccRoot.'/bin'
" let g:ycm_clangd_args = ['-I'.g:GccRoot . s:oselas_include]
elseif (g:project_type == 'topmode-gui')
let s:Program = '/TOPAS_Topmode'
@ -281,10 +282,15 @@ function s:ProjectSet(project_type, project_base_dir)
command! -nargs=? MakeCheck call s:MakeCheck('<args>', 0)
" cmake
command! -nargs=1 -complete=custom,CmakeBuildTypes Cmake call s:Cmake('<args>', 0)
command! -nargs=* -complete=custom,CmakeBuildTypes Cmake call s:Cmake('<args>', 0)
function! CmakeBuildTypes(ArgLead, CmdLine, CorsorPos)
return join(['Debug', 'RelWithDebInfo'], "\n")
" return join(['Debug', 'RelWithDebInfo', '-DHARDWARE_DLCSMART=ON'], "\n")
return join([
\'-DCMAKE_BUILD_TYPE=Debug',
\'-DCMAKE_BUILD_TYPE=RelWithDebInfo',
\'-DHARDWARE_DLCSMART=ON',
\'-DMOCK_ALL_CAN_DEVICES=ON',
\'-DUNIT_TESTING',
\], "\n")
endfunction
" configure quickfix window for asyncrun
@ -344,7 +350,7 @@ endfunction
function s:MakeTestBuild()
let &makeprg = s:makeprg
call s:BuildDirStash('save')
call s:Cmake('Release', 1)
call s:Cmake('-DCMAKE_BUILD_TYPE=Release', 1)
call s:Make('-j4 device-control artifacts doxygen user-interface', 1)
call s:BuildDirStash('release-test')
call s:BuildDirUnStash('save')
@ -364,12 +370,11 @@ function s:MakeCheck(filename, async_mode)
execute 'AsyncRun -mode='.a:async_mode.' -save=2 -program=make -cwd='.g:ProjectBuildDir. ' @ '.args
endfunction
function s:Cmake(build_type, async_mode)
function s:Cmake(options, async_mode)
if !isdirectory(g:ProjectBuildDir)
call mkdir(g:ProjectBuildDir)
endif
execute "!rm ".g:ProjectBuildDir."/build-type*"
execute "!touch ".g:ProjectBuildDir."/build-type:".a:build_type
execute "!rm -f ".g:ProjectBuildDir."/cmake-cmd*"
call asyncrun#quickfix_toggle(10, 1)
let args = ""
let args .= " ../".g:ProjectSrcDirRel."/"
@ -377,7 +382,7 @@ function s:Cmake(build_type, async_mode)
let args .= "/targets/simulator"
endif
let args .= " --graphviz=dependencies.dot"
let args .= " -DCMAKE_BUILD_TYPE=".a:build_type
let args .= " ".a:options
let args .= " -DCMAKE_EXPORT_COMPILE_COMMANDS=1"
if (g:project_type == 'dlcpro')
let args .= " -DCMAKE_TOOLCHAIN_FILE=../".g:ProjectSrcDirRel."/Toolchain-target.cmake"
@ -399,6 +404,7 @@ function s:Cmake(build_type, async_mode)
elseif (g:project_type == 'decof')
let args .= " -DCMAKE_TOOLCHAIN_FILE=../".g:ProjectSrcDirRel."/ci/Toolchain-dlcpro-target.cmake"
endif
execute '!echo "cmake '.args.'" > ' g:ProjectBuildDir."/cmake_cmd"
execute 'AsyncRun -mode='.a:async_mode.' -save=2 -cwd='.g:ProjectBuildDir.' @ cmake '.args
endfunction
@ -830,11 +836,11 @@ function s:Jenkins_linter(jenkinsfile)
endif
let user_pass = s:user.":".s:passwd
let out = system("curl --no-progress-meter --user '".user_pass."' -X POST -F 'jenkinsfile=<".jenkinsfile."' ".g:jenkins_url."/pipeline-model-converter/validate")
if match(out, "HTTP ERROR 401") >= 0
let l:out = system("curl --no-progress-meter --user '".user_pass."' -X POST -F 'jenkinsfile=<".jenkinsfile."' ".g:jenkins_url."/pipeline-model-converter/validate")
if match(l:out, "HTTP ERROR 401") >= 0
" Forget credentials on authorization error
unlet s:user
unlet s:passwd
endif
echo out
echo l:out
endfunction

View File

@ -72,6 +72,7 @@ set nobackup " keep no backup file
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set belloff=all
" filetype detection
filetype on