Skip to content

Commit 5e5dd75

Browse files
committed
Optimize build size: disable exceptions
platform | before | after ----------------+--------+------ darwin-x64.node | 867K | 826K linux-x64.node | 858K | 818K win32-ia32.node | 536K | 486K win32-x64.node | 692K | 670K
1 parent b58fb52 commit 5e5dd75

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/build-website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/checkout@v2
2323

2424
- name: C++ configure
25-
run: emcmake cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -fno-exceptions -flto'
25+
run: emcmake cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='-Os -flto' -DCMAKE_CXX_FLAGS='-Os -flto'
2626
- name: C++ build
2727
run: emmake cmake --build build --target quick-lint-js-vscode quick-lint-js-vscode-licenses
2828
- name: C++ install

cmake/QuickLintJSCompiler.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ endfunction ()
6464

6565
function (quick_lint_js_configure_exception_handling)
6666
if (MSVC)
67-
add_compile_options(/EHcs)
67+
add_compile_options(/EHc-s-)
68+
add_definitions(-D_HAS_EXCEPTIONS=0)
6869
endif ()
70+
quick_lint_js_add_cxx_flag_if_supported(-fno-exceptions QUICK_LINT_JS_HAVE_FNO_EXCEPTIONS)
6971
endfunction ()
7072

7173
# RTTI stands for Run-Time Type Information.

0 commit comments

Comments
 (0)