forked from open-ead/nx-decomp-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff_settings.py
56 lines (45 loc) · 1.87 KB
/
diff_settings.py
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
from pathlib import Path
import platform
import util.config
def get_tools_bin_dir():
path = util.config.get_repo_root() / 'tools' / 'common' / 'nx-decomp-tools-binaries'
system = platform.system()
if system == "Linux":
return str(path) + "/linux/"
if system == "Darwin":
return str(path) + "/macos/"
return ""
def add_custom_arguments(parser):
parser.add_argument('--version', dest='version', help='Specify which version should be recompiled on source changes')
def apply(config, args):
root = util.config.get_repo_root()
version = None
if isinstance(args, dict):
version = args.get("version")
else:
try:
version = args.version
except AttributeError:
pass
if version is None:
version = util.config.get_default_version()
config['arch'] = 'aarch64'
config['baseimg'] = util.config.get_base_elf(version)
config['myimg'] = util.config.get_decomp_elf(version)
config['source_directories'] = [str(root / 'src'), str(root / 'lib')]
config['objdump_executable'] = get_tools_bin_dir() + 'aarch64-none-elf-objdump'
# ill-suited to C++ projects (and too slow for large executables)
config['show_line_numbers_default'] = False
for dir in (root / 'build', root / 'build/nx64-release'):
if (dir / 'build.ninja').is_file():
config['make_command'] = ['ninja', '-C', str(dir)]
if version is not None:
dir = root / 'build' / version
if (dir / 'build.ninja').is_file():
config['make_command'] = ['ninja', '-C', str(dir)]
def map_build_target(make_target: str):
if make_target == util.config.get_decomp_elf():
return util.config.get_build_target()
# TODO: When support for directly diffing object files is added, this needs to strip
# the build/ prefix from the object file targets.
return make_target