Skip to content

Build fails on modern macOS/Homebrew due to CMake >= 4.0 dropping legacy version support in OpenEmuShaders #76

Description

@sheurich

The Problem
If a user tries to build Boxer using a modern version of CMake (e.g., CMake 4.2.3 from Homebrew), the build fails during the ToolDependencies external build phase of the OpenEmuShaders submodule.

CMake >= 4.0 completely dropped compatibility for CMakeLists.txt files requiring < 3.5. The SPIRV-Tools and glslang dependencies inside Vendor/OpenEmuShaders/3rdparty/ are requesting versions 2.8.12 and 3.0, causing a hard fatal error:

CMake Error at CMakeLists.txt:15 (cmake_minimum_required):
  Compatibility with CMake < 3.5 has been removed from CMake.

Why we can't just bump the OpenEmuShaders submodule
Normally, the fix would be to pull the latest commits from upstream OpenEmu/OpenEmu-Shaders, where the Khronos dependencies are presumably updated.

However, OpenEmu drastically restructured their build system recently. They completely deleted the 3rdparty/Makefile and local C++ git submodules in favor of a pre-compiled Swift Package Manager dependency (SwiftSPIRV-Cross). Updating Boxer's submodule pointer to OpenEmu's master branch would break Boxer's .pbxproj, which is hardcoded to expect the old libSPIRV-Tools-opt.a static libraries output by the Makefile.

Proposed Solution
To keep Boxer building cleanly without having to rewrite the Xcode project's shader linkage, we can simply pass a policy flag to CMake that overrides the legacy version check.

In Boxer's fork of OpenEmu-Shaders, we should update 3rdparty/Makefile to append -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to the $(CMAKE) generation steps.

--- a/3rdparty/Makefile
+++ b/3rdparty/Makefile
@@ -37,7 +37,7 @@ build_info.h: $(GLSLANG_BUILD_DIR)/include/glslang/build_info.h
 
 $(GLSLANG_BUILD_DIR)/CMakeCache.txt: $(GLSLANG_DIR)/CMakeLists.txt
 	mkdir -p $(GLSLANG_BUILD_DIR)
-	$(CMAKE) -B $(GLSLANG_BUILD_DIR) -S $(GLSLANG_DIR)
+	$(CMAKE) -B $(GLSLANG_BUILD_DIR) -S $(GLSLANG_DIR) -DCMAKE_POLICY_VERSION_MINIMUM=3.5
 
 # SPIRV-Tools
 
@@ -52,7 +52,7 @@ libSPIRV-Tools-opt.a: $(SPIRV_TOOLS_BUILD_DIR)/source/opt/libSPIRV-Tools-opt.a
 
 $(SPIRV_TOOLS_BUILD_DIR)/CMakeCache.txt: $(SPIRV_TOOLS_DIR)/CMakeLists.txt $(SPIRV_TOOLS_EXTERNAL_DIR)/SPIRV-Headers
 	mkdir -p $(SPIRV_TOOLS_BUILD_DIR)
-	$(CMAKE) -B $(SPIRV_TOOLS_BUILD_DIR) -S $(SPIRV_TOOLS_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES='$(TARGET_ARCHITECTURES)' -DSPIRV_WERROR=OFF
+	$(CMAKE) -B $(SPIRV_TOOLS_BUILD_DIR) -S $(SPIRV_TOOLS_DIR) -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_OSX_ARCHITECTURES='$(TARGET_ARCHITECTURES)' -DSPIRV_WERROR=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.5

Alternatively, this sed replacement could be added as a quick "Run Script" build phase in Xcode right before the ToolDependencies step runs.


Steps to reproduce:

  1. Install latest CMake (brew install cmake)
  2. git clone https://github.com/MaddTheSane/Boxer.git
  3. git submodule update --init --recursive
  4. xcodebuild -project Boxer.xcodeproj -scheme Boxer -configuration Release build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions