blob: ce02d2b9de9be97e467b1949692d937e368caef0 (
plain)
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
43
44
45
46
47
|
from typing import Dict
from pathlib import Path
from dataclasses import dataclass, field
from .translation_unit import *
@dataclass
class Library:
name: str
translation_units: Dict[str, TranslationUnit] = field(
default_factory=dict, repr=False)
module_path: Path = None
lib_path: Path = None
inc_path: Path = None
asm_path: Path = None
mk_path: Path = None
@property
def libname(self):
assert self.name
return f"lib{self.name.split('/')[-1]}.a"
@property
def makefile_path(self):
assert self.name
return self.mk_path.joinpath(self.name)
@property
def source_path(self):
if not self.name:
return self.lib_path
return self.lib_path.joinpath(self.name)
@property
def include_path(self):
if not self.name:
return self.inc_path
return self.inc_path.joinpath(self.name)
@property
def asm_function_path(self):
if not self.name:
return self.asm_path
return self.asm_path.joinpath(self.name)
def add_translation_unit(self, tu: TranslationUnit):
self.translation_units[tu.name] = tu
|