1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-19 14:25:11 +03:00

Compile script

This commit is contained in:
bsongis 2012-02-03 23:00:29 +00:00
parent d3bd550ed7
commit 7449cfb5fb

View file

@ -3,22 +3,24 @@
import os, sys, shutil import os, sys, shutil
from subprocess import call from subprocess import call
options_stock = [("frsky", "EXT=STD", "EXT=FRSKY"), options_stock = [[("", "EXT=STD"), ("frsky", "EXT=FRSKY"), ("jeti", "EXT=JETI"), ("ardupilot", "EXT=ARDUPILOT"), ("nmea", "EXT=NMEA")],
("heli", "HELI=NO", "HELI=YES"), [("", "HELI=NO"), ("heli", "HELI=YES")],
("templates", "TEMPLATES=NO", "TEMPLATES=YES"), [("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
("speaker", "BEEPER=BUZZER", "BEEPER=SPEAKER"), [("", "AUDIO=NO"), ("audio", "AUDIO=YES")],
[("", "HAPTIC=NO"), ("haptic", "HAPTIC=YES")],
# ("DSM2", "DSM2="NO", "DSM2=PPM"), # ("DSM2", "DSM2="NO", "DSM2=PPM"),
# ("PXX", "PXX=NO", "PXX=YES"), # ("PXX", "PXX=NO", "PXX=YES"),
] ]
options_v4 = [("heli", "HELI=NO", "HELI=YES"), options_v4 = [[("", "HELI=NO"), ("heli", "HELI=YES")],
("templates", "TEMPLATES=NO", "TEMPLATES=YES"), [("", "TEMPLATES=NO"), ("templates", "TEMPLATES=YES")],
] ]
languages = ["en", "fr"] languages = ["en", "fr"]
def generate(hex, arg, options): def generate(hex, arg, options):
states = [False] * len(options) result = []
states = [0] * len(options)
index = 0 index = 0
while 1: while 1:
@ -28,31 +30,41 @@ def generate(hex, arg, options):
hex_file = hex hex_file = hex
make_args = ["make", arg] make_args = ["make", arg]
for i, option in enumerate(options): for i, option in enumerate(options):
if states[len(options) - 1 - i]: state = states[len(options) - 1 - i]
hex_file += "-" + option[0] if option[state][0]:
make_args.append(option[2]) hex_file += "-" + option[state][0]
else: make_args.append(option[state][1])
make_args.append(option[1])
hex_file += "-" + language hex_file += "-" + language
make_args.append("TRANSLATIONS=" + language.upper()) make_args.append("TRANSLATIONS=" + language.upper())
print hex_file print hex_file
call(["make", "clean"]) call(["make", "clean"])
call(make_args) call(make_args)
shutil.copyfile("open9x.hex", "../binaries/" + hex_file + ".hex") shutil.copyfile("open9x.hex", "../binaries/" + hex_file + ".hex")
result.append(hex_file)
try: for index, state in enumerate(states):
index = states.index(False) if state < len(options[len(options) - 1 - index]) - 1:
except:
break
for i in range(index): for i in range(index):
states[i] = False states[i] = 0
states[index] = True states[index] += 1
break
else:
break
return result
def generate_c9x_list(filename, hexes, size):
f = file(filename, "w")
for hex in hexes:
f.write('open9x->add_option(new Open9xFirmware("%s", new Open9xInterface(%s), OPEN9X_BIN_URL "%s.hex"));\n' % (hex, size, hex))
# stock board # stock board
generate("open9x-stock", "PCB=STD", options_stock) hexes = generate("open9x-stock", "PCB=STD", options_stock)
generate_c9x_list("../../companion9x/src/open9x-stock-binaries.cpp", hexes, "EESIZE_STOCK")
# v4 board # v4 board
generate("open9x-v4", "PCB=V4", options_v4) hexes = generate("open9x-v4", "PCB=V4", options_v4)
generate_c9x_list("../../companion9x/src/open9x-v4-binaries.cpp", hexes, "EESIZE_V4")
# stamp # stamp
call(["make", "stamp"]) call(["make", "stamp"])