aboutsummaryrefslogtreecommitdiff
path: root/src_doit/c.py
blob: 8318d108a145fcd69b270616c8da54586621f413 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from pathlib import Path

from hat.doit.c import (exe_suffix,
                        CBuild)


__all__ = ['task_c',
           'task_c_obj',
           'task_c_dep']


build_dir = Path('build')
src_c_dir = Path('src_c')
deps_dir = Path('deps')

build_c_dir = build_dir / 'c'
exe_path = build_c_dir / f'opcut-calculate{exe_suffix}'


def task_c():
    """Build native app"""
    return _build.get_task_exe(exe_path)


def task_c_obj():
    """Build .o files"""
    yield from _build.get_task_objs()


def task_c_dep():
    """Build .d files"""
    yield from _build.get_task_deps()


_build = CBuild(
    src_paths=[*src_c_dir.rglob('*.c'),
               *(deps_dir / 'argparse').rglob('*.c')],
    build_dir=build_c_dir,
    cc_flags=['-fPIC', '-O2',
              f'-I{deps_dir / "jsmn"}',
              f'-I{deps_dir / "argparse"}'],
    task_dep=['deps'])