Enable generating compile_commands.json (#4417)

This feature is useful for intellisense users.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2021-01-08 16:00:17 +01:00
committed by GitHub
parent f50728ef8d
commit 0e829cc41a
2 changed files with 10 additions and 2 deletions
+7 -2
View File
@@ -16,11 +16,13 @@ cmake_minimum_required (VERSION 2.8.12)
project (jerry-main C)
# Optional build settings
set(ENABLE_LINK_MAP OFF CACHE BOOL "Enable generating a link map file?")
set(JERRY_TEST_STACK_MEASURE OFF CACHE BOOL "Enable stack measurement for the jerry-test binary?")
set(ENABLE_LINK_MAP OFF CACHE BOOL "Enable generating a link map file?")
set(ENABLE_COMPILE_COMMANDS ON CACHE BOOL "Enable generating compile_commands.json?")
set(JERRY_TEST_STACK_MEASURE OFF CACHE BOOL "Enable stack measurement for the jerry-test binary?")
# Status messages
message(STATUS "ENABLE_LINK_MAP " ${ENABLE_LINK_MAP})
message(STATUS "ENABLE_COMPILE_COMMANDS " ${ENABLE_COMPILE_COMMANDS})
message(STATUS "JERRY_TEST_STACK_MEASURE " ${JERRY_TEST_STACK_MEASURE})
# Generate map file
@@ -32,6 +34,9 @@ if(ENABLE_LINK_MAP)
endif()
endif()
# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ${ENABLE_COMPILE_COMMANDS})
# Get version information from git
if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND git rev-parse --short HEAD
+3
View File
@@ -156,6 +156,8 @@ def get_arguments():
maingrp = parser.add_argument_group('jerry-main options')
maingrp.add_argument('--link-map', metavar='X', choices=['ON', 'OFF'], type=str.upper,
help=devhelp('enable the generation of link map for jerry command line tool (%(choices)s)'))
maingrp.add_argument('--compile-commands', metavar='X', choices=['ON', 'OFF'], type=str.upper,
help=devhelp('enable the generation of compile_commands.json (%(choices)s)'))
arguments = parser.parse_args(args)
if arguments.devhelp:
@@ -222,6 +224,7 @@ def generate_build_options(arguments):
# jerry-main options
build_options_append('ENABLE_LINK_MAP', arguments.link_map)
build_options_append('ENABLE_COMPILE_COMMANDS', arguments.compile_commands)
# general build options (final step)
if arguments.cmake_param: