ifcviewer: include MetalSurface_mac.h before its use (fix macOS build)

createWgpuSurface() calls wgpu_macos_attach_metal_layer() in the Q_OS_MAC
branch at the top of the file, but the only #include of MetalSurface_mac.h
sat ~450 lines below the call site, so macOS builds failed with 'use of
undeclared identifier'. The header self-guards on __APPLE__, so move the
include up into the early platform block next to <Windows.h>; the lone
call site is the sole consumer, so the late include was dead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-07-10 08:51:54 +10:00
parent d3b12d0307
commit e9e944f77a
+4 -4
View File
@@ -45,6 +45,10 @@
#define NOMCX
#define NOSERVICE
#include <Windows.h>
#elif defined(Q_OS_MAC)
// Cocoa bridge declared here, implemented in the adjacent .mm file. Must be
// visible before createWgpuSurface() below calls wgpu_macos_attach_metal_layer.
#include "MetalSurface_mac.h"
#endif
#include <algorithm>
@@ -832,10 +836,6 @@ bool ViewportWindow::initWgpu() {
# define WIN32_LEAN_AND_MEAN
# endif
# include <windows.h>
#elif defined(Q_OS_MAC)
// Cocoa bridge declared in MetalSurface_mac.h, implemented in the
// adjacent .mm file. Keeps Objective-C out of this pure-C++ TU.
# include "MetalSurface_mac.h"
#endif
// Private bool createSurface() removed in #84-l — its body is now