-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
90 lines (77 loc) · 2.92 KB
/
setup.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import sys
import json
from tkinter import filedialog
from os import makedirs
from os.path import abspath, join
################################################################################
# Run this file and select your libfxcg directory #
################################################################################
# Libfxcg instruction:
# Windows: https://github.com/Jonimoose/libfxcg/blob/master/docs/howto-windows.md
# ---------------------------------------------------------------------------- #
GEN_VSCODE_C_CPP_PROPERTIES = True
# ---------------------------------------------------------------------------- #
GEN_FX_CG_CL = False
# https://gitlab.com/taricorp/fx-cg-cl/ # https://gitlab.com/taricorp/fx-cg-ui #
# ---------------------------------------------------------------------------- #
def getDir(title):
dir_name = filedialog.askdirectory(initialdir='.',
title=title)
return dir_name
sdk_path = getDir(title='Select PrizmSDK Directory')
if not sdk_path:
sys.exit('Stopped setup')
base_path = abspath('.')
sdk_out_path = abspath(join(base_path, 'PATH.txt'))
with open(sdk_out_path, 'w') as file:
file.write(abspath(sdk_path))
if GEN_FX_CG_CL:
cl_path = getDir(title='Select FX-CG-CL Directory')
if not cl_path:
sys.exit('Stopped setup')
cl_out_path = abspath(join(base_path, 'CLPATH.txt'))
with open(cl_out_path, 'w') as file:
file.write(abspath(cl_path))
if GEN_VSCODE_C_CPP_PROPERTIES:
vscode_path = abspath(join(base_path, '.vscode'))
c_cpp_properties_path = abspath(join(vscode_path, 'c_cpp_properties.json'))
compiler_path = abspath(join(sdk_path, 'bin', 'sh3eb-elf-gcc.exe'))
include_path = abspath(join(sdk_path, '**'))
try:
makedirs(vscode_path)
except:
pass
c_cpp_properties = {
'configurations': [{
'name': 'libfxcg',
'intelliSenseMode': 'gcc-arm',
'includePath': [
include_path],
'browse': {
'limitSymbolsToIncludedHeaders': True,
'path': [
include_path]},
'cStandard': 'c11',
'cppStandard': 'c++11',
'compilerPath': compiler_path,
'compilerArgs': [
'-Os'
'-Wall',
'-flto',
'-MMD',
'-MP',
'-MF',
'-mb',
'-m4a-nofpu',
'-m4a-nofpu',
'-mhitachi',
'-ffunction-sections',
'-fdata-sections',
'-Werror=vla',
'-nostdlib'
]}],
'version': 4}
with open(c_cpp_properties_path, 'w') as file:
file.write('// AUTOGENERATED FILE BY SETUP.PY\n'
'// ANY CHANGES MADE WILL BE LOST ON NEXT SETUP\n')
file.write(json.dumps(c_cpp_properties, indent=4))