Document and improve the single-source generation (#2986)
Changes done: * Added usage/configuration info for this mode. * Created `tools/srcgenerator.py` to allow source/header generation without using CMake. * Adapted CMake to use the `srcgenerator.py` script. * Added jerry-libm single-source build. * Improved the `srcmerger.py` script to correctly handle the line numbering. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Robert Fancsik
parent
7685afddf9
commit
50be3a5384
@@ -250,3 +250,40 @@ This option is disabled by default.
|
||||
| C: | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=0/1` |
|
||||
| CMake: | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=ON/OFF` |
|
||||
| Python: | `--mem-stress-test=ON/OFF` |
|
||||
|
||||
|
||||
# Single source build mode
|
||||
|
||||
There is a special mode to use/"build" JerryScript. That is generating a single C file which can be
|
||||
included into projects quickly. To achive this the following command can be executed to create
|
||||
a set of files into the `gen_src` directory (Note that the command is executed in the jerryscript root directory
|
||||
but can be adapted to run outside of the project root dir):
|
||||
|
||||
```sh
|
||||
$ python tools/srcgenerator.py --output-dir gen_src --jerry-core --jerry-port-default --jerry-libm
|
||||
```
|
||||
|
||||
The command creates the following files in the `gen_src` dir:
|
||||
|
||||
* `jerryscript.c`
|
||||
* `jerryscript.h`
|
||||
* `jerryscript-config.h`
|
||||
* `jerryscript-port-default.c`
|
||||
* `jerryscript-port-default.h`
|
||||
* `jerryscript-libm.c`
|
||||
* `math.h`
|
||||
|
||||
**Important**: the `jerryscript-config.h` contains the configurations mentioned above and
|
||||
should be adapted to the required use-case. See the file contents for more details and for the
|
||||
default configuration. (Note: This config file is created from the the `jerry-core/config.h` file.)
|
||||
|
||||
These files can be directly compiled with an application using the JerryScript API.
|
||||
For example with the following command:
|
||||
|
||||
```sh
|
||||
$ gcc -Wall -o demo_app demo_app.c gen_src/jerryscript.c gen_src/jerryscript-port-default.c jerryscript-libm.c -Igen_src/
|
||||
```
|
||||
|
||||
Please note that the headers must be available on the include path.
|
||||
|
||||
In addition there is a `-DENABLE_ALL_IN_ONE_SOURCE=ON` CMake option to use this kind of sources during the build.
|
||||
|
||||
Reference in New Issue
Block a user