Configuring the build step

We need to modify the default build step in the /.vscode/tasks.json file to accommodate our updated workflow. The arguments for the build step we used in our /book-examples project allowed us to compile whichever file was currently active in the editor. It also output the .wasm file into the same folder as the source C file. However, this configuration doesn't make sense for this project. We'll always compile the same C file that is output to the compiled .wasm file in a specific folder. To accomplish this, update the args array in the Build task in /.vscode/tasks.json with the following contents:

"args": [
"${workspaceFolder}/lib/main.c",
"-Os",
"-s", "WASM=1",
"-s", "SIDE_MODULE=1",
"-s", "BINARYEN_ASYNC_COMPILATION=0",
"-o", "${workspaceFolder}/src/assets/main.wasm"
],

We changed the input and output paths, which are the first and last elements in the args array. Now both are static paths that always compile and output the same files regardless of which file is open in the active editor.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset