Skip to content

Commit

Permalink
ci: build with MSVC on Windows
Browse files Browse the repository at this point in the history
Finally, we have to reintroduce MSVC support:

We love the Windows and MSVC platform for its unique features:
- _CRT_NONSTDC_NO_WARNINGS -> complain about read() and isatty() just
  for the sake of complaining
- _CRT_SECURE_NO_WARNINGS -> annoys us when we are to lazy trying to
  pretty print error messages
- NOMINMAX -> prevent us from using std::numeric_limits<T>::max()
- warn excessivly about conversions with possible loss of data. The best
  ones are for inconsisten Windows APIs e.g. sending us a size_t, which
  we have to give back as an int ...

We fix a lot of warnings previously, but still we cannot treat warnings
as errors on MSVC, because on Windows the TwinCAT header files still use
plain defines for uint16_t values like AMSPORT constants. So we still
see some warnings, when building on Windows with MSVC with TwinCAT
support:
../AdsLib/AdsDevice.cpp(134): warning C4244: 'argument': conversion from 'const ADSSTATE' to 'uint16_t', possible loss of data
../AdsLib/AdsDevice.cpp(133): warning C4244: 'argument': conversion from 'const ADSSTATE' to 'uint16_t', possible loss of data

Signed-off-by: Patrick Bruenn <p.bruenn@beckhoff.com>
  • Loading branch information
pbruenn committed Aug 29, 2022
1 parent 71aaccb commit cbd4c68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ build-win10:
script:
- C:\ProgramData\chocolatey\bin\choco install --no-progress -y meson ninja
- $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
- meson setup build -Dtcadsdll_include=c:\TwinCAT\AdsApi\TcAdsDll\Include -Dtcadsdll_lib=c:\TwinCAT\AdsApi\TcAdsDll\x64\lib
- $prog_x86 = [System.Environment]::GetFolderPath('ProgramFilesX86'); $vswhere = "${prog_x86}\Microsoft Visual Studio\Installer\vswhere.exe"; $vsInstallPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath; Import-Module "$vsInstallPath\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"; Enter-VsDevShell -VsInstallPath:$vsInstallPath -SkipAutomaticLocation -DevCmdArguments:'-arch=x64 -host_arch=x64'
- meson setup build -Dwerror=false -Dcpp_args="-D_CRT_NONSTDC_NO_WARNINGS=1, -D_CRT_SECURE_NO_WARNINGS=1, -DNOMINMAX=1" -Dtcadsdll_include=c:\TwinCAT\AdsApi\TcAdsDll\Include -Dtcadsdll_lib=c:\TwinCAT\AdsApi\TcAdsDll\x64\lib
- ninja -C build
- meson setup example/build example -Dtcadsdll_include=c:\TwinCAT\AdsApi\TcAdsDll\Include -Dtcadsdll_lib=c:\TwinCAT\AdsApi\TcAdsDll\x64\lib
- meson setup example/build example -Dwerror=false -Dcpp_args="-D_CRT_NONSTDC_NO_WARNINGS=1, -D_CRT_SECURE_NO_WARNINGS=1, -DNOMINMAX=1" -Dtcadsdll_include=c:\TwinCAT\AdsApi\TcAdsDll\Include -Dtcadsdll_lib=c:\TwinCAT\AdsApi\TcAdsDll\x64\lib
- ninja -C example/build
artifacts:
when: always
Expand Down

0 comments on commit cbd4c68

Please sign in to comment.