mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-27 18:12:04 +08:00
2fa7a4cf7f
* sunnypilot ui init * ui controls init * comment out for now * use ListWidget instead moving forward * wrap for translation * quick test * need this * good to go, no need for now * start with some * some html * that didn't work * fill up General first * add mads options * add mads options 2 * add mads options 3 * add mads options 4 * add mads options 5 * add mads options 6 * add mads options 7 * add mads options 8 * add mads options 9 * add mads options 10 * add mads options 11 * add mads options 12 * add mads options 13 * add mads options 14 * add mads options 15 * add mads options 16 * add mads options 17 * add mads options 18 * add mads options 19 * add mads options 20 * add mads options 21 * add mads options 22 * add mads options 22 * add dlp * add dlp * add dlp * finish up controls panel * QWidget has no refresh() * fix this tr() later * flipped and redundant deleted * missing icons * Bolding * Revert "Revert "Don't delete params"" This reverts commit 7adfc172d599da0e450669a203f5cdb17a32a9d6. * Revert "Revert "Revert "Don't delete params""" This reverts commit 33f28677f1a69fb18c7d1a08c5f02a497005dfbe. * Revert "Revert "don't forget this"" This reverts commit f4485920ed5318e4662e4955a699febb9ba27159. * Revert "Revert "fill up sp - vehicles"" This reverts commit dfab593833ca5a9cb26fb89f36bf7ac19f7432bf. * Revert "Revert "missed this"" This reverts commit bf4ac0289b164ca59cb49c355fa8a5303c66b016. * Revert "Revert "missed that"" This reverts commit da81b7f9eb4e7bbafced4a7a31cb4b7a078d2277. * Revert "Revert "missed these"" This reverts commit 742908dcf5220a93da57a54836b2b890bbbd519a. * Revert "Revert "nicer info?"" This reverts commit e0d6c1c05da394774ad0a7ee0b5c5e5c7f55c08a. * Revert "Revert "fill up sp visuals"" This reverts commit 35759838e0ba4a36f36a12ff1001846b32ddd0c7. * Revert "Revert "don't miss these"" This reverts commit 7f093380b470a7c195d1f6795b76393b72d4e2f7. * Revert "Revert "Revert "ui controls init""" This reverts commit 67c531487e9501ca5658297a20061b88f91c10cc. * Revert "Revert "move stuff around"" This reverts commit 03b72af6d01772b18c506f590e92b6dbc95c2bfc. * change to sunnypilot * update texts * fix * does this work? * Revert "does this work?" This reverts commit 7b3caf3677593550065efe553334d0797dc5ea00. * try this out * add some back * arrange around * maybe less I/O * missing a space * Translate these too * unfinished translations * try this out * easier translation * refresh unfinished translations * update menu texts with Chinese S and T! * missed this translation * more unfinished translations
136 lines
5.5 KiB
Python
136 lines
5.5 KiB
Python
import os
|
|
import json
|
|
Import('qt_env', 'arch', 'common', 'messaging', 'visionipc',
|
|
'cereal', 'transformations')
|
|
|
|
base_libs = [common, messaging, cereal, visionipc, transformations, 'zmq',
|
|
'capnp', 'kj', 'm', 'OpenCL', 'ssl', 'crypto', 'pthread'] + qt_env["LIBS"]
|
|
|
|
if arch == 'larch64':
|
|
base_libs.append('EGL')
|
|
|
|
maps = arch in ['larch64', 'x86_64']
|
|
|
|
if maps and arch == 'x86_64':
|
|
rpath = [Dir(f"#third_party/mapbox-gl-native-qt/{arch}").srcnode().abspath]
|
|
qt_env["RPATH"] += rpath
|
|
|
|
if arch == "Darwin":
|
|
del base_libs[base_libs.index('OpenCL')]
|
|
qt_env['FRAMEWORKS'] += ['OpenCL']
|
|
|
|
qt_util = qt_env.Library("qt_util", ["#selfdrive/ui/qt/api.cc", "#selfdrive/ui/qt/util.cc"], LIBS=base_libs)
|
|
widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/drive_stats.cc",
|
|
"qt/widgets/ssh_keys.cc", "qt/widgets/toggle.cc", "qt/widgets/controls.cc",
|
|
"qt/widgets/offroad_alerts.cc", "qt/widgets/prime.cc", "qt/widgets/keyboard.cc",
|
|
"qt/widgets/scrollview.cc", "qt/widgets/cameraview.cc", "#third_party/qrcode/QrCode.cc",
|
|
"qt/request_repeater.cc", "qt/qt_window.cc", "qt/offroad/networking.cc", "qt/offroad/wifiManager.cc",
|
|
"qt/offroad/sunnypilot_settings.cc"]
|
|
|
|
qt_env['CPPDEFINES'] = []
|
|
if maps:
|
|
base_libs += ['qmapboxgl']
|
|
widgets_src += ["qt/maps/map_helpers.cc", "qt/maps/map_settings.cc", "qt/maps/map.cc"]
|
|
qt_env['CPPDEFINES'] += ["ENABLE_MAPS"]
|
|
|
|
widgets = qt_env.Library("qt_widgets", widgets_src, LIBS=base_libs)
|
|
Export('widgets')
|
|
qt_libs = [widgets, qt_util] + base_libs
|
|
|
|
# build assets
|
|
assets = "#selfdrive/assets/assets.cc"
|
|
assets_src = "#selfdrive/assets/assets.qrc"
|
|
qt_env.Command(assets, assets_src, f"rcc $SOURCES -o $TARGET")
|
|
qt_env.Depends(assets, Glob('#selfdrive/assets/*', exclude=[assets, assets_src, "#selfdrive/assets/assets.o"]))
|
|
asset_obj = qt_env.Object("assets", assets)
|
|
Export('asset_obj')
|
|
|
|
# build soundd
|
|
qt_env.Program("soundd/_soundd", ["soundd/main.cc", "soundd/sound.cc"], LIBS=qt_libs)
|
|
if GetOption('test'):
|
|
qt_env.Program("tests/playsound", "tests/playsound.cc", LIBS=base_libs)
|
|
qt_env.Program('tests/test_sound', ['tests/test_runner.cc', 'soundd/sound.cc', 'tests/test_sound.cc'], LIBS=qt_libs)
|
|
|
|
qt_env.SharedLibrary("qt/python_helpers", ["qt/qt_window.cc"], LIBS=qt_libs)
|
|
|
|
# spinner and text window
|
|
qt_env.Program("qt/text", ["qt/text.cc"], LIBS=qt_libs)
|
|
qt_env.Program("qt/spinner", ["qt/spinner.cc"], LIBS=qt_libs)
|
|
|
|
# build main UI
|
|
qt_src = ["main.cc", "qt/sidebar.cc", "qt/onroad.cc", "qt/body.cc",
|
|
"qt/window.cc", "qt/home.cc", "qt/offroad/settings.cc",
|
|
"qt/offroad/software_settings.cc", "qt/offroad/onboarding.cc",
|
|
"qt/offroad/driverview.cc", "qt/offroad/experimental_mode.cc"]
|
|
qt_env.Program("_ui", qt_src + [asset_obj], LIBS=qt_libs)
|
|
if GetOption('test'):
|
|
qt_src.remove("main.cc") # replaced by test_runner
|
|
qt_env.Program('tests/test_translations', [asset_obj, 'tests/test_runner.cc', 'tests/test_translations.cc'] + qt_src, LIBS=qt_libs)
|
|
|
|
|
|
# build translation files
|
|
with open(File("translations/languages.json").abspath) as f:
|
|
languages = json.loads(f.read())
|
|
translation_sources = [f"#selfdrive/ui/translations/{l}.ts" for l in languages.values()]
|
|
translation_targets = [src.replace(".ts", ".qm") for src in translation_sources]
|
|
lrelease_bin = 'third_party/qt5/larch64/bin/lrelease' if arch == 'larch64' else 'lrelease'
|
|
|
|
lupdate = qt_env.Command(translation_sources, qt_src, "selfdrive/ui/update_translations.py")
|
|
lrelease = qt_env.Command(translation_targets, translation_sources, f"{lrelease_bin} $SOURCES")
|
|
qt_env.Depends(lrelease, lupdate)
|
|
qt_env.NoClean(translation_sources)
|
|
qt_env.Precious(translation_sources)
|
|
qt_env.NoCache(lupdate)
|
|
|
|
# setup and factory resetter
|
|
if GetOption('extras'):
|
|
qt_env.Program("qt/setup/reset", ["qt/setup/reset.cc"], LIBS=qt_libs)
|
|
qt_env.Program("qt/setup/setup", ["qt/setup/setup.cc", asset_obj],
|
|
LIBS=qt_libs + ['curl', 'common', 'json11'])
|
|
|
|
|
|
if GetOption('extras'):
|
|
# build updater UI
|
|
qt_env.Program("qt/setup/updater", ["qt/setup/updater.cc", asset_obj], LIBS=qt_libs)
|
|
|
|
# build mui
|
|
qt_env.Program("_mui", ["mui.cc"], LIBS=qt_libs)
|
|
|
|
# build installers
|
|
senv = qt_env.Clone()
|
|
senv['LINKFLAGS'].append('-Wl,-strip-debug')
|
|
|
|
release = "release3"
|
|
dashcam = "dashcam3"
|
|
installers = [
|
|
("openpilot", release),
|
|
("openpilot_test", f"{release}-staging"),
|
|
("openpilot_nightly", "master-ci"),
|
|
("openpilot_internal", "master"),
|
|
("dashcam", dashcam),
|
|
("dashcam_test", f"{dashcam}-staging"),
|
|
]
|
|
|
|
cont = {}
|
|
for brand in ("openpilot", "dashcam"):
|
|
cont[brand] = senv.Command(f"installer/continue_{brand}.o", f"installer/continue_{brand}.sh",
|
|
"ld -r -b binary -o $TARGET $SOURCE")
|
|
for name, branch in installers:
|
|
brand = "dashcam" if "dashcam" in branch else "openpilot"
|
|
d = {'BRANCH': f"'\"{branch}\"'", 'BRAND': f"'\"{brand}\"'"}
|
|
if "internal" in name:
|
|
d['INTERNAL'] = "1"
|
|
|
|
import requests
|
|
r = requests.get("https://github.com/commaci2.keys")
|
|
r.raise_for_status()
|
|
d['SSH_KEYS'] = f'\\"{r.text.strip()}\\"'
|
|
obj = senv.Object(f"installer/installers/installer_{name}.o", ["installer/installer.cc"], CPPDEFINES=d)
|
|
f = senv.Program(f"installer/installers/installer_{name}", [obj, cont[brand]], LIBS=qt_libs)
|
|
# keep installers small
|
|
assert f[0].get_size() < 300*1e3
|
|
|
|
# build watch3
|
|
if arch in ['x86_64', 'Darwin'] or GetOption('extras'):
|
|
qt_env.Program("watch3", ["watch3.cc"], LIBS=qt_libs + ['common', 'json11', 'zmq', 'visionipc', 'messaging'])
|