LLVM_WASM: Support linking via emscripten#3877
Merged
ubaidsk merged 4 commits intolfortran:mainfrom Apr 16, 2024
Merged
Conversation
CMake: Support both emcc and wasi
Member
Author
|
Steps:
diff --git a/build1.sh b/build1.sh
index 49a1cf78b..24737c919 100755
--- a/build1.sh
+++ b/build1.sh
@@ -3,6 +3,8 @@
set -e
set -x
+export EMSDK_PATH=$HOME/ext/emsdk
+
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_LLVM=yes \
@@ -12,5 +14,6 @@ cmake \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH_LFORTRAN;$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=`pwd`/inst \
-DCMAKE_INSTALL_LIBDIR=share/lfortran/lib \
+ -DWITH_TARGET_WASM=yes \
.
cmake --build . -j16 --target install
% lfortran examples/expr2.f90 --target=wasm32-unknown-emscripten
25
% ls | grep expr2
expr2.out
expr2.out.tmp.o
expr2.wasm
% node expr2.out
25
% rm expr2*
% lfortran examples/expr2.f90 --target=wasm32-unknown-emscripten --wasm-html
25
% ls | grep expr2
expr2.out.html
expr2.out.js
expr2.out.tmp.o
expr2.out.wasm
% node expr2.out.js
25
% python -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ...In browser, you can open |
Member
Author
|
Example from #3823 (comment) in browser looks as follows: |
certik
approved these changes
Apr 16, 2024
Contributor
certik
left a comment
There was a problem hiding this comment.
I think this looks good. Thanks!
Contributor
|
Is non-emscripten WASM still supported? |
Member
Author
The one from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


No description provided.