Skip to content

[master < T0792-MG] Add wasm compilation target to mgclient#35

Merged
kostasrim merged 18 commits into
masterfrom
T0792-MG-add-wasm-compilation-target-to-mgclient
Mar 16, 2022
Merged

[master < T0792-MG] Add wasm compilation target to mgclient#35
kostasrim merged 18 commits into
masterfrom
T0792-MG-add-wasm-compilation-target-to-mgclient

Conversation

@kostasrim

Copy link
Copy Markdown
Contributor

No description provided.

@gitbuda

gitbuda commented Jan 19, 2022

Copy link
Copy Markdown
Member

🎉💪

Comment thread src/linux/mgsocket.c Outdated
socklen_t addrlen) {
long status = MG_RETRY_ON_EINTR(connect(sock, addr, addrlen));
if (status == -1L) {
if (status == -1L && errno != EINPROGRESS) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this only for __EMSCRIPTEN__

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would either introduce a function to check the status and it would be defined differently based on EMSCRIPTEN is used or not, or put a comment about this to the source.

Comment thread src/linux/mgsocket.c Outdated
@kostasrim kostasrim force-pushed the T0792-MG-add-wasm-compilation-target-to-mgclient branch from f2ef513 to c4746ab Compare January 19, 2022 13:28
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread CMakeLists.txt
Comment thread src/CMakeLists.txt Outdated
endif()

generate_export_header(mgclient-shared
generate_export_header(mgclient-static

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changed? We have to be careful with these things because maybe other clients depend on precisely this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will have it static only for emcripten builds ;)

@gitbuda gitbuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the compilation of webasm is only possible on Linux for now, I think we should implement a bash script to install the SDK (and all related deps) + do the actual compilation. In addition, the GHA setup has to be extended with that workload/job. Once all that is in place, the same code could be used inside jsmgclient to build the actual package (or any other dependent client).

Comment thread README.md Outdated
@kostasrim kostasrim force-pushed the T0792-MG-add-wasm-compilation-target-to-mgclient branch from ef84091 to cf3110d Compare March 8, 2022 20:05
@kostasrim kostasrim marked this pull request as ready for review March 8, 2022 21:18
@kostasrim kostasrim requested a review from gitbuda March 8, 2022 21:18
@kostasrim kostasrim self-assigned this Mar 8, 2022
Comment thread src/mgclient.c Outdated
@gitbuda

gitbuda commented Mar 9, 2022

Copy link
Copy Markdown
Member

Add CI job to run WASM build 😄

The hard-coded paths in the WASM scripts are not great. You can use the following

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"

to make the script independent of where it is run and then create a bin folder (git ignore it) to compile stuff inside it.

Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread include/mgclient.h Outdated
Comment thread src/mgtransport.c Outdated
Comment thread src/mgtransport.h Outdated
Comment thread src/mgwasm.h Outdated
Comment thread src/mgwasm.h Outdated
Comment thread wasm/install_deps.sh Outdated
Comment thread CMakeLists.txt Outdated
Comment thread wasm/install_deps.sh Outdated
Comment thread src/mgclient.c
Comment thread src/mgtransport.c Outdated
Comment thread src/mgwasm.c Outdated
Comment thread src/mgwasm.c Outdated
@kostasrim kostasrim force-pushed the T0792-MG-add-wasm-compilation-target-to-mgclient branch 9 times, most recently from 3a66b15 to ffd0fd2 Compare March 10, 2022 12:38
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml

@jbajic jbajic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just small comments, but otherwise fine from my side.

Comment thread src/mgwasm.c Outdated
Comment thread src/mgwasm.c
Comment thread src/mgwasm.c Outdated
Comment thread src/mgtransport.h
Comment thread src/mgwasm.h Outdated

@antaljanosbenjamin antaljanosbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes contain a lot if improvements, however I think this PR still needs a few changes. In my mind the goal is to reduce the usage of ifdef in files:

  1. mgwasm.h doesn't need to be protected with ifdefs
  2. mg_transport_yield_until_async_xxx functions should be usable in not WASM builds, so there is no need to ifdef them out.

For the second point I think we still miss a level of indirection as I mentioned in my comments.

Comment thread src/mgtransport.h Outdated
Comment thread src/mgclient.c Outdated
Comment thread src/mgwasm.h Outdated
Comment thread src/mgclient.c

@antaljanosbenjamin antaljanosbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small changes!

Comment thread README.md Outdated
Comment thread .github/workflows/ci.yml
Comment thread .gitignore Outdated
Comment thread src/mgsession.c Outdated
Comment thread src/mgtransport.c
@kostasrim kostasrim force-pushed the T0792-MG-add-wasm-compilation-target-to-mgclient branch from 3c8a928 to 885f4ff Compare March 15, 2022 15:18

@antaljanosbenjamin antaljanosbenjamin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gitbuda gitbuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀:ship:

@kostasrim kostasrim changed the title [E104-MG < T0792-MG] Add wasm compilation target to mgclient [master < T0792-MG] Add wasm compilation target to mgclient Mar 16, 2022
@kostasrim kostasrim merged commit 6bd4891 into master Mar 16, 2022
@kostasrim kostasrim deleted the T0792-MG-add-wasm-compilation-target-to-mgclient branch March 16, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants