Return to site

Build App For Macos Electron

broken image


Follow the guidelines below for building Electron.

Platform prerequisites

You can now go ahead and run npm run electron:mac to build a native desktop app for Mac OS (or Windows). You will find the files inside the release-builds folder of your Ionic application, and you could use these files to distribute your application! See full list on neutrondev.com. The goal is to generate a.exe file for Windows, a.app for macOS, a.deb for Debian-based Linux distributions, and so on. Electron Packager is the official Electron tool to help us convert our source code to a bundle specific for macOS, Linux, or Windows. Icon = build/icon.icns String - The path to application icon. Entitlements String - The path to entitlements file for signing the app. Build/entitlements.mac.plist will be used if exists (it is a recommended way to set). MAS entitlements is specified in the mas.

For

Check the build prerequisites for your platform before proceeding

Build Tools

Electron's Build Tools automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.

GN prerequisites

You'll need to install depot_tools, the toolset used for fetching Chromium and its dependencies.

Also, on Windows, you'll need to set the environment variable DEPOT_TOOLS_WIN_TOOLCHAIN=0. To do so, open Control PanelSystem and SecuritySystemAdvanced system settings and add a system variable DEPOT_TOOLS_WIN_TOOLCHAIN with value 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to download a Google-internal version that only Googlers have access to).

Setting up the git cache

If you plan on checking out Electron more than once (for example, to have multiple parallel directories checked out to different branches), using the git cache will speed up subsequent calls to gclient. To do this, set a GIT_CACHE_PATH environment variable:

Build App For Macos Electron
Build App For Macos Electron

Getting the code

Electron

Instead of https://github.com/electron/electron, you can use your own fork here (something like https://github.com//electron).

A note on pulling/pushing

If you intend to git pull or git push from the official electron repository in the future, you now need to update the respective folder's origin URLs.

📝 gclient works by checking a file called DEPS inside the src/electron folder for dependencies (like Chromium or Node.js). Running gclient sync -f ensures that all dependencies required to build Electron match that file.

Build App For Macos Electronic

So, in order to pull, you'd run the following commands:

Build App For Macos Electron Transfer

Building

Or on Windows (without the optional argument):

This will generate a build directory out/Testing under src/ with the testing build configuration. You can replace Testing with another name, but it should be a subdirectory of out. Also you shouldn't have to run gn gen again—if you want to change the build arguments, you can run gn args out/Testing to bring up an editor.

To see the list of available build configuration options, run gn args out/Testing --list.

For generating Testing build config of Electron:

For generating Release (aka 'non-component' or 'static') build config of Electron:

To build, run ninja with the electron target: Nota Bene: This will also take a while and probably heat up your lap.

For the testing configuration:

For the release configuration:

This will build all of what was previously 'libchromiumcontent' (i.e. the content/ directory of chromium and its dependencies, incl. WebKit and V8), so it will take a while.

To speed up subsequent builds, you can use sccache. Add the GN arg cc_wrapper = 'sccache' by running gn args out/Testing to bring up an editor and adding a line to the end of the file.

The built executable will be under ./out/Testing:

Packaging

On linux, first strip the debugging and symbol information:

To package the electron build as a distributable zip file:

Cross-compiling

To compile for a platform that isn't the same as the one you're building on, set the target_cpu and target_os GN arguments. For example, to compile an x86 target from an x64 host, specify target_cpu = 'x86' in gn args.

Not all combinations of source and target CPU/OS are supported by Chromium.

HostTargetStatus
Windows x64Windows arm64Experimental
Windows x64Windows x86Automatically tested
Linux x64Linux x86Automatically tested

If you test other combinations and find them to work, please update this document :)

See the GN reference for allowable values of target_os and target_cpu.

Windows on Arm (experimental)

Build App For Macos Electron

Check the build prerequisites for your platform before proceeding

Build Tools

Electron's Build Tools automate much of the setup for compiling Electron from source with different configurations and build targets. If you wish to set up the environment manually, the instructions are listed below.

GN prerequisites

You'll need to install depot_tools, the toolset used for fetching Chromium and its dependencies.

Also, on Windows, you'll need to set the environment variable DEPOT_TOOLS_WIN_TOOLCHAIN=0. To do so, open Control PanelSystem and SecuritySystemAdvanced system settings and add a system variable DEPOT_TOOLS_WIN_TOOLCHAIN with value 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to download a Google-internal version that only Googlers have access to).

Setting up the git cache

If you plan on checking out Electron more than once (for example, to have multiple parallel directories checked out to different branches), using the git cache will speed up subsequent calls to gclient. To do this, set a GIT_CACHE_PATH environment variable:

Getting the code

Instead of https://github.com/electron/electron, you can use your own fork here (something like https://github.com//electron).

A note on pulling/pushing

If you intend to git pull or git push from the official electron repository in the future, you now need to update the respective folder's origin URLs.

📝 gclient works by checking a file called DEPS inside the src/electron folder for dependencies (like Chromium or Node.js). Running gclient sync -f ensures that all dependencies required to build Electron match that file.

Build App For Macos Electronic

So, in order to pull, you'd run the following commands:

Build App For Macos Electron Transfer

Building

Or on Windows (without the optional argument):

This will generate a build directory out/Testing under src/ with the testing build configuration. You can replace Testing with another name, but it should be a subdirectory of out. Also you shouldn't have to run gn gen again—if you want to change the build arguments, you can run gn args out/Testing to bring up an editor.

To see the list of available build configuration options, run gn args out/Testing --list.

For generating Testing build config of Electron:

For generating Release (aka 'non-component' or 'static') build config of Electron:

To build, run ninja with the electron target: Nota Bene: This will also take a while and probably heat up your lap.

For the testing configuration:

For the release configuration:

This will build all of what was previously 'libchromiumcontent' (i.e. the content/ directory of chromium and its dependencies, incl. WebKit and V8), so it will take a while.

To speed up subsequent builds, you can use sccache. Add the GN arg cc_wrapper = 'sccache' by running gn args out/Testing to bring up an editor and adding a line to the end of the file.

The built executable will be under ./out/Testing:

Packaging

On linux, first strip the debugging and symbol information:

To package the electron build as a distributable zip file:

Cross-compiling

To compile for a platform that isn't the same as the one you're building on, set the target_cpu and target_os GN arguments. For example, to compile an x86 target from an x64 host, specify target_cpu = 'x86' in gn args.

Not all combinations of source and target CPU/OS are supported by Chromium.

HostTargetStatus
Windows x64Windows arm64Experimental
Windows x64Windows x86Automatically tested
Linux x64Linux x86Automatically tested

If you test other combinations and find them to work, please update this document :)

See the GN reference for allowable values of target_os and target_cpu.

Windows on Arm (experimental)

To cross-compile for Windows on Arm, follow Chromium's guide to get the necessary dependencies, SDK and libraries, then build with ELECTRON_BUILDING_WOA=1 in your environment before running gclient sync.

Or (if using PowerShell):

Next, run gn gen as above with target_cpu='arm64'.

Tests

To run the tests, you'll first need to build the test modules against the same version of Node.js that was built as part of the build process. To generate build headers for the modules to compile against, run the following under src/ directory.

You can now run the tests.

If you're debugging something, it can be helpful to pass some extra flags to the Electron binary:

Sharing the git cache between multiple machines

It is possible to share the gclient git cache with other machines by exporting it as SMB share on linux, but only one process/machine can be using the cache at a time. The locks created by git-cache script will try to prevent this, but it may not work perfectly in a network.

On Windows, SMBv2 has a directory cache that will cause problems with the git cache script, so it is necessary to disable it by setting the registry key

to 0. More information: https://stackoverflow.com/a/9935126

Download Museo 500 font for PC/Mac for free, take a test-drive and see the entire character set. Moreover, you can embed it to your website with @font-face support. Download Free Font Museo. Font name: Museo (35 reviews) Categories: Various, Sans Serif. WFonts.com Download Free Fonts. The best site download free fonts. Download Museo font for PC/Mac for free, take a test-drive and see the entire character set. Moreover, you can embed it to your website with @font-face support. Museo free font. This OpenType font family comes in five weights and offers supports CE languages and even esperanto. Besides ligatures, contextual alternatives, stylistic alternates, fractions and proportional/tabular figures MUSEO also has a 'case' feature for case sensative forms. (Free) download. MUSEO font family has five weights (100 300 500 700 900).

This can be set quickly in powershell (ran as administrator):

Troubleshooting

gclient sync complains about rebase

If gclient sync is interrupted the git tree may be left in a bad state, leading to a cryptic message when running gclient sync in the future:

If there are no git conflicts or rebases in src/electron, you may need to abort a git am in src:

Build App For Macos Electron Windows 10

I'm being asked for a username/password for chromium-internal.googlesource.com

Build App For Macos Electronics

If you see a prompt for Username for 'https://chrome-internal.googlesource.com': when running gclient sync on Windows, it's probably because the DEPOT_TOOLS_WIN_TOOLCHAIN environment variable is not set to 0. Open Control PanelSystem and SecuritySystemAdvanced system settings and add a system variable DEPOT_TOOLS_WIN_TOOLCHAIN with value 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to download a Google-internal version that only Googlers have access to).

Build App For Macos Electron Microscopy

© GitHub Inc.
Licensed under the MIT license.
https://www.electronjs.org/docs/development/build-instructions-gn





broken image