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:
- Install latest CMake (
brew install cmake)
git clone https://github.com/MaddTheSane/Boxer.git
git submodule update --init --recursive
xcodebuild -project Boxer.xcodeproj -scheme Boxer -configuration Release build
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
ToolDependenciesexternal build phase of theOpenEmuShaderssubmodule.CMake >= 4.0 completely dropped compatibility for
CMakeLists.txtfiles requiring< 3.5. TheSPIRV-Toolsandglslangdependencies insideVendor/OpenEmuShaders/3rdparty/are requesting versions2.8.12and3.0, causing a hard fatal error: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/Makefileand 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 oldlibSPIRV-Tools-opt.astatic libraries output by theMakefile.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 update3rdparty/Makefileto append-DCMAKE_POLICY_VERSION_MINIMUM=3.5to the$(CMAKE)generation steps.Alternatively, this
sedreplacement could be added as a quick "Run Script" build phase in Xcode right before theToolDependenciesstep runs.Steps to reproduce:
brew install cmake)git clone https://github.com/MaddTheSane/Boxer.gitgit submodule update --init --recursivexcodebuild -project Boxer.xcodeproj -scheme Boxer -configuration Release build