Skip to content

Conversation

@galpeter
Copy link
Contributor

@galpeter galpeter commented Mar 5, 2019

Introduce a new way of building: before any file is compiled
all source files are combined into a single C file and all
header files into a single H file (per subdir).

This new approach makes it possible to quickly integrate JerryScript
into other projects:

$ gcc -o demo demo.c jerryscript.c jerryscript-port-default.c -lm

To use the source generator run:

$ cmake -Bbuild_dir -H. -DENABLE_ALL_IN_ONE_SOURCE=ON
$ make -C build_dir generate-single-source

This will create the following files in the build_dir:

  • jerryscript.c
  • jerryscript.h
  • jerryscript-config.h
  • jerryscript-port-default.c
  • jerryscript-port-default.h

@galpeter
Copy link
Contributor Author

galpeter commented Mar 5, 2019

This PR currently depends on the #2789 PR. (That commit is also included in this PR)

@galpeter galpeter force-pushed the source_merger branch 2 times, most recently from c897762 to 33e89a5 Compare March 7, 2019 16:52
Copy link
Member

@zherczeg zherczeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this feature should be included in the tools/build.py as well. The documentation is also missing and this feature should be mentioned in the "Getting Started" guide (docs/01.GETTING-STARTED.md ). The code looks good, nice improvement.

set(JERRYSCRIPT_SOURCE_CONFIG_H "${CMAKE_CURRENT_SOURCE_DIR}/config.h")
add_custom_command(OUTPUT ${JERRYSCRIPT_CONFIG_H}
COMMAND ${CMAKE_COMMAND} -E copy ${JERRYSCRIPT_SOURCE_CONFIG_H} ${JERRYSCRIPT_CONFIG_H}
DEPENDS ${JERRYSCRIPT_SOURCE_CONFIG_H})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is misaligned

@galpeter
Copy link
Contributor Author

@LaszloLango I would not add the docs yet, as the jerryscript-config.h usage and generation is not finalized at this moment. That would be another PR to make it stable. If I include that here then it would be too big imho.

@LaszloLango
Copy link
Contributor

@galpeter follow up PR is good for me.

Introduce a new way of building: before any file is compiled
all source files are combined into a single C file and all
header files into a single H file (per subdir).

This new approach makes it possible to quickly integrate JerryScript
into other projects:

```
$ gcc -o demo demo.c jerryscript.c jerryscript-port-default.c -lm
```

To use the source generator run:
```
$ cmake -Bbuild_dir -H. -DENABLE_ALL_IN_ONE_SOURCE=ON
$ make -C build_dir generate-single-source
```

This will create the following files in the `build_dir`:
* jerryscript.c
* jerryscript.h
* jerryscript-config.h
* jerryscript-port-default.c
* jerryscript-port-default.h

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
@galpeter
Copy link
Contributor Author

@LaszloLango I've fixed the alignment problem and rebased to master.

Copy link
Contributor

@LaszloLango LaszloLango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@rerobika rerobika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rerobika rerobika merged commit 3f6599c into jerryscript-project:master Apr 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants