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:
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user