32 lines
1.3 KiB
C++
32 lines
1.3 KiB
C++
|
|
//SPDX-License-Identifier: LGPL-3.0-only
|
||
|
|
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||
|
|
|
||
|
|
// A Win32 executable that uses the library as an application does links:
|
||
|
|
// Device::Initialize, a Window, and StartSync, whose Gamepad::Tick pulls in
|
||
|
|
// the gamepad code. That takes the vulkan-1 import library project.cpp makes
|
||
|
|
// from the Vulkan loader's export list, which no MinGW toolchain ships, and
|
||
|
|
// libuuid for the gamepad code's IIDs (#184). Without either, no Win32
|
||
|
|
// executable linked, and nothing noticed: the Win32 library is only
|
||
|
|
// archived, and the other Win32 tests are skipped where there is no Wine.
|
||
|
|
//
|
||
|
|
// Where there is no Wine, the link is the test, and nothing runs:
|
||
|
|
// crafter-build test --target=x86_64-w64-mingw32 --runner=cmd:true Win32Link
|
||
|
|
// Under Wine it also runs, which needs a Vulkan device: it opens a window, and
|
||
|
|
// StartSync returns once the WM_CLOSE posted to it has cleared `open`.
|
||
|
|
|
||
|
|
#include <windows.h>
|
||
|
|
#include <cstdlib>
|
||
|
|
|
||
|
|
import Crafter.Graphics;
|
||
|
|
import std;
|
||
|
|
using namespace Crafter;
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
Device::Initialize();
|
||
|
|
Window window(64, 64, "Win32Link");
|
||
|
|
PostMessageW(window.hwnd, WM_CLOSE, 0, 0);
|
||
|
|
window.StartSync();
|
||
|
|
const bool closed = !window.open;
|
||
|
|
std::println("{} a window opened, and StartSync returned once WM_CLOSE closed it", closed ? "PASS" : "FAIL");
|
||
|
|
return closed ? EXIT_SUCCESS : EXIT_FAILURE;
|
||
|
|
}
|