Skip to content

Commit

Permalink
Fix umb_echo_server build on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tuokri committed Nov 15, 2023
1 parent dd7d321 commit a414bac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ set_property(
if (MSVC)
set(
UMB_ECHO_SERVER_COMPILE_OPTIONS
/await
/await:strict
)
else ()
set(
Expand Down
17 changes: 17 additions & 0 deletions tests/umb_echo_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
*
*/

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)

#define WINDOWS 1

// Silence "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately".
#include <SDKDDKVer.h>

#else

#define WINDOWS 0

#endif

#include <format>
#include <iostream>
#include <memory>
Expand Down Expand Up @@ -79,7 +92,11 @@ awaitable<void> echo(tcp::socket socket)

const auto type = static_cast<testmessages::umb::MessageType>(
data[2] | (data[3] << 8));
#if WINDOWS
const auto mt_str = std::to_string(static_cast<uint16_t>(type));
#else
const auto mt_str = testmessages::umb::meta::to_string(type);
#endif
std::cout << std::format("type: {}\n", mt_str);

const auto payload = std::span<umb::byte>{data.data(), size};
Expand Down

0 comments on commit a414bac

Please sign in to comment.