This repository was archived by the owner on Oct 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcpp.py
More file actions
40 lines (32 loc) · 1.2 KB
/
cpp.py
File metadata and controls
40 lines (32 loc) · 1.2 KB
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
#!/usr/bin/env python3
from task_maker.args import Arch
from task_maker.languages import CompiledLanguage, CommandType, \
LanguageManager, make_unique
from task_maker.languages.c import find_c_dependency
from typing import List
class LanguageCPP(CompiledLanguage):
@property
def name(self):
return "C++"
@property
def source_extensions(self):
return [".cpp", ".cc", ".cxx", ".c++", ".C"]
@property
def header_extensions(self):
return [".hpp"]
def get_compilation_command(self, source_filenames: List[str],
exe_name: str, unit_name: str,
for_evaluation: bool,
target_arch: Arch) -> (CommandType, List[str]):
cmd = ["c++"]
if for_evaluation:
cmd += ["-DEVAL"]
if target_arch == Arch.I686:
cmd += ["-m32"]
cmd += ["-O2", "-std=c++14", "-Wall", "-ggdb3", "-o", exe_name]
cmd += source_filenames
return CommandType.SYSTEM, cmd
def get_dependencies(self, filename: str):
return make_unique(find_c_dependency(filename))
def register():
LanguageManager.register_language(LanguageCPP())