Skip to content

Commit

Permalink
Rework command line handling of build tool
Browse files Browse the repository at this point in the history
In `tools/build.py`:
- For the sake of readability, group CLI arguments as general build
  options, options to control the building of components, and
  component-specific options.
- To prevent duplications, remove the defaults from those CLI
  arguments that correspond to CMake options and have defaults in
  any of the CMakeLists. Should any of the defaults change, they
  will have to be changed at a single place only. (Those options
  that are not set on the command line of `tools/build.py` are not
  passed as options to `cmake` either.)
- Convert `--unittests` and `--doctests` to ON/OFF options like the
  rest of the component switches.
- Touch on some of the help messages of the CLI arguments.

Other changes:
- The change in `--unittests` and `--doctests` is a slightly CLI-
  breaking change of `tools/build.py`. Thus, follow up on this in
  `tools/run-tests.py`.
- Move `ENABLE_ALL_IN_ONE` into `jerry-core` as it is not a general
  option but specific to that component.
- Remove the forcing of `ENABLE_ALL_IN_ONE` for some compilers/
  platforms as it is still an option, not a hard requirement.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
  • Loading branch information
akosthekiss committed Jun 5, 2018
1 parent 8b8bced commit 845d3f2
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 150 deletions.
6 changes: 0 additions & 6 deletions CMakeLists.txt
Expand Up @@ -54,7 +54,6 @@ set(DOCTESTS OFF CACHE BOOL "Build doc tests?")

# Optional build settings
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries?")
set(ENABLE_ALL_IN_ONE OFF CACHE BOOL "Enable all-in-one build?")
set(ENABLE_LTO ON CACHE BOOL "Enable LTO build?")
set(ENABLE_STRIP ON CACHE BOOL "Enable stripping all symbols from release binary?")

Expand All @@ -77,13 +76,11 @@ endif()
if("${PLATFORM}" STREQUAL "DARWIN")
set(JERRY_LIBC OFF)
set(JERRY_LIBM OFF)
set(ENABLE_ALL_IN_ONE ON)
set(ENABLE_LTO OFF)
set(ENABLE_STRIP OFF)

set(JERRY_LIBC_MESSAGE " (FORCED BY PLATFORM)")
set(JERRY_LIBM_MESSAGE " (FORCED BY PLATFORM)")
set(ENABLE_ALL_IN_ONE_MESSAGE " (FORCED BY PLATFORM)")
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
set(ENABLE_STRIP_MESSAGE " (FORCED BY PLATFORM)")
endif()
Expand All @@ -97,12 +94,10 @@ endif()
if(USING_MSVC)
set(JERRY_LIBC OFF)
set(JERRY_LIBM OFF)
set(ENABLE_ALL_IN_ONE ON)
set(ENABLE_STRIP OFF)

set(JERRY_LIBC_MESSAGE " (FORCED BY COMPILER)")
set(JERRY_LIBM_MESSAGE " (FORCED BY COMPILER)")
set(ENABLE_ALL_IN_ONE_MESSAGE " (FORCED BY COMPILER)")
set(ENABLE_STRIP_MESSAGE " (FORCED BY COMPILER)")
endif()

Expand All @@ -112,7 +107,6 @@ message(STATUS "CMAKE_C_COMPILER_ID " ${CMAKE_C_COMPILER_ID})
message(STATUS "CMAKE_SYSTEM_NAME " ${CMAKE_SYSTEM_NAME})
message(STATUS "CMAKE_SYSTEM_PROCESSOR " ${CMAKE_SYSTEM_PROCESSOR})
message(STATUS "BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
message(STATUS "ENABLE_ALL_IN_ONE " ${ENABLE_ALL_IN_ONE} ${ENABLE_ALL_IN_ONE_MESSAGE})
message(STATUS "ENABLE_LTO " ${ENABLE_LTO} ${ENABLE_LTO_MESSAGE})
message(STATUS "ENABLE_STRIP " ${ENABLE_STRIP} ${ENABLE_STRIP_MESSAGE})
message(STATUS "JERRY_CMDLINE " ${JERRY_CMDLINE})
Expand Down
10 changes: 10 additions & 0 deletions jerry-core/CMakeLists.txt
Expand Up @@ -16,6 +16,9 @@ cmake_minimum_required (VERSION 2.8.12)
set(JERRY_CORE_NAME jerry-core)
project (${JERRY_CORE_NAME} C)

# Optional build settings
set(ENABLE_ALL_IN_ONE OFF CACHE BOOL "Enable all-in-one build?")

# Optional features
set(FEATURE_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
set(FEATURE_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?")
Expand All @@ -37,6 +40,12 @@ set(FEATURE_VM_EXEC_STOP OFF CACHE BOOL "Enable VM execution stoppin
set(MEM_HEAP_SIZE_KB "512" CACHE STRING "Size of memory heap, in kilobytes")

# 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(FEATURE_SYSTEM_ALLOCATOR)
set(FEATURE_CPOINTER_32_BIT ON)

Expand All @@ -58,6 +67,7 @@ if(JERRY_CMDLINE_SNAPSHOT)
endif()

# Status messages
message(STATUS "ENABLE_ALL_IN_ONE " ${ENABLE_ALL_IN_ONE} ${ENABLE_ALL_IN_ONE_MESSAGE})
message(STATUS "FEATURE_CPOINTER_32_BIT " ${FEATURE_CPOINTER_32_BIT} ${FEATURE_CPOINTER_32_BIT_MESSAGE})
message(STATUS "FEATURE_DEBUGGER " ${FEATURE_DEBUGGER})
message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
Expand Down

0 comments on commit 845d3f2

Please sign in to comment.