From 9a8e9bb61b9655529309072e31a62d8776311f68 Mon Sep 17 00:00:00 2001 From: Jonas Holzman Date: Mon, 25 Nov 2024 22:43:19 +0100 Subject: [PATCH] Fix #129985: macOS headless build fails due to missing CGL context symbols When making a `headless` macOS build, linking would fail complaining about missing `GHOST_ContextCGL` symbols, which are required by the Metal backend. This commit fixes this issue by compiling the macOS CGL GHOST Context if the Metal backend is enabled, instead of only depending on `WITH_HEADLESS`, similarly to what's done on Linux/other *nix systems. Pull Request: https://projects.blender.org/blender/blender/pulls/130847 --- intern/ghost/CMakeLists.txt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index abc5786bc64..7fba434b099 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -185,12 +185,6 @@ elseif(APPLE AND NOT WITH_GHOST_X11) intern/GHOST_WindowViewCocoa.hh ) - list(APPEND SRC - intern/GHOST_ContextCGL.mm - - intern/GHOST_ContextCGL.hh - ) - if(WITH_INPUT_NDOF) list(APPEND SRC intern/GHOST_NDOFManagerCocoa.mm @@ -531,6 +525,16 @@ if(UNIX AND NOT APPLE) endif() endif() +if(APPLE) + if(WITH_METAL_BACKEND) + list(APPEND SRC + intern/GHOST_ContextCGL.mm + + intern/GHOST_ContextCGL.hh + ) + endif() +endif() + if(APPLE) list(APPEND SRC intern/GHOST_SystemPathsCocoa.hh