-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmamafile.py
More file actions
71 lines (57 loc) · 2.4 KB
/
mamafile.py
File metadata and controls
71 lines (57 loc) · 2.4 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import mama
import os
class ReCpp(mama.BuildTarget):
def settings(self):
# if no preference, prefer gcc since its support is better in 2023
self.prefer_gcc()
if os.getenv('NO_NINJA'):
self.enable_ninja_build = False
def dependencies(self):
# for a few specific target we use source-built elfutils for libdw support
if self.mips:
self.add_git('elfutils', 'https://github.com/RedFox20/elfutils-package.git')
def configure(self):
# enable CMAKE opts if env vars are enabled
self.enable_from_env('BUILD_TESTS', force=self.config.test != '')
self.enable_from_env('BUILD_WITH_MEM_SAFETY')
self.enable_from_env('CXX17', force=self.is_enabled_cxx17())
self.enable_from_env('CXX20', force=self.is_enabled_cxx20())
self.enable_from_env('CXX23', force=self.is_enabled_cxx23())
self.enable_from_env('CXX26', force=self.is_enabled_cxx26())
self.enable_from_env('BUILD_WITH_MODULES')
def package(self):
self.export_include('src/rpp', build_dir=False,
includes_filter=['.h','.natvis'], as_includes_root=True)
if self.windows:
self.export_lib(f'{self.cmake_build_type}/ReCpp.lib')
else:
self.export_lib('libReCpp.a')
if self.raspi or self.oclea:
self.export_syslib('dl')
self.export_syslib('rt')
elif self.yocto_linux:
self.export_syslib('dw')
self.export_syslib('elf')
self.export_syslib('z')
elif self.mips:
self.export_syslib('dl')
self.export_syslib('rt')
self.export_syslib('atomic')
elif self.linux:
self.export_syslib('dl')
self.export_syslib('dw', 'libdw-dev')
self.export_syslib('rt')
elif self.android:
self.export_syslib('android')
self.export_syslib('log')
elif self.macos or self.ios:
self.export_syslib('-framework Foundation')
def deploy(self):
# deploy directly to build directory
self.papa_deploy(f'.', src_dir=False)
def test(self, args):
if 'nogdb' in args:
args = args.replace('nogdb', '')
self.run_program(self.source_dir('bin'), self.source_dir(f'bin/RppTests {args}'))
else:
self.gdb(f"bin/RppTests {args}", src_dir=True)