Modify the profile option to specify external compile definitions. (#1497)

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2017-01-02 10:47:50 +01:00
committed by László Langó
parent 080e78d7c2
commit 392f6d4a3b
7 changed files with 81 additions and 26 deletions
+12 -23
View File
@@ -23,7 +23,7 @@ set(FEATURE_JS_PARSER ON CACHE BOOL "Enable js-parser?")
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
set(FEATURE_MEM_STRESS_TEST OFF CACHE BOOL "Enable mem-stress test?")
set(FEATURE_PARSER_DUMP OFF CACHE BOOL "Enable parser byte-code dumps?")
set(FEATURE_PROFILE "es5.1" CACHE STRING "Profile types: es5.1, minimal, es2015-subset")
set(FEATURE_PROFILE "es5.1" CACHE STRING "Use default or other profile?")
set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?")
set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?")
set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?")
@@ -163,28 +163,17 @@ if(FEATURE_PARSER_DUMP)
set(DEFINES_JERRY ${DEFINES_JERRY} PARSER_DUMP_BYTE_CODE)
endif()
# Profile modes
set(CONFIG_DISABLE_ES2015
CONFIG_DISABLE_ARRAYBUFFER_BUILTIN)
# Minimal profile
if(FEATURE_PROFILE STREQUAL "minimal")
set(DEFINES_JERRY ${DEFINES_JERRY}
${CONFIG_DISABLE_ES2015}
CONFIG_DISABLE_ANNEXB_BUILTIN
CONFIG_DISABLE_ARRAY_BUILTIN
CONFIG_DISABLE_BOOLEAN_BUILTIN
CONFIG_DISABLE_DATE_BUILTIN
CONFIG_DISABLE_ERROR_BUILTINS
CONFIG_DISABLE_JSON_BUILTIN
CONFIG_DISABLE_MATH_BUILTIN
CONFIG_DISABLE_NUMBER_BUILTIN
CONFIG_DISABLE_REGEXP_BUILTIN
CONFIG_DISABLE_STRING_BUILTIN)
elseif(FEATURE_PROFILE STREQUAL "es5.1")
set(DEFINES_JERRY ${DEFINES_JERRY}
${CONFIG_DISABLE_ES2015})
elseif(NOT FEATURE_PROFILE STREQUAL "es2015-subset")
message(FATAL_ERROR "FEATURE_PROFILE='${FEATURE_PROFILE}' isn't supported")
if (NOT IS_ABSOLUTE ${FEATURE_PROFILE})
set(FEATURE_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/profiles/${FEATURE_PROFILE}.profile")
endif()
if(EXISTS ${FEATURE_PROFILE})
FILE(READ "${FEATURE_PROFILE}" PROFILE_SETTINGS)
STRING(REGEX REPLACE "^#.*$" "" PROFILE_SETTINGS "${PROFILE_SETTINGS}")
STRING(REGEX REPLACE "[\r|\n]" ";" PROFILE_SETTINGS "${PROFILE_SETTINGS}")
set(DEFINES_JERRY ${DEFINES_JERRY} ${PROFILE_SETTINGS})
else()
MESSAGE(FATAL_ERROR "Profile file: '${FEATURE_PROFILE}' doesn't exist!")
endif()
# RegExp byte-code dumps
+39
View File
@@ -0,0 +1,39 @@
### About profile files
Specify compile definitions in profile files to use when compiling the `jerry-core` target.
The default profile is ``es5.1`` which disables the ArrayBuffer built-in.
### Using profiles with the build system
You can specify the profile for the build system in the following ways:
* with absolute path
* with a name (this options selects profiles/$(name).profile file)
#### Restrictions
Only single line options are allowed in the profile file. Any line starting with hash-mark is ignored. Semicolon character is not allowed.
### Example usage:
#### 1. Using the build script
```
# assuming you are in jerryscript folder
./tools/build.py --profile=/absolute/path/to/my_profile.any_extension
```
or
```
# assuming you are in jerryscript folder
./tools/build.py --profile=minimal
```
This command selects the profile/minimal.profile file.
#### 2. Using only CMake build system
Set FEATURE_PROFILE option to one of the following values:
* the profile with absolute path
* name of the profile (which needs to exist in the `profiles` folder)
@@ -0,0 +1 @@
# Currently an empty profile.
+1
View File
@@ -0,0 +1 @@
CONFIG_DISABLE_ARRAYBUFFER_BUILTIN
+11
View File
@@ -0,0 +1,11 @@
CONFIG_DISABLE_ARRAYBUFFER_BUILTIN
CONFIG_DISABLE_ANNEXB_BUILTIN
CONFIG_DISABLE_ARRAY_BUILTIN
CONFIG_DISABLE_BOOLEAN_BUILTIN
CONFIG_DISABLE_DATE_BUILTIN
CONFIG_DISABLE_ERROR_BUILTINS
CONFIG_DISABLE_JSON_BUILTIN
CONFIG_DISABLE_MATH_BUILTIN
CONFIG_DISABLE_NUMBER_BUILTIN
CONFIG_DISABLE_REGEXP_BUILTIN
CONFIG_DISABLE_STRING_BUILTIN