From a59f11fdb1746ced2b90b9dcf16a7860a79cce73 Mon Sep 17 00:00:00 2001 From: kyrylo-hrechykhin <71867931+kyrylo-hrechykhin@users.noreply.github.com> Date: Wed, 25 Jan 2023 23:06:05 +0200 Subject: [PATCH] feat: enable whole-program optimization native modules by default (#36937) * feat: enable whole-program optimization Enable whole-program optimization in electron native modules by default. * pass --with-ltcg to configure.py instead of setting variable * enable ltcg only on windows Co-authored-by: Kyrylo Hrechykhin --- script/generate-config-gypi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script/generate-config-gypi.py b/script/generate-config-gypi.py index 7a3ea6808b42..8a6f23095234 100755 --- a/script/generate-config-gypi.py +++ b/script/generate-config-gypi.py @@ -21,6 +21,10 @@ def run_node_configure(target_cpu): # Work around "No acceptable ASM compiler found" error on some System, # it breaks nothing since Electron does not use OpenSSL. args += ['--openssl-no-asm'] + + # Enable whole-program optimization for electron native modules. + if sys.platform == "win32": + args += ['--with-ltcg'] subprocess.check_call([sys.executable, configure] + args) def read_node_config_gypi():