[vlc-commits] [Git][videolan/vlc][master] 2 commits: configure: do not require metal when disabling macosx-ui-shaders

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Wed Oct 7 10:40:01 UTC 2026



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
8581d6ae by Marvin Scholz at 2026-10-07T12:07:56+02:00
configure: do not require metal when disabling macosx-ui-shaders

Even with --disable-macosx-ui-shaders the metal toolchain was
incorrectly required.

- - - - -
251ebce0 by Marvin Scholz at 2026-10-07T12:07:56+02:00
macosx: fix build with --disable-macosx-ui-shaders

- - - - -


5 changed files:

- configure.ac
- extras/package/macosx/package.mak
- modules/gui/macosx/Makefile.am
- modules/gui/macosx/library/VLCLibraryWindow.m
- modules/gui/macosx/main/VLCMain.m


Changes:

=====================================
configure.ac
=====================================
@@ -4655,6 +4655,16 @@ dnl  MacOS X gui module
 dnl
 AC_ARG_ENABLE([macosx],
   AS_HELP_STRING([--enable-macosx], [Mac OS X gui support (default enabled on Mac OS X)]))
+AC_ARG_ENABLE([macosx-ui-shaders],
+  AS_HELP_STRING([--disable-macosx-ui-shaders], [macOS UI Metal shaders (default: enabled if macOS UI is enabled)]),
+  [],
+  [
+    AS_IF([test -z "$enable_macosx"], [
+      AS_IF([test "${SYS}" = "darwin"], [enable_macosx_ui_shaders = "yes"])
+    ], [
+      enable_macosx_ui_shaders="$enable_macosx"
+    ])
+])
 enable_macosx_xctests="no"
 if test "${enable_macosx}" != "no" -a "${SYS}" = "darwin"
 then
@@ -4680,42 +4690,55 @@ then
   ])
 
   dnl
-  dnl If possible, use xcrun to find the right metal tool
+  dnl MacOS X gui module metal shaders
   dnl
 
-  AS_IF([test ! "${XCRUN}" = "no"], [
-    AC_MSG_CHECKING([for metal (using xcrun)])
-    METAL="$(eval $XCRUN --toolchain metal -f metal 2>/dev/null || eval $XCRUN -f metal 2>/dev/null || echo no)"
-    AC_MSG_RESULT([${METAL}])
-  ], [
-    AC_MSG_WARN([Looking for tools without using xcrun])
-  ])
+  AS_IF([test "${enable_macosx_ui_shaders}" != "no"], [
+    dnl Find Metal, first try xcrun, fallback to normal lookup
+    AS_IF([test ! "${XCRUN}" = "no"], [
+      AC_MSG_CHECKING([for metal (using xcrun)])
+      METAL="$(eval $XCRUN --toolchain metal -f metal 2>/dev/null || eval $XCRUN -f metal 2>/dev/null || echo no)"
+      AC_MSG_RESULT([${METAL}])
+    ], [
+      AC_MSG_WARN([Looking for tools without using xcrun])
+    ])
 
-  AS_IF([test "${METAL}" = "no"], [
-    AC_PATH_PROG(METAL, [metal], [no])
     AS_IF([test "${METAL}" = "no"], [
-      AC_MSG_ERROR([metal was not found, but is required for --enable-macosx])
+      AC_PATH_PROG([METAL], [metal], [no])
+      AS_IF([test "${METAL}" = "no"], [
+        AS_IF([test "${enable_macosx_ui_shaders}" = "yes"], [
+          AC_MSG_ERROR([metal was not found, required for macosx-ui-shaders])
+        ], [
+          AC_MSG_WARN([metal was not found, macosx-ui-shaders will be disabled])
+        ])
+        enable_macosx_ui_shaders="no"
+      ])
     ])
-  ])
 
-  dnl
-  dnl If possible, use xcrun to find the right metallib tool
-  dnl
-
-  AS_IF([test ! "${XCRUN}" = "no"], [
-    AC_MSG_CHECKING([for metallib (using xcrun)])
-    METALLIB="$(eval $XCRUN --toolchain metal -f metallib 2>/dev/null || eval $XCRUN -f metallib 2>/dev/null || echo no)"
-    AC_MSG_RESULT([${METALLIB}])
-  ], [
-    AC_MSG_WARN([Looking for tools without using xcrun])
-  ])
+    dnl Find metallib, first try xcrun, fallback to normal lookup
+    AS_IF([test ! "${XCRUN}" = "no"], [
+      AC_MSG_CHECKING([for metallib (using xcrun)])
+      METALLIB="$(eval $XCRUN --toolchain metal -f metallib 2>/dev/null || eval $XCRUN -f metallib 2>/dev/null || echo no)"
+      AC_MSG_RESULT([${METALLIB}])
+    ], [
+      AC_MSG_WARN([Looking for tools without using xcrun])
+    ])
 
-  AS_IF([test "${METALLIB}" = "no"], [
-    AC_PATH_PROG(METALLIB, [metallib], [no])
     AS_IF([test "${METALLIB}" = "no"], [
-      AC_MSG_ERROR([metallib was not found, but is required for --enable-macosx, try xcodebuild -downloadComponent MetalToolchain])
+      AC_PATH_PROG([METALLIB], [metallib], [no])
+      AS_IF([test "${METALLIB}" = "no"], [
+        AS_IF([test "${enable_macosx_ui_shaders}" = "yes"], [
+          AC_MSG_ERROR([metallib was not found, required for macosx-ui-shaders, try disabling or install it with: xcodebuild -downloadComponent MetalToolchain])
+        ], [
+          AC_MSG_WARN([metallib was not found, macosx-ui-shaders will be disabled])
+        ])
+        enable_macosx_ui_shaders="no"
+      ])
     ])
   ])
+  AS_IF([test "${enable_macosx_ui_shaders}" != "no"], [
+    AC_DEFINE([ENABLE_MACOSX_UI_SHADERS], [1], [Define to 1 if macOS UI Metal shaders are enabled.])
+  ])
 
   dnl
   dnl If possible, use xcrun to find the right actool
@@ -4761,24 +4784,8 @@ then
       enable_macosx_xctests="yes"
     ])
   ])
-
-  dnl
-  dnl  MacOS X gui module metal shaders
-  dnl
-  _enable_macosx_ui_shaders_default="yes"
-
-  AC_ARG_ENABLE([macosx-ui-shaders],
-    AS_HELP_STRING([--disable-macosx-ui-shaders], [Disable macOS UI Metal shaders (default: enabled if macOS UI is active)]),
-    [], [enable_macosx_ui_shaders="${_enable_macosx_ui_shaders_default}"]
-  )
-
-  if test "${enable_macosx_ui_shaders}" != "no"
-  then
-    dnl Tool checks for metal and metallib are already performed above if enable_macosx is true.
-    dnl We assume they are found if we reach this point and shaders are enabled.
-    AC_DEFINE([ENABLE_MACOSX_UI_SHADERS], [1], [Define to 1 if macOS UI Metal shaders are enabled.])
-  fi
 fi
+
 AM_CONDITIONAL([ENABLE_MACOSX_UI_SHADERS], [test "${enable_macosx_ui_shaders}" != "no" -a "${enable_macosx}" != "no" -a "${SYS}" = "darwin"])
 AM_CONDITIONAL([ENABLE_MACOSX_UI], [test "$enable_macosx" != "no" -a "${SYS}" = "darwin"])
 AM_CONDITIONAL([ENABLE_MACOSX_XCTESTS], [test "${enable_macosx_xctests}" = "yes"])


=====================================
extras/package/macosx/package.mak
=====================================
@@ -31,8 +31,10 @@ VLC.app: macos-install
 	cp -R "$(top_builddir)/modules/gui/macosx/UI/." $@/Contents/Resources/Base.lproj/
 	## Copy Asset catalog
 	cp "$(top_builddir)/modules/gui/macosx/Resources/Assets.car" $@/Contents/Resources/Assets.car
+if ENABLE_MACOSX_UI_SHADERS
 	## Copy Shaders metal library
 	cp "$(top_builddir)/modules/gui/macosx/Resources/Shaders.metallib" $@/Contents/Resources/Shaders.metallib
+endif
 	## Copy Info.plist and convert to binary
 	cp -R "$(top_builddir)/share/macosx/Info.plist" $@/Contents/
 	xcrun plutil -convert binary1 $@/Contents/Info.plist


=====================================
modules/gui/macosx/Makefile.am
=====================================
@@ -498,8 +498,6 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/views/VLCScrollingClipView.m \
 	gui/macosx/views/VLCSettingTextField.h \
 	gui/macosx/views/VLCSettingTextField.m \
-	gui/macosx/views/VLCSnowEffectView.h \
-	gui/macosx/views/VLCSnowEffectView.m \
 	gui/macosx/views/VLCSpacingConstraint.h \
 	gui/macosx/views/VLCSpacingConstraint.m \
 	gui/macosx/views/VLCStackView.h \
@@ -577,6 +575,11 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/windows/video/VLCWindow.h \
 	gui/macosx/windows/video/VLCWindow.m
 
+if ENABLE_MACOSX_UI_SHADERS
+libmacosx_plugin_la_SOURCES += \
+	gui/macosx/views/VLCSnowEffectView.h \
+	gui/macosx/views/VLCSnowEffectView.m
+endif
 
 # User interface compilation
 


=====================================
modules/gui/macosx/library/VLCLibraryWindow.m
=====================================
@@ -86,7 +86,6 @@
 #import "views/VLCNoResultsLabel.h"
 #import "views/VLCPlaybackEndViewController.h"
 #import "views/VLCRoundedCornerTextField.h"
-#import "views/VLCSnowEffectView.h"
 #import "views/VLCTrackingView.h"
 #import "views/VLCUIUnits.h"
 
@@ -94,6 +93,10 @@
 #import "windows/VLCOpenInputMetadata.h"
 #import "windows/VLCOpenWindowController.h"
 
+#ifdef ENABLE_MACOSX_UI_SHADERS
+# import "views/VLCSnowEffectView.h"
+#endif
+
 #import "windows/controlsbar/VLCMainWindowControlsBar.h"
 
 #import "windows/video/VLCMainVideoViewController.h"
@@ -333,6 +336,7 @@ static int ShowController(vlc_object_t * __unused p_this,
         [view.rightAnchor constraintEqualToAnchor:self.libraryTargetView.rightAnchor]
     ]];
 
+#ifdef ENABLE_MACOSX_UI_SHADERS
     if (VLCMain.sharedInstance.metalLibrary && ((VLCApplication *)NSApplication.sharedApplication).winterHolidaysTheming) {
         VLCSnowEffectView * const snowView =
             [[VLCSnowEffectView alloc] initWithFrame:self.contentView.bounds];
@@ -340,6 +344,7 @@ static int ShowController(vlc_object_t * __unused p_this,
         snowView.translatesAutoresizingMaskIntoConstraints = NO;
         [snowView applyConstraintsToFillSuperview];
     }
+#endif
 }
 
 - (void)displayLibraryPlaceholderViewWithImage:(NSImage *)image
@@ -365,7 +370,7 @@ static int ShowController(vlc_object_t * __unused p_this,
         _noResultsLabel = [[VLCNoResultsLabel alloc] init];
         _noResultsLabel.translatesAutoresizingMaskIntoConstraints = NO;
     }
-    
+
     if ([self.libraryTargetView.subviews containsObject:self.loadingOverlayView]) {
         self.libraryTargetView.subviews = @[self.noResultsLabel, self.loadingOverlayView];
     } else {
@@ -415,7 +420,7 @@ static int ShowController(vlc_object_t * __unused p_this,
                                                            selector:@selector(updateFilterString)
                                                            userInfo:nil
                                                             repeats:NO];
-    
+
     if (self.librarySegmentType == VLCLibraryHomeSegmentType) {
         return;
     }
@@ -531,7 +536,7 @@ static int ShowController(vlc_object_t * __unused p_this,
     VLCPlayerController * const playerController = self.playerController;
     const BOOL videoTrackDisabled =
         !playerController.videoTracksEnabled || !playerController.selectedVideoTrack.selected;
-        
+
     if (videoTrackDisabled || !var_InheritBool(getIntf(), "embedded-video"))
         return;
 
@@ -781,20 +786,20 @@ static int ShowController(vlc_object_t * __unused p_this,
     // Get the partial word being completed
     NSString * const currentText = textView.string;
     NSString * const partialWord = [currentText substringWithRange:charRange];
-    
+
     if (partialWord.length == 0) {
         return @[];
     }
-    
+
     // Get cached titles from library model
     VLCLibraryModel * const libraryModel = VLCMain.sharedInstance.libraryController.libraryModel;
     if (!libraryModel) {
         return @[];
     }
-    
+
     NSArray<NSString *> * const allTitles = libraryModel.listOfMediaTitles;
     NSMutableArray<NSString *> * const matchingTitles = [NSMutableArray arrayWithCapacity:VLCLibrarySearchMaxMatchingTitles];
-    
+
     // Filter titles that match the partial word
     for (NSString * const title in allTitles) {
         if (![title.lowercaseString hasPrefix:partialWord.lowercaseString]) {
@@ -805,7 +810,7 @@ static int ShowController(vlc_object_t * __unused p_this,
             break;
         }
     }
-    
+
     *index = -1;
     return matchingTitles;
 }


=====================================
modules/gui/macosx/main/VLCMain.m
=====================================
@@ -327,6 +327,7 @@ static VLCMain *sharedInstance = nil;
 {
     // Only Metal shader in use at the moment is for holiday theming, so only load during this time.
     // Change this if you are going to add new shaders!
+#ifdef ENABLE_MACOSX_UI_SHADERS
     if (((VLCApplication *)NSApplication.sharedApplication).winterHolidaysTheming) {
         _metalDevice = MTLCreateSystemDefaultDevice();
         NSString * const libraryPath =
@@ -341,6 +342,7 @@ static VLCMain *sharedInstance = nil;
             NSLog(@"Error: Could not find Shaders.metallib in the bundle.");
         }
     }
+#endif
 
     _clickerManager = [[VLCClickerManager alloc] init];
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/04d555a9d391f009d4f510f508fef58c39bdf810...251ebce0e572544f77dbeb4e2f54233a052b08a5

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/04d555a9d391f009d4f510f508fef58c39bdf810...251ebce0e572544f77dbeb4e2f54233a052b08a5
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list