Skip to content

fix(win): build with MinGW-w64 and on case-sensitive filesystems - #22

Open
ssuyash3000 wants to merge 1 commit into
AmitRajput-Dev:mainfrom
ssuyash3000:fix/windows-build
Open

ssuyash3000 wants to merge 1 commit into
AmitRajput-Dev:mainfrom
ssuyash3000:fix/windows-build

Conversation

@ssuyash3000

Copy link
Copy Markdown

The Windows target only ever built under MSVC:

  • #include <BluetoothAPIs.h> — the MinGW-w64 header is bluetoothapis.h, and
    the case also matters when cross-compiling from a case-sensitive filesystem.
  • #pragma comment(lib, ...) is MSVC-only, so ws2_32/rpcrt4/bthprops were never
    linked anywhere else: ~25 undefined references to closesocket, WSAStartup,
    UuidFromStringA, BluetoothFindFirstRadio and friends.
  • #include "Windows.h" in WindowsGUI.h fails the same way.

Link the import libraries from CMake instead, keep the pragmas for MSVC only,
and move NOMINMAX/WIN32_LEAN_AND_MEAN to the target so every translation unit
gets them, not just CrossPlatformGUI.cpp.

Verified by cross-compiling the Windows target with x86_64-w64-mingw32-g++ 13.
MSVC is unaffected: it keeps both the pragmas and the CMake libraries.

The Windows target only ever built under MSVC:

- `#include <BluetoothAPIs.h>` — the MinGW-w64 header is `bluetoothapis.h`, and
  the case also matters when cross-compiling from a case-sensitive filesystem.
- `#pragma comment(lib, ...)` is MSVC-only, so ws2_32/rpcrt4/bthprops were never
  linked anywhere else: ~25 undefined references to closesocket, WSAStartup,
  UuidFromStringA, BluetoothFindFirstRadio and friends.
- `#include "Windows.h"` in WindowsGUI.h fails the same way.

Link the import libraries from CMake instead, keep the pragmas for MSVC only,
and move NOMINMAX/WIN32_LEAN_AND_MEAN to the target so every translation unit
gets them, not just CrossPlatformGUI.cpp.

Verified by cross-compiling the Windows target with x86_64-w64-mingw32-g++ 13.
MSVC is unaffected: it keeps both the pragmas and the CMake libraries.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant