Skip to content

Instantly share code, notes, and snippets.

@kode54
Last active May 3, 2021 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kode54/0085f387fb6f079a80ba2ab6ee738490 to your computer and use it in GitHub Desktop.
Save kode54/0085f387fb6f079a80ba2ab6ee738490 to your computer and use it in GitHub Desktop.
CMake build script patch for Dolphin, PR# 9441
From a51d9cdde1774fd2c86ec3db4d85f5b7b036f2d9 Mon Sep 17 00:00:00 2001
From: Christopher Snowhill <kode54@gmail.com>
Date: Sun, 2 May 2021 17:59:06 -0700
Subject: [PATCH] Apple M1: Implement CMake Prefix Path override
Fixes issues, if, for instance, the `fmt` package is installed by Homebrew.
---
BuildMacOSUniversalBinary.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/BuildMacOSUniversalBinary.py b/BuildMacOSUniversalBinary.py
index fef29e1d10..faef192813 100755
--- a/BuildMacOSUniversalBinary.py
+++ b/BuildMacOSUniversalBinary.py
@@ -42,6 +42,12 @@ DEFAULT_CONFIG = {
# Build Target (dolphin-emu to just build the emulator and skip the tests)
"build_target": "ALL_BUILD",
+ # Location where base packages should be searched from
+ # The default values of these paths are taken from the default
+ # paths used for homebrew
+ "arm64_cmake_prefix_path": "/opt/homebrew",
+ "x86_64_cmake_prefix_path": "/usr/local",
+
# Locations to pkg config files for arm and x64 libraries
# The default values of these paths are taken from the default
# paths used for homebrew
@@ -123,6 +129,12 @@ def parse_args(conf=DEFAULT_CONFIG):
dest="codesign_identity")
for arch in ARCHITECTURES:
+ parser.add_argument(
+ '--{}_cmake_prefix'.format(arch),
+ help="Folder containing the Homebrew installation for {}".format(arch),
+ default=conf[arch+"_cmake_prefix_path"],
+ dest=arch+"_cmake_prefix_path")
+
parser.add_argument(
'--{}_pkg_config'.format(arch),
help="Folder containing .pc files for {} libraries".format(arch),
@@ -229,6 +241,7 @@ def build(config):
os.mkdir(arch)
env = os.environ.copy()
+ env['CMAKE_PREFIX_PATH'] = config[arch+"_cmake_prefix_path"]
env['PKG_CONFIG_PATH'] = config[arch+"_pkg_config_path"]
env['Qt5_DIR'] = config[arch+"_qt5_path"]
env['CMAKE_OSX_ARCHITECTURES'] = arch
--
2.30.1 (Apple Git-130)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment