Officially introduce amalgamated builds (#4416)
Remove redundancy between all-in-one and all-in-one-source builds by keeping only the second, and adopt the more established term "amalgamated" build for it. This change includes the following: - Replace `ENABLE_ALL_IN_ONE` and `ENABLE_ALL_IN_ONE_SOURCE` cmake options with `ENABLE_AMALGAM` top-level option. - Replace `--all-in-one` option of `build.py` helper with `--amalgam`. - Merge the `srcmerger.py` and `srcgenerator.py` tool scripts into `amalgam.py` (with improvements). - Update documentation. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
+21
-16
@@ -5,16 +5,19 @@ A configuration option's value can be changed either by providing specific C pre
|
||||
This document lists the available configuration options, shows the configuration name for C, CMake, and python, and provides a brief description that explains the effect of the options.
|
||||
|
||||
|
||||
### All-in-one build
|
||||
### Amalgamated build
|
||||
|
||||
Enables the All-in-one build process, which aggregates the contents of each source file, and uses this combined file to compile the JerryScript library.
|
||||
This process can provide comparable results to link time optimization, and can be useful when LTO is not available otherwise.
|
||||
Enables the amalgamated build process, which aggregates the contents of each source file per library
|
||||
(i.e., JerryScript's core, port, and math libraries), and uses these combined files to compile the project.
|
||||
This process can provide comparable results to link-time optimization, and can be useful when LTO is not available otherwise.
|
||||
|
||||
| Options | |
|
||||
|---------|----------------------------------------------|
|
||||
| C: | `<none>` |
|
||||
| CMake: | `-DENABLE_ALL_IN_ONE=ON/OFF` |
|
||||
| Python: | `--all-in-one=ON/OFF` |
|
||||
| CMake: | `-DENABLE_AMALGAM=ON/OFF` |
|
||||
| Python: | `--amalgam=ON/OFF` |
|
||||
|
||||
See also: [Amalgamated sources](#amalgamated-sources)
|
||||
|
||||
### Jerry debugger
|
||||
|
||||
@@ -278,18 +281,20 @@ This option is disabled by default.
|
||||
| Python: | `--mem-stress-test=ON/OFF` |
|
||||
|
||||
|
||||
# Single source build mode
|
||||
# Amalgamated sources
|
||||
|
||||
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):
|
||||
The sources of JerryScript can be combined into a handful of files to allow their easy integration
|
||||
in other projects. To achieve this, the following command can be executed to create a set of files
|
||||
into the `amalgam` directory:
|
||||
|
||||
```sh
|
||||
$ python tools/srcgenerator.py --output-dir gen_src --jerry-core --jerry-port-default --jerry-math
|
||||
$ python tools/amalgam.py --output-dir amalgam --jerry-core --jerry-port-default --jerry-math
|
||||
```
|
||||
|
||||
The command creates the following files in the `gen_src` dir:
|
||||
(Note: In the example above, the command is executed from the project's root directory, but that is
|
||||
not mandatory.)
|
||||
|
||||
The command creates the following files in the `amalgam` dir:
|
||||
|
||||
* `jerryscript.c`
|
||||
* `jerryscript.h`
|
||||
@@ -304,15 +309,15 @@ should be adapted to the required use-case. See the file contents for more detai
|
||||
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:
|
||||
E.g., using a command similar to the one below:
|
||||
|
||||
```sh
|
||||
$ gcc -Wall -o demo_app demo_app.c gen_src/jerryscript.c gen_src/jerryscript-port-default.c jerryscript-math.c -Igen_src/
|
||||
$ gcc -Wall -o demo_app demo_app.c amalgam/jerryscript.c amalgam/jerryscript-port-default.c amalgam/jerryscript-math.c -Iamalgam/
|
||||
```
|
||||
|
||||
Please note that the headers must be available on the include path.
|
||||
(Note: 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.
|
||||
This approach is also under the hood of the [amalgamated build](#amalgamated-build) process.
|
||||
|
||||
# Target specific information
|
||||
|
||||
|
||||
Reference in New Issue
Block a user