Tectu / malloy

A cross-platform C++20 library providing embeddable server & client components for HTTP and WebSocket.
BSD 3-Clause "New" or "Revised" License
66 stars 8 forks source link

CI: MSVC build messages #73

Closed Tectu closed 3 years ago

Tectu commented 3 years ago

Looking at the build output of the various MSVC based CI actions, I see a lot of these messages:

Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
- add -D_WIN32_WINNT=0x0601 to the compiler command line; or
- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).

@0x00002a as you're the MSVC guru here - any input on this?

0x00002a commented 3 years ago

Yeah its a warning emitted by boost somewhere iirc (probably asio for the socket code). It wants to know what windows version (and crucially what features) we have. See the msdn docs on the matter. I'm not sure if there is an advantage to having a version higher than 7 when using asio, and I couldn't find anything in the docs (although they are pretty sparse).

I think malloy should probably offer a cmake option for this, since we can't really make decisions about what windows version the user has (or wants to expose) for them. It could cause issues though if the package is built with a version separate from the version used by the user when including the headers, if asio does things like change class layouts based on it for example.

I suggest we add an option which defaults to 0x0A00 (windows 10) and use it define _WIN32_WINNT. imo this should be a public define so users can't accidentally build with possibly conflicting versions.

Tectu commented 3 years ago

Interesting. Gotta love Windows :p

As far as I can tell it is indeed a good idea to have a cmake option for this with defaulting to 0xA00.

Tectu commented 3 years ago

Currently working on this. After setting _WIN32_WINNT to 0xA00 the MSVC CI now fails with:

C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winuser.h(4379): error C2061: syntax error: identifier 'LPWNDCLASSEXA'
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winuser.h(4387): error C2061: syntax error: identifier 'LPWNDCLASSEXW'
D:\a\malloy\malloy\3rdparty\boost-1.74.0\boost/asio/detail/impl/win_thread.ipp(54): error C2039: 'QueueUserAPC': is not a member of '`global namespace''
D:\a\malloy\malloy\3rdparty\boost-1.74.0\boost/asio/detail/impl/win_thread.ipp(54): error C3861: 'QueueUserAPC': identifier not found
Tectu commented 3 years ago

Fixed in 49a7f7db677a5493af6658e0d07c7e5dbcfa988f