editor/apps/desktop/scripts/build-native.mjs
konstantin-paulus 05f1f53f29 Enhance macOS support and update UI styling
Add native corner radius and backdrop functionality for macOS, improving the visual integration of the application. Update the build process to include a new native build script. Additionally, introduce new CSS variables for stronger border styling across the web application, ensuring a consistent and polished user interface. This change enhances the overall user experience on macOS and improves visual consistency across platforms.
2026-07-15 20:34:34 +02:00

39 lines
1.2 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Compiles the macOS corner-radius addon (src/native/corner_radius.m) into
// dist/corner_radius.node. Node-API is ABI-stable, so a plain clang build
// works across Electron versions; node_api symbols resolve from the Electron
// binary at load time via -undefined dynamic_lookup.
import { execFileSync } from 'node:child_process';
import { mkdirSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
if (process.platform !== 'darwin') process.exit(0);
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
mkdirSync(join(root, 'dist'), { recursive: true });
execFileSync(
'clang',
[
join(root, 'src', 'native', 'corner_radius.m'),
'-o', join(root, 'dist', 'corner_radius.node'),
'-dynamiclib',
'-undefined', 'dynamic_lookup',
'-fobjc-arc',
'-framework', 'AppKit',
'-framework', 'QuartzCore',
'-arch', 'arm64',
'-arch', 'x86_64',
'-mmacosx-version-min=11.0',
'-DNAPI_VERSION=8',
'-Wall',
'-Werror',
],
{ stdio: 'inherit' },
);