mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 17:43:54 +08:00
build nui with scons (#19561)
* it builds
* cleanup
* remove that
old-commit-hash: 3c00e6792c
This commit is contained in:
69
SConstruct
69
SConstruct
@@ -75,7 +75,6 @@ if arch == "aarch64" or arch == "larch64":
|
||||
if QCOM_REPLAY:
|
||||
cflags += ["-DQCOM_REPLAY"]
|
||||
cxxflags += ["-DQCOM_REPLAY"]
|
||||
|
||||
else:
|
||||
cflags = []
|
||||
cxxflags = []
|
||||
@@ -245,6 +244,64 @@ else:
|
||||
|
||||
Export('envCython')
|
||||
|
||||
# Qt build environment
|
||||
qt_env = None
|
||||
if arch in ["x86_64", "Darwin", "larch64"]:
|
||||
qt_env = env.Clone()
|
||||
|
||||
qt_modules = ["Widgets", "Gui", "Core", "DBus", "Multimedia", "Network"]
|
||||
|
||||
qt_libs = []
|
||||
if arch == "Darwin":
|
||||
qt_env['QTDIR'] = "/usr/local/opt/qt"
|
||||
QT_BASE = "/usr/local/opt/qt/"
|
||||
qt_dirs = [
|
||||
QT_BASE + "include/",
|
||||
]
|
||||
qt_dirs += [f"{QT_BASE}include/Qt{m}" for m in qt_modules]
|
||||
qt_env["LINKFLAGS"] += ["-F" + QT_BASE + "lib"]
|
||||
qt_env["FRAMEWORKS"] += [f"Qt{m}" for m in qt_modules] + ["OpenGL"]
|
||||
else:
|
||||
qt_env['QTDIR'] = "/usr"
|
||||
qt_dirs = [
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.5.1/QtGui",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.12.8/QtGui",
|
||||
]
|
||||
qt_dirs += [f"/usr/include/{real_arch}-linux-gnu/qt5/Qt{m}" for m in qt_modules]
|
||||
|
||||
qt_libs = [f"Qt5{m}" for m in qt_modules]
|
||||
if arch == "larch64":
|
||||
qt_libs += ["GLESv2", "wayland-client"]
|
||||
elif arch != "Darwin":
|
||||
qt_libs += ["GL"]
|
||||
|
||||
qt_env.Tool('qt')
|
||||
qt_env['CPPPATH'] += qt_dirs + ["#selfdrive/ui/qt/"]
|
||||
qt_flags = [
|
||||
"-D_REENTRANT",
|
||||
"-DQT_NO_DEBUG",
|
||||
"-DQT_WIDGETS_LIB",
|
||||
"-DQT_GUI_LIB",
|
||||
"-DQT_CORE_LIB"
|
||||
]
|
||||
qt_env['CXXFLAGS'] += qt_flags
|
||||
qt_env['LIBPATH'] += ['#selfdrive/ui']
|
||||
qt_env['LIBS'] = qt_libs
|
||||
|
||||
if GetOption("clazy"):
|
||||
checks = [
|
||||
"level0",
|
||||
"level1",
|
||||
"no-range-loop",
|
||||
"no-non-pod-global-static",
|
||||
]
|
||||
qt_env['CXX'] = 'clazy'
|
||||
qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0]
|
||||
qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks)
|
||||
Export('qt_env')
|
||||
|
||||
|
||||
# still needed for apks
|
||||
zmq = 'zmq'
|
||||
Export('env', 'arch', 'real_arch', 'zmq', 'SHARED', 'USE_WEBCAM', 'QCOM_REPLAY')
|
||||
@@ -271,12 +328,17 @@ else:
|
||||
|
||||
Export('common', 'visionipc', 'gpucommon')
|
||||
|
||||
|
||||
# Build openpilot
|
||||
|
||||
SConscript(['cereal/SConscript'])
|
||||
SConscript(['opendbc/can/SConscript'])
|
||||
|
||||
SConscript(['phonelibs/SConscript'])
|
||||
|
||||
SConscript(['common/SConscript'])
|
||||
SConscript(['common/kalman/SConscript'])
|
||||
SConscript(['common/transformations/SConscript'])
|
||||
SConscript(['phonelibs/SConscript'])
|
||||
|
||||
SConscript(['selfdrive/camerad/SConscript'])
|
||||
SConscript(['selfdrive/modeld/SConscript'])
|
||||
@@ -300,5 +362,6 @@ SConscript(['selfdrive/ui/SConscript'])
|
||||
if arch != "Darwin":
|
||||
SConscript(['selfdrive/logcatd/SConscript'])
|
||||
|
||||
if arch == "x86_64":
|
||||
if real_arch == "x86_64":
|
||||
SConscript(['tools/nui/SConscript'])
|
||||
SConscript(['tools/lib/index_log/SConscript'])
|
||||
|
||||
@@ -1,59 +1,5 @@
|
||||
import os
|
||||
Import('env', 'arch', 'real_arch', 'common', 'messaging', 'gpucommon', 'visionipc', 'cereal')
|
||||
|
||||
qt_env = None
|
||||
if arch in ["x86_64", "Darwin", "larch64"]:
|
||||
qt_env = env.Clone()
|
||||
|
||||
if arch == "Darwin":
|
||||
qt_env['QTDIR'] = "/usr/local/opt/qt"
|
||||
QT_BASE = "/usr/local/opt/qt/"
|
||||
qt_dirs = [
|
||||
QT_BASE + "include/",
|
||||
QT_BASE + "include/QtWidgets",
|
||||
QT_BASE + "include/QtGui",
|
||||
QT_BASE + "include/QtCore",
|
||||
QT_BASE + "include/QtDBus",
|
||||
QT_BASE + "include/QtMultimedia",
|
||||
QT_BASE + "include/QtNetwork",
|
||||
]
|
||||
qt_env["LINKFLAGS"] += ["-F" + QT_BASE + "lib"]
|
||||
else:
|
||||
qt_env['QTDIR'] = "/usr"
|
||||
qt_dirs = [
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtWidgets",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtCore",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtDBus",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtMultimedia",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtNetwork",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.5.1/QtGui",
|
||||
f"/usr/include/{real_arch}-linux-gnu/qt5/QtGui/5.12.8/QtGui",
|
||||
]
|
||||
|
||||
qt_env.Tool('qt')
|
||||
qt_env['CPPPATH'] += qt_dirs + ["#selfdrive/ui/qt/"]
|
||||
qt_flags = [
|
||||
"-D_REENTRANT",
|
||||
"-DQT_NO_DEBUG",
|
||||
"-DQT_WIDGETS_LIB",
|
||||
"-DQT_GUI_LIB",
|
||||
"-DQT_CORE_LIB"
|
||||
]
|
||||
qt_env['CXXFLAGS'] += qt_flags
|
||||
qt_env['LIBPATH'] += ['#selfdrive/ui']
|
||||
|
||||
if GetOption("clazy"):
|
||||
checks = [
|
||||
"level0",
|
||||
"level1",
|
||||
"no-range-loop",
|
||||
"no-non-pod-global-static",
|
||||
]
|
||||
qt_env['CXX'] = 'clazy'
|
||||
qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0]
|
||||
qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks)
|
||||
Import('env', 'qt_env', 'arch', 'common', 'messaging', 'gpucommon', 'visionipc', 'cereal')
|
||||
|
||||
|
||||
src = ['ui.cc', 'paint.cc', 'sidebar.cc', '#phonelibs/nanovg/nanovg.c']
|
||||
@@ -70,20 +16,7 @@ if qt_env is None:
|
||||
LINKFLAGS=linkflags,
|
||||
LIBS=libs)
|
||||
else:
|
||||
qt_libs = ["pthread", "ssl", "crypto"]
|
||||
|
||||
qt_modules = ["Widgets", "Gui", "Core", "DBus", "Multimedia", "Network"]
|
||||
|
||||
if arch == "larch64":
|
||||
qt_libs += ["GLESv2", "wayland-client"]
|
||||
elif arch != "Darwin":
|
||||
qt_libs += ["GL"]
|
||||
|
||||
if arch == "Darwin":
|
||||
qt_env["FRAMEWORKS"] += [f"Qt{m}" for m in qt_modules] + ["OpenGL"]
|
||||
else:
|
||||
qt_libs += [f"Qt5{m}" for m in qt_modules]
|
||||
|
||||
qt_libs = qt_env["LIBS"] + libs + ["pthread", "ssl", "crypto"]
|
||||
|
||||
widgets = qt_env.Library("qt_widgets",
|
||||
["qt/qt_window.cc", "qt/qt_sound.cc", "qt/widgets/keyboard.cc", "qt/widgets/input_field.cc", "qt/widgets/drive_stats.cc",
|
||||
@@ -92,11 +25,11 @@ else:
|
||||
qt_libs.append(widgets)
|
||||
|
||||
qt_src = ["qt/ui.cc", "qt/window.cc", "qt/home.cc", "qt/offroad/settings.cc", "qt/offroad/onboarding.cc"] + src
|
||||
qt_env.Program("_ui", qt_src, LIBS=qt_libs + libs)
|
||||
qt_env.Program("_ui", qt_src, LIBS=qt_libs)
|
||||
|
||||
# spinner and text window
|
||||
qt_env.Program("qt/text", ["qt/text.cc"], LIBS=qt_libs + libs)
|
||||
qt_env.Program("qt/spinner", ["qt/spinner.cc"], LIBS=qt_libs + libs)
|
||||
qt_env.Program("qt/text", ["qt/text.cc"], LIBS=qt_libs)
|
||||
qt_env.Program("qt/spinner", ["qt/spinner.cc"], LIBS=qt_libs)
|
||||
|
||||
# build setup, factory resetter, and installer
|
||||
if "BUILD_SETUP" in os.environ:
|
||||
@@ -111,4 +44,4 @@ else:
|
||||
]
|
||||
for name, branch in installers:
|
||||
flags = qt_env["CXXFLAGS"] + [f"-D{branch}"]
|
||||
qt_env.Program(f"qt/setup/installer_{name}", ["qt/setup/installer.cc"], LIBS=qt_libs, CXXFLAGS=flags)
|
||||
qt_env.Program(f"qt/setup/installer_{name}", ["qt/setup/installer.cc"], LIBS=qt_libs)
|
||||
|
||||
2
tools/nui/.gitignore
vendored
2
tools/nui/.gitignore
vendored
@@ -1,9 +1,7 @@
|
||||
Makefile
|
||||
.*.swp
|
||||
*.o
|
||||
_nui
|
||||
moc_*
|
||||
.qmake.stash
|
||||
nui.app/*
|
||||
routes.json
|
||||
_nui.app
|
||||
|
||||
11
tools/nui/SConscript
Normal file
11
tools/nui/SConscript
Normal file
@@ -0,0 +1,11 @@
|
||||
Import('qt_env', 'messaging')
|
||||
|
||||
qt_env['CPPPATH'] += ["#tools/clib"]
|
||||
qt_env['CXXFLAGS'] += ["-Wno-deprecated-declarations"]
|
||||
|
||||
libs = [messaging, 'avutil', 'avcodec', 'avformat', 'bz2', 'capnp', 'kj',
|
||||
'pthread', 'swscale', 'zmq']
|
||||
|
||||
qt_env.Program("_nui",
|
||||
['main.cpp', 'Unlogger.cpp', 'FileReader.cpp', '../clib/FrameReader.cpp'],
|
||||
LIBS=qt_env['LIBS'] + libs)
|
||||
@@ -1,12 +1,12 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <yaml-cpp/yaml.h>
|
||||
#include <capnp/dynamic.h>
|
||||
#include <capnp/schema.h>
|
||||
|
||||
// include the dynamic struct
|
||||
#include "cereal/gen/cpp/car.capnp.c++"
|
||||
#include "cereal/gen/cpp/log.capnp.c++"
|
||||
#include "cereal/services.h"
|
||||
|
||||
#include "Unlogger.hpp"
|
||||
|
||||
@@ -27,7 +27,6 @@ static inline uint64_t nanos_since_boot() {
|
||||
Unlogger::Unlogger(Events *events_, QReadWriteLock* events_lock_, QMap<int, FrameReader*> *frs_, int seek)
|
||||
: events(events_), events_lock(events_lock_), frs(frs_) {
|
||||
ctx = Context::create();
|
||||
YAML::Node service_list = YAML::LoadFile("../../cereal/service_list.yaml");
|
||||
|
||||
seek_request = seek*1e9;
|
||||
|
||||
@@ -37,9 +36,8 @@ Unlogger::Unlogger(Events *events_, QReadWriteLock* events_lock_, QMap<int, Fram
|
||||
QStringList allow = QString(getenv("ALLOW")).split(",");
|
||||
qDebug() << "allowlist" << allow;
|
||||
|
||||
for (const auto& it : service_list) {
|
||||
auto name = it.first.as<std::string>();
|
||||
|
||||
for (const auto& it : services) {
|
||||
std::string name = it.name;
|
||||
if (allow[0].size() > 0 && !allow.contains(name.c_str())) {
|
||||
qDebug() << "not allowing" << name.c_str();
|
||||
continue;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef UNLOGGER_HPP
|
||||
#define UNLOGGER_HPP
|
||||
#pragma once
|
||||
|
||||
#include <QThread>
|
||||
#include <QReadWriteLock>
|
||||
@@ -32,5 +31,3 @@ Q_OBJECT
|
||||
bool paused = false;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -161,7 +161,6 @@ void Window::paintEvent(QPaintEvent *event) {
|
||||
timer.start();
|
||||
|
||||
uint64_t t0 = events.begin().key();
|
||||
uint64_t t1 = (events.end()-1).key();
|
||||
|
||||
//p.drawRect(0, 0, 600, 100);
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6da22e2e4503c7db82c6632d552a5e3914e7b5fdefc50118683a1b2e816be317
|
||||
size 1106
|
||||
Reference in New Issue
Block a user