Skip to content

Commit a5a902a

Browse files
committed
Try making a universal build for Mac
Github has effectively deprecated Intel Mac so we need to find other solutions.
1 parent a11e8a9 commit a5a902a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ jobs:
3333
- {
3434
name: "macOS Latest Clang",
3535
os: macos-latest,
36-
artifact: darwin-arm64,
37-
}
38-
- {
39-
name: "macOS Intel?",
40-
os: macos-13,
41-
artifact: darwin-x64,
36+
artifact: darwin-universal,
4237
}
4338

4439
steps:

build/build.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ async function compile() {
3838
async function createProject() {
3939
await processThenRestoreCWD(async () => {
4040
process.env.DEPOT_TOOLS_WIN_TOOLCHAIN = '0'
41+
//process.env.DEPOT_TOOLS_UPDATE = '0'
4142
process.chdir(kDawnPath);
4243
fs.copyFileSync('scripts/standalone-with-node.gclient', '.gclient');
4344
await execute('gclient', ['metrics', '--opt-out']);
@@ -54,6 +55,7 @@ async function createProject() {
5455
'-DDAWN_BUILD_NODE_BINDINGS=1',
5556
'-DDAWN_USE_X11=OFF',
5657
`-DCMAKE_BUILD_TYPE=${kConfig}`,
58+
...addElemIf(isMac, '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"'),
5759
...addElemIf(isWin, '-DCMAKE_SYSTEM_VERSION=10.0.26100.0'),
5860
...addElemIf(isMac, '-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk'),
5961
]);
@@ -71,7 +73,8 @@ async function copyResult(filepath, target) {
7173
async function main() {
7274
const compileOnly = process.argv[2] === '--compile-only';
7375
try {
74-
const target = `${process.platform}-${process.arch}`;
76+
const arch = isMac ? 'universal' : process.arch;
77+
const target = `${process.platform}-${arch}`;
7578
console.log('building for:', target);
7679
if (!compileOnly) {
7780
await execute('git', ['submodule', 'update', '--init']);

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { dirname, join } from 'node:path';
22
import { fileURLToPath } from 'node:url';
33
import { createRequire } from 'module';
44
const require = createRequire(import.meta.url);
5+
export const isMac = process.platform === 'darwin';
56

67
const __dirname = dirname(fileURLToPath(import.meta.url));
7-
const dawnNodePath = join(__dirname, 'dist', `${process.platform}-${process.arch}.dawn.node`);
8+
const arch = isMac ? 'universal' : process.arch;
9+
const dawnNodePath = join(__dirname, 'dist', `${process.platform}-${arch}.dawn.node`);
810
const { create, globals } = require(dawnNodePath);
911
export { create, globals }

0 commit comments

Comments
 (0)