Jerry is now split to several components: core, libc, plugins.
The components are build independently and then are linked with main module corresponding to target platform. Core is supposed to be platform-independent, while libc and plugins are dependent on specific architecture / platform. The commit disables unit tests building and running during precommit. That is supposed to be fixed in a subsequent commit. Also, the commit disables building and running valgrind targets during precommit. Build is supposed to be turned on by an option that should be introduced later. Valgrind-checked runs are supposed to be performed in asynchronous mode.
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
# Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
project (JerryCore CXX C ASM)
|
||||
|
||||
# Definitions
|
||||
# Get version information from git
|
||||
execute_process(COMMAND git symbolic-ref -q HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE JERRY_GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND git rev-parse HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE JERRY_GIT_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
# Get build date
|
||||
execute_process(COMMAND date +%d/%m/%Y
|
||||
OUTPUT_VARIABLE JERRY_BUILD_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(DEFINES_JERRY
|
||||
JERRY_BUILD_DATE="${JERRY_BUILD_DATE}"
|
||||
JERRY_COMMIT_HASH="${JERRY_GIT_COMMIT}"
|
||||
JERRY_BRANCH_NAME="${JERRY_GIT_BRANCH}")
|
||||
|
||||
# Build modes
|
||||
# Debug
|
||||
set(DEFINES_JERRY_DEBUG JERRY_ENABLE_PRETTY_PRINTER)
|
||||
|
||||
# Release
|
||||
set(DEFINES_JERRY_RELEASE JERRY_NDEBUG)
|
||||
|
||||
# Modifiers
|
||||
# Full profile
|
||||
set(DEFINES_FULL_PROFILE CONFIG_ECMA_NUMBER_TYPE=CONFIG_ECMA_NUMBER_FLOAT64)
|
||||
|
||||
# Compact profile
|
||||
set(DEFINES_COMPACT_PROFILE
|
||||
CONFIG_ECMA_COMPACT_PROFILE)
|
||||
|
||||
# Minimal compact profile
|
||||
set(DEFINES_COMPACT_PROFILE_MINIMAL
|
||||
CONFIG_ECMA_COMPACT_PROFILE
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_DATE_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_JSON_BUILTIN
|
||||
CONFIG_ECMA_COMPACT_PROFILE_DISABLE_REGEXP_BUILTIN)
|
||||
|
||||
# Memory statistics
|
||||
set(DEFINES_JERRY_MEMORY_STATISTICS MEM_STATS)
|
||||
|
||||
# Valgrind
|
||||
set(DEFINES_JERRY_VALGRIND JERRY_VALGRIND)
|
||||
|
||||
# Platform-specific
|
||||
# Linux
|
||||
# MCU
|
||||
math(EXPR MEM_HEAP_AREA_SIZE_16K "16 * 1024")
|
||||
set(DEFINES_JERRY_MCU CONFIG_MEM_HEAP_AREA_SIZE=${MEM_HEAP_AREA_SIZE_16K})
|
||||
|
||||
# Include directories
|
||||
set(INCLUDE_CORE
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/mem
|
||||
${CMAKE_SOURCE_DIR}/src/vm
|
||||
${CMAKE_SOURCE_DIR}/src/ecma/builtin-objects
|
||||
${CMAKE_SOURCE_DIR}/src/ecma/base
|
||||
${CMAKE_SOURCE_DIR}/src/ecma/operations
|
||||
${CMAKE_SOURCE_DIR}/src/parser/collections
|
||||
${CMAKE_SOURCE_DIR}/src/parser/js
|
||||
${CMAKE_SOURCE_DIR}/src/jrt)
|
||||
|
||||
# Third-party
|
||||
# Valgrind
|
||||
set(INCLUDE_THIRD_PARTY_VALGRIND ${CMAKE_SOURCE_DIR}/third-party/valgrind)
|
||||
|
||||
# Sources
|
||||
# Jerry core
|
||||
file(GLOB SOURCE_CORE_MEM mem/*.cpp)
|
||||
file(GLOB SOURCE_CORE_VM vm/*.cpp)
|
||||
file(GLOB SOURCE_CORE_ECMA_BUILTINS ecma/builtin-objects/*.cpp)
|
||||
file(GLOB SOURCE_CORE_ECMA_BASE ecma/base/*.cpp)
|
||||
file(GLOB SOURCE_CORE_ECMA_OPERATIONS ecma/operations/*.cpp)
|
||||
file(GLOB SOURCE_CORE_PARSER_COLLECTIONS parser/collections/*.cpp)
|
||||
file(GLOB SOURCE_CORE_PARSER_JS parser/js/*.cpp)
|
||||
file(GLOB SOURCE_CORE_JRT jrt/*.cpp)
|
||||
|
||||
set(SOURCE_CORE
|
||||
jerry.cpp
|
||||
${SOURCE_CORE_MEM}
|
||||
${SOURCE_CORE_VM}
|
||||
${SOURCE_CORE_ECMA_BUILTINS}
|
||||
${SOURCE_CORE_ECMA_BASE}
|
||||
${SOURCE_CORE_ECMA_OPERATIONS}
|
||||
${SOURCE_CORE_PARSER_COLLECTIONS}
|
||||
${SOURCE_CORE_PARSER_JS}
|
||||
${SOURCE_CORE_JRT})
|
||||
|
||||
# Platform-specific configuration
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} ${DEFINES_JERRY_${PLATFORM}})
|
||||
|
||||
# Targets declaration
|
||||
function(declare_targets_for_build_mode BUILD_MODE)
|
||||
set(TARGET_NAME ${BUILD_MODE_PREFIX_${BUILD_MODE}})
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} ${DEFINES_JERRY_${BUILD_MODE}})
|
||||
|
||||
function(declare_target_with_modifiers ) # modifiers are passed in ARGN implicit argument
|
||||
foreach(MODIFIER ${ARGN})
|
||||
set(TARGET_NAME ${TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}})
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} ${DEFINES_${MODIFIER}})
|
||||
endforeach()
|
||||
|
||||
add_library(${TARGET_NAME}.jerry-core STATIC ${SOURCE_CORE})
|
||||
set_property(TARGET ${TARGET_NAME}.jerry-core
|
||||
PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_JERRY} ${CXX_FLAGS_JERRY} ${FLAGS_COMMON_${BUILD_MODE}}")
|
||||
target_compile_definitions(${TARGET_NAME}.jerry-core PRIVATE ${DEFINES_JERRY})
|
||||
target_include_directories(${TARGET_NAME}.jerry-core PRIVATE ${INCLUDE_CORE})
|
||||
endfunction()
|
||||
|
||||
foreach(MODIFIERS_LIST ${MODIFIERS_LISTS})
|
||||
separate_arguments(MODIFIERS_LIST)
|
||||
|
||||
declare_target_with_modifiers(${MODIFIERS_LIST})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
foreach(BUILD_MODE ${BUILD_MODES})
|
||||
declare_targets_for_build_mode(${BUILD_MODE})
|
||||
endforeach()
|
||||
Reference in New Issue
Block a user