19 lines
715 B
Python
19 lines
715 B
Python
|
|
import argparse
|
|
from .common import exec_spp, get_config_cache, require_project_file
|
|
|
|
def _cmd(args: argparse.Namespace) -> None:
|
|
require_project_file()
|
|
|
|
build_type = args.build_type
|
|
if build_type == 'auto':
|
|
cache = get_config_cache()
|
|
build_type = cache.get('build_type', 'debug')
|
|
|
|
exec_spp((f'--build_type={build_type}', '--unity=disable', 'compile_commands.json'))
|
|
|
|
def make_ccjson_parser(subparsers) -> None:
|
|
parser : argparse.ArgumentParser = subparsers.add_parser('ccjson', help='Generate compile_commands.json')
|
|
parser.set_defaults(handler=_cmd)
|
|
parser.add_argument('--build_type', choices=('auto', 'debug', 'release_debug', 'release', 'profile'), default='auto')
|