From f6696247b7a91c2092e538946bfdc4183e1bb133 Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Wed, 20 Jan 2021 23:58:38 +0200 Subject: [PATCH] Add docs on how to build using a compiler directly --- docs/Development.md | 19 +++++++++++++++++++ source/m3_config_platforms.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/docs/Development.md b/docs/Development.md index 248c6e2..b5cce38 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -89,6 +89,25 @@ cmake -GNinja .. ninja ``` +## Build using compiler directly + +This can be useful for cross-compilation, quick builds or when a build system (CMake, Ninja, etc.) is not available. + +### gcc/clang +```sh +gcc -O3 -g0 -s -Isource -Dd_m3HasWASI source/*.c platforms/app/main.c -lm -o wasm3 +``` + +### msvc/clang-cl +```sh +cl source/*.c platforms/app/main.c /Isource /MD /Ox /Oy /Gw /GS- /W0 /Dd_m3HasWASI /Fewasm3.exe /link advapi32.lib +``` + +### mingw-w64 +```sh +x86_64-w64-mingw32-gcc -O3 -g0 -s -Isource -Dd_m3HasWASI source/*.c platforms/app/main.c -lm -lpthread -static -o wasm3.exe +``` + ## Build for microcontrollers In `./platforms/` folder you can find projects for different targets. Some of them are using Platformio, so you can follow the regular pio build process. Others have custom instructions in respective `README.md` files. diff --git a/source/m3_config_platforms.h b/source/m3_config_platforms.h index d212ce2..a649d05 100644 --- a/source/m3_config_platforms.h +++ b/source/m3_config_platforms.h @@ -353,6 +353,8 @@ typedef int8_t i8; # if defined (M3_COMPILER_MSVC) # define vectorcall // For MSVC, better not to specify any call convention +# elif defined(__MINGW32__) +# define vectorcall # elif defined(WIN32) # define vectorcall __vectorcall # elif defined (ESP8266)