aboutsummaryrefslogtreecommitdiff
path: root/src_doit/c.py
blob: 618dd8d2a6692c5fc5c69af0f5c013d1f2cba38c (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
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')],
    src_dir=src_c_dir,
    build_dir=build_c_dir,
    cc_flags=['-fPIC', '-O2', f'-I{deps_dir / "jsmn"}'],
    task_dep=['deps'])