summaryrefslogtreecommitdiff
path: root/docs/examples/websocket.c
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2024-11-27 16:21:04 +0100
committerViktor Szakats <commit@vsz.me>2024-11-28 14:24:03 +0100
commita72b479decd555c9e9c2c50ded34e317123174f2 (patch)
tree7e519f9b9c3ae2afecfb23fc35bd4de8c0e4c8ca /docs/examples/websocket.c
parent2f03242316f0336d722e1ad7f25755ed86c63373 (diff)
build: fix MSVC UWP builds
The MSVC UWP job in CI did not actually enable UWP. Fix this and the fallouts discovered after enabling it. - GHA/windows: make sure to enable UWP in MSVC vcpkg UWP job. Use the CMake options and C flags already used for mingw-w64, but use `WINAPI_FAMILY_PC_APP` instead of the deprecated `WINAPI_FAMILY_APP`. (The former is not supported by mingw-w64, so leave it there as-is.) Follow-up to cb22cfca69bded45bf7f9c72c8e6764990490f11 #14077 - GHA/windows: by default the MSVC UWP job became 2x-3x slower than others after actually enabling UWP. Most of it is caused by CMake/MSBuild automatically building full APPX containers for each `.exe` target. This includes 21 CMake feature detections. Each detection app is built into a 15MB APPX project, with code signing, logos, etc. Example: https://github.com/curl/curl/actions/runs/12056968170/job/33620610958 Disable this overhead for curl build targets via custom `CMAKE_VS_GLOBALS` options. I've found no way to apply them to feature detection targets, so those remain slow. - cmake: automatically enable Unicode for UWP builds. It's required. Also stop enabling it manually in the existing CI job. - tests: fix `getpid()` use for Windows UWP: ``` tests\server\util.c(281,21): warning C4013: 'getpid' undefined; assuming extern returning int ``` Ref: https://github.com/curl/curl/actions/runs/12061215311/job/33632904249#step:11:38 - src/tool_doswin: disable `GetLoadedModulePaths()` for UWP. mingw-w64 UWP was okay with this, but MS SDK headers are not. This makes `--dump-module-paths` return empty for UWP builds. ``` src\tool_doswin.c(620,3): error C2065: 'MODULEENTRY32': undeclared identifier src\tool_doswin.c(626,11): warning C4013: 'CreateToolhelp32Snapshot' undefined; assuming extern returning int src\tool_doswin.c(626,36): error C2065: 'TH32CS_SNAPMODULE': undeclared identifier src\tool_doswin.c(632,7): warning C4013: 'Module32First' undefined; assuming extern returning int ``` Ref: https://github.com/curl/curl/actions/runs/12055081933/job/33614629930#step:9:35 - examples: fix `websocket.c` to include `winsock2.h` before `windows.h` to make it build with MSVC UWP: ``` include\curl\curl.h(143,16): error C2061: syntax error: identifier 'curl_socket_t' include\curl\curl.h(143,16): error C2059: syntax error: ';' include\curl\curl.h(417,52): error C2146: syntax error: missing ')' before identifier 'curlfd' include\curl\curl.h(417,38): error C2081: 'curl_socket_t': name in formal parameter list illegal ``` Ref: https://github.com/curl/curl/actions/runs/12055317910/job/33615644427#step:14:126 - GHA/windows: silence linker warning with MSVC UWP builds: ``` LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification ``` Ref: https://github.com/curl/curl/actions/runs/12055696808/job/33616629610#step:11:38 - GHA/windows: set `/INCREMENTAL:NO` for all MSVC jobs to improve performance a little. - cmake: show `UWP` platform flag. Ref: #15652 Closes #15657
Diffstat (limited to 'docs/examples/websocket.c')
-rw-r--r--docs/examples/websocket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/docs/examples/websocket.c b/docs/examples/websocket.c
index 996f2a024..758ee48e0 100644
--- a/docs/examples/websocket.c
+++ b/docs/examples/websocket.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <string.h>
#ifdef _WIN32
+#include <winsock2.h>
#include <windows.h>
#define sleep(s) Sleep((DWORD)(s))
#else