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:
Akos Kiss
2021-01-11 13:07:40 +01:00
committed by GitHub
parent dcf9252892
commit fdaacde667
16 changed files with 224 additions and 305 deletions
+15 -39
View File
@@ -18,9 +18,6 @@ project (${JERRY_CORE_NAME} C)
include(CheckLibraryExists)
# Optional build settings
set(ENABLE_ALL_IN_ONE OFF CACHE BOOL "Enable all-in-one build?")
# Optional features
set(JERRY_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
set(JERRY_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?")
@@ -46,12 +43,6 @@ set(JERRY_STACK_LIMIT "(0)" CACHE STRING "Maximum stack usa
set(JERRY_GC_MARK_LIMIT "(8)" CACHE STRING "Maximum depth of recursion during GC mark phase")
# Option overrides
if(USING_MSVC)
set(ENABLE_ALL_IN_ONE ON) # FIXME: This should not be needed but right now it is. To be tracked down and followed up.
set(ENABLE_ALL_IN_ONE_MESSAGE " (FORCED BY COMPILER)")
endif()
if(JERRY_SYSTEM_ALLOCATOR)
set(JERRY_CPOINTER_32_BIT ON)
@@ -85,7 +76,6 @@ if(JERRY_MEM_STATS OR JERRY_PARSER_DUMP_BYTE_CODE OR JERRY_REGEXP_DUMP_BYTE_CODE
endif()
# Status messages
message(STATUS "ENABLE_ALL_IN_ONE " ${ENABLE_ALL_IN_ONE} ${ENABLE_ALL_IN_ONE_MESSAGE})
message(STATUS "JERRY_CPOINTER_32_BIT " ${JERRY_CPOINTER_32_BIT} ${JERRY_CPOINTER_32_BIT_MESSAGE})
message(STATUS "JERRY_DEBUGGER " ${JERRY_DEBUGGER})
message(STATUS "JERRY_ERROR_MESSAGES " ${JERRY_ERROR_MESSAGES})
@@ -147,55 +137,41 @@ file(GLOB SOURCE_CORE_FILES
parser/regexp/*.c
vm/*.c)
# All-in-one build
if(ENABLE_ALL_IN_ONE)
set(ALL_IN_FILE "${CMAKE_BINARY_DIR}/jerry-all-in.c")
list(SORT SOURCE_CORE_FILES)
file(REMOVE ${ALL_IN_FILE})
foreach(FILE ${SOURCE_CORE_FILES})
file(APPEND ${ALL_IN_FILE} "#include \"${FILE}\"\n")
endforeach()
set(SOURCE_CORE_FILES ${ALL_IN_FILE})
endif()
# "Single" JerryScript source/header build.
# Amalgamated JerryScript source/header build.
# The process will create the following files:
# * jerryscript.c
# * jerryscript.h
# * jerryscript-config.h
if(ENABLE_ALL_IN_ONE_SOURCE)
if(ENABLE_AMALGAM)
# Create single C/H file
file(GLOB HEADER_CORE_FILES *.h)
# Generated files
set(ALL_IN_FILE "${CMAKE_BINARY_DIR}/src/jerryscript.c")
set(ALL_IN_FILE_H "${CMAKE_BINARY_DIR}/src/jerryscript.h")
set(JERRYSCRIPT_CONFIG_H "${CMAKE_BINARY_DIR}/src/jerryscript-config.h")
set(AMALGAM_CORE_C "${CMAKE_BINARY_DIR}/amalgam/jerryscript.c")
set(AMALGAM_CORE_H "${CMAKE_BINARY_DIR}/amalgam/jerryscript.h")
set(AMALGAM_CONFIG_H "${CMAKE_BINARY_DIR}/amalgam/jerryscript-config.h")
add_custom_command(OUTPUT ${ALL_IN_FILE} ${ALL_IN_FILE_H}
COMMAND python ${CMAKE_SOURCE_DIR}/tools/srcgenerator.py
add_custom_command(OUTPUT ${AMALGAM_CORE_C} ${AMALGAM_CORE_H}
COMMAND python ${CMAKE_SOURCE_DIR}/tools/amalgam.py
--jerry-core
--output-dir ${CMAKE_BINARY_DIR}/src
--output-dir ${CMAKE_BINARY_DIR}/amalgam
DEPENDS ${SOURCE_CORE_FILES}
${HEADER_CORE_FILES}
${CMAKE_SOURCE_DIR}/tools/srcgenerator.py
${CMAKE_SOURCE_DIR}/tools/srcmerger.py
${CMAKE_SOURCE_DIR}/tools/amalgam.py
)
# The "true" jerryscript-config.h will be generated by the configure_file below,
# which contains the default options and the ones passed for the CMake.
# The input for this is the jerryscript-config.h generated by the command above.
set(JERRYSCRIPT_GEN_CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/jerryscript-config.h)
add_custom_command(OUTPUT ${JERRYSCRIPT_CONFIG_H}
COMMAND ${CMAKE_COMMAND} -E copy ${JERRYSCRIPT_GEN_CONFIG_H} ${JERRYSCRIPT_CONFIG_H}
DEPENDS ${ALL_IN_FILE_C} ${ALL_IN_FILE_H})
add_custom_target(generate-single-source-jerry DEPENDS ${ALL_IN_FILE} ${ALL_IN_FILE_H})
add_dependencies(generate-single-source generate-single-source-jerry)
add_custom_command(OUTPUT ${AMALGAM_CONFIG_H}
COMMAND ${CMAKE_COMMAND} -E copy ${JERRYSCRIPT_GEN_CONFIG_H} ${AMALGAM_CONFIG_H}
DEPENDS ${AMALGAM_CORE_C} ${AMALGAM_CORE_H})
add_custom_target(amalgam-jerry DEPENDS ${AMALGAM_CORE_C} ${AMALGAM_CORE_H} ${AMALGAM_CONFIG_H})
add_dependencies(amalgam amalgam-jerry)
set(SOURCE_CORE_FILES ${ALL_IN_FILE} ${ALL_IN_FILE_H} ${JERRYSCRIPT_CONFIG_H})
set(SOURCE_CORE_FILES ${AMALGAM_CORE_C} ${AMALGAM_CORE_H} ${AMALGAM_CONFIG_H})
endif()
# Third-party