@@ -54,6 +54,56 @@ The built binary ``cvc5.exe`` is located in ``<build_dir>/bin`` and the cvc5
5454library can be found in ``<build_dir>/lib ``.
5555
5656
57+ WebAssembly Compilation
58+ ^^^^^^^^^^^^^^^^^^^^^^^^
59+
60+ Compiling cvc5 to WebAssembly needs the Emscripten SDK (version 3.1.18 or
61+ latter). Setting up emsdk can be done as follows:
62+
63+ .. code :: bash
64+
65+ git clone https://github.com/emscripten-core/emsdk.git
66+ cd emsdk
67+ ./emsdk install < version> # <version> = '3.1.18' is preferable, but
68+ # <version> = 'latest' has high chance of working
69+ ./emsdk activate < version>
70+ source ./emsdk_env.sh # Activate PATH and other environment variables in the
71+ # current terminal. Whenever Emscripten is going to be
72+ # used this command needs to be called before because
73+ # emsdk doesn't insert the binaries paths directly in
74+ # the system PATH variable.
75+
76+ Refer to the `emscripten dependencies list <https://emscripten.org/docs/getting_started/downloads.html#platform-specific-notes >`_
77+ to ensure that all required dependencies are installed on the system.
78+
79+ Then, in the cvc5 directory:
80+
81+ .. code :: bash
82+
83+ ./configure.sh --static --static-binary --auto-download --wasm=< value> --wasm-flags=' <emscripten flags>' < configure options...>
84+
85+ cd < build_dir> # default is ./build
86+ make # use -jN for parallel build with N threads
87+
88+ ``--wasm `` can take three values: ``WASM `` (will generate the wasm file for cvc5), ``JS ``
89+ (not only the wasm, but the .js glue code for web integration) and ``HTML `` (both
90+ the last two files and also an .html file which supports the run of the glue
91+ code).
92+
93+ ``--wasm-flags `` take a string wrapped by a single quote containing the
94+ `emscripten flags <https://github.com/emscripten-core/emscripten/blob/main/src/settings.js >`_,
95+ which modifies how the wasm and glue code are built and how they behave. An ``-s ``
96+ should precede each flag.
97+
98+ For example, to generate modularized glue code, use:
99+
100+ .. code :: bash
101+
102+ ./configure.sh --static --static-binary --auto-download --wasm=JS --wasm-flags=' -s MODULARIZE' --name=prod
103+
104+ cd prod
105+ make # use -jN for parallel build with N threads
106+
57107 Build dependencies
58108------------------
59109
0 commit comments