-
Notifications
You must be signed in to change notification settings - Fork 31
Reduce CppInterOp Emscripten shared library size #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -127,10 +127,16 @@ if(EMSCRIPTEN) | |
set_target_properties(clangCppInterOp | ||
PROPERTIES NO_SONAME 1 | ||
) | ||
target_compile_options(clangCppInterOp | ||
PRIVATE "SHELL: -Oz" | ||
PRIVATE "SHELL: -flto" | ||
) | ||
target_link_options(clangCppInterOp | ||
PRIVATE "SHELL: -s WASM_BIGINT" | ||
PRIVATE "SHELL: -s SIDE_MODULE=1" | ||
PRIVATE "SHELL: ${SYMBOLS_LIST}" | ||
PRIVATE "SHELL: -Oz" | ||
PRIVATE "SHELL: -flto" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm why is lto being involved here ? I've tried using it in the past and I remember it behaves notoriously. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding these flags gets us a further reduction in the size of the Emscripten shared library of a few Mb. Needed them for both compile and link flags for it to have any effect. I didn't see any bad side effects your comment suggests (I don't know exactly what you mean by behaves notoriously). |
||
) | ||
else() | ||
target_link_options(clangCppInterOp | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, we necessarily need to change the way llvm is built for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We absolutely need to change the llvm build to get this reduction in size of Emscripten shared library. The majority of the size reduction this PR provides comes from adding these flags to the llvm build.