From 79c35828daf3e61e811f37f7c6789900b6f37c27 Mon Sep 17 00:00:00 2001 From: Uwe Vogt Date: Tue, 12 Mar 2024 20:05:50 +0100 Subject: [PATCH] Update build jobs for GitHub actions Relates to [CANAPI-66] --- x64_build.bat | 43 ++++++++++++++++++++++++++++++++++--------- x86_build.bat | 44 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 69 insertions(+), 18 deletions(-) diff --git a/x64_build.bat b/x64_build.bat index 8101f2c..285544f 100644 --- a/x64_build.bat +++ b/x64_build.bat @@ -1,29 +1,49 @@ @echo off -pushd -call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" x64 -popd +rem parse arguments: [[NOVARS] NOTRIAL] +if "%1" == "NOVARS" ( + set VCVARS="False" +) else ( + set VCVARS="True" +) +SHIFT +if "%1" == "NOTRIAL" ( + set TRIAL="False" +) else ( + set TRIAL="True" +) +rem set MSBuild environment variables +if %VCVARS% == "True" ( + pushd + call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" x64 + popd +) pushd -call build_no.bat -rem type .\Sources\build_no.h -rem pause -call msbuild.exe .\Trial\kvl_test.vcxproj /t:Clean;Build /p:"Configuration=Debug";"Platform=x64" -if errorlevel 1 goto end +rem generate a pseudo build number +call build_no.bat +rem build the trial program +if %TRIAL% == "True" ( + call msbuild.exe .\Trial\kvl_test.vcxproj /t:Clean;Build /p:"Configuration=Debug";"Platform=x64" + if errorlevel 1 goto end +) +rem build the CAN API V3 C library (dynamic and static) call msbuild.exe .\Libraries\CANAPI\uvcankvl.vcxproj /t:Clean;Build /p:"Configuration=Release_dll";"Platform=x64" if errorlevel 1 goto end call msbuild.exe .\Libraries\CANAPI\uvcankvl.vcxproj /t:Clean;Build /p:"Configuration=Debug_lib";"Platform=x64" if errorlevel 1 goto end +rem build the CAN API V3 C++ library (dynamic and static) call msbuild.exe .\Libraries\KvaserCAN\KvaserCAN.vcxproj /t:Clean;Build /p:"Configuration=Release_dll";"Platform=x64" if errorlevel 1 goto end call msbuild.exe .\Libraries\KvaserCAN\KvaserCAN.vcxproj /t:Clean;Build /p:"Configuration=Debug_lib";"Platform=x64" if errorlevel 1 goto end +rem copy the arifacts into the Binaries folder echo Copying artifacts... set BIN=".\Binaries" if not exist %BIN% mkdir %BIN% @@ -53,12 +73,14 @@ copy /Y .\Sources\CANAPI\CANBTR_Defaults.h %INC% copy /Y .\Sources\CANAPI\can_api.h %INC% copy /Y .\Sources\CANAPI\can_btr.h %INC% +rem build the utilities 'can_mone' and 'can_test' call msbuild.exe .\Utilities\can_moni\can_moni.vcxproj /t:Clean;Build /p:"Configuration=Release";"Platform=x64" if errorlevel 1 goto end call msbuild.exe .\Utilities\can_test\can_test.vcxproj /t:Clean;Build /p:"Configuration=Release";"Platform=x64" if errorlevel 1 goto end +rem copy the utilities into the Binaries folder echo Copying utilities... set BIN=".\Binaries" if not exist %BIN% mkdir %BIN% @@ -67,6 +89,9 @@ if not exist %BIN% mkdir %BIN% copy /Y .\Utilities\can_moni\x64\Release\can_moni.exe %BIN% copy /Y .\Utilities\can_test\x64\Release\can_test.exe %BIN% +rem end of the job :end popd -pause +if %VCVARS% == "True" ( + pause +) diff --git a/x86_build.bat b/x86_build.bat index cc11470..8433611 100644 --- a/x86_build.bat +++ b/x86_build.bat @@ -1,29 +1,49 @@ @echo off -pushd -call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" x86 -popd +rem parse arguments: [[NOVARS] NOTRIAL] +if "%1" == "NOVARS" ( + set VCVARS="False" +) else ( + set VCVARS="True" +) +SHIFT +if "%1" == "NOTRIAL" ( + set TRIAL="False" +) else ( + set TRIAL="True" +) +rem set MSBuild environment variables +if %VCVARS% == "True" ( + pushd + call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" x86 + popd +) pushd -call build_no.bat -rem type .\Sources\build_no.h -rem pause -call msbuild.exe .\Trial\kvl_test.vcxproj /t:Clean;Build /p:"Configuration=Debug";"Platform=Win32" -if errorlevel 1 goto end +rem generate a pseudo build number +call build_no.bat +rem build the trial program +if %TRIAL% == "True" ( + call msbuild.exe .\Trial\kvl_test.vcxproj /t:Clean;Build /p:"Configuration=Debug";"Platform=Win32" + if errorlevel 1 goto end +) +rem build the CAN API V3 C library (dynamic and static) call msbuild.exe .\Libraries\CANAPI\uvcankvl.vcxproj /t:Clean;Build /p:"Configuration=Release_dll";"Platform=Win32" if errorlevel 1 goto end call msbuild.exe .\Libraries\CANAPI\uvcankvl.vcxproj /t:Clean;Build /p:"Configuration=Debug_lib";"Platform=Win32" if errorlevel 1 goto end +rem build the CAN API V3 C++ library (dynamic and static) call msbuild.exe .\Libraries\KvaserCAN\KvaserCAN.vcxproj /t:Clean;Build /p:"Configuration=Release_dll";"Platform=Win32" if errorlevel 1 goto end call msbuild.exe .\Libraries\KvaserCAN\KvaserCAN.vcxproj /t:Clean;Build /p:"Configuration=Debug_lib";"Platform=Win32" if errorlevel 1 goto end +rem copy the arifacts into the Binaries folder echo Copying artifacts... set BIN=".\Binaries" if not exist %BIN% mkdir %BIN% @@ -42,6 +62,7 @@ copy /Y .\Libraries\KvaserCAN\Debug_lib\uvKvaserCAN.pdb %BIN% copy /Y .\Sources\CANlib\x86\canlib32.lib %BIN% echo Static libraries (x86) > %BIN%\readme.txt +rem copy the header files into the Includes folder echo Copying header files... set INC=".\Includes" if not exist %INC% mkdir %INC% @@ -53,12 +74,14 @@ copy /Y .\Sources\CANAPI\CANBTR_Defaults.h %INC% copy /Y .\Sources\CANAPI\can_api.h %INC% copy /Y .\Sources\CANAPI\can_btr.h %INC% +rem build the utilities 'can_mone' and 'can_test' call msbuild.exe .\Utilities\can_moni\can_moni.vcxproj /t:Clean;Build /p:"Configuration=Release";"Platform=Win32" if errorlevel 1 goto end call msbuild.exe .\Utilities\can_test\can_test.vcxproj /t:Clean;Build /p:"Configuration=Release";"Platform=Win32" if errorlevel 1 goto end +rem copy the utilities into the Binaries folder echo Copying utilities... set BIN=".\Binaries" if not exist %BIN% mkdir %BIN% @@ -67,6 +90,9 @@ if not exist %BIN% mkdir %BIN% copy /Y .\Utilities\can_moni\Release\can_moni.exe %BIN% copy /Y .\Utilities\can_test\Release\can_test.exe %BIN% +rem end of the job :end popd -pause +if %VCVARS% == "True" ( + pause +)