Emscripten in VS2017

677 views
Skip to first unread message

James Hardaker

unread,
Sep 26, 2017, 10:26:40 AM9/26/17
to emscripten-discuss
Hi,
As I understand this is not officially supported.
I've only been playing around for a few days - I set up a batch file to build my projects

echo on
echo initializing emsdk

CALL C:\WebAssembly\emsdk-portable-64bit\emsdk_env.bat

setlocal
for %%a in (*.cpp) do call set "files=%%files%% %%a" echo %%a

echo starting %3 build
CALL emcc --bind %files% -std=c++14 -s WASM=1 -O3 -o %3.bc -s USE_WEBGL2=1 -s ASSERTIONS=1 -s NO_EXIT_RUNTIME=1

endlocal

echo move %1\%3.bc to %2\bc\%3.bc

move /Y %1\%3.bc %2\bc\%3.bc

echo completed %3 build

It builds to *.bc and drops them in the main web project.
Then a similar but different batch file builds those bc's to a *.wasm + *.js file.

I also select the latest clang environment from the project general settings and build to a *.lib.

Clang integration builds successfully and my batch file runs post build.
Clang catches most of my code problems at regular build time and my batch output catches the rest. 
Its not painful at all.

Does anyone else have any other solutions worth mentioning?
What do you think of my system?

Regards
James

Jukka Jylänki

unread,
Oct 2, 2017, 4:21:44 PM10/2/17
to emscripte...@googlegroups.com
I wholeheartedly recommend using CMake for this type of batch build
tasks, since it enables having to write only one project definition
file, and generating both Visual Studio solution (for any VS version)
and Emscripten MinGW Makefiles out of it. That way you can generate a
VS2017 project to use as an IDE, and then run "mingw32-make -j" on the
command line to build to Emscripten.

CMake is very widely used, and as a result it has the benefit that one
can just google solutions to nearly any CMake-related problem, as
opposed to e.g. being restricted to being at the mercy of official
project documentation pages only.
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to emscripten-disc...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages