Revamp app build system

Ui will be referred to by the name ‘cockpit’
This commit is contained in:
Renaud Casenave-Péré 2025-09-07 16:05:00 +02:00
parent 5a65d0f6d1
commit 7b4a258c0b
10 changed files with 150 additions and 32 deletions

View file

@ -1,10 +1,11 @@
QT += widgets
TEMPLATE = app TEMPLATE = app
TARGET = sextant-bootstrap CONFIG += debug
QT += widgets
TARGET = cockpit
DESTDIR = $$PWD DESTDIR = $$PWD
OBJECTS_DIR = $$PWD/tmp/bootstrap OBJECTS_DIR = $$PWD/tmp/$$QMAKE_HOST.arch/cockpit
LIBS += -lecl -leql5 -lsextant-parser -L. LIBS += -lecl -leql5 -lsextant-parser -L.
QMAKE_CXXFLAGS += -std=c++2a -Wno-parentheses -Wno-unused-local-typedefs -Wno-array-bounds -Wno-maybe-uninitialized -Wno-restrict QMAKE_CXXFLAGS += -std=c++2a -Wno-parentheses -Wno-unused-local-typedefs -Wno-array-bounds -Wno-maybe-uninitialized -Wno-restrict
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'" QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
SOURCES += src/bootstrap.cc SOURCES += src/cockpit.cc

View file

@ -1,10 +1,10 @@
TEMPLATE = subdirs TEMPLATE = subdirs
SUBDIRS = parser \ SUBDIRS = parser \
bootstrap \ cockpit \
sextant app
parser.file = parser.pro parser.file = ts-parser.pro
bootstrap.file = bootstrap.pro cockpit.file = cockpit.pro
bootstrap.depends = parser cockpit.depends = parser
sextant.file = sextant.pro app.file = sextant-app.pro
sextant.depends = parser bootstrap app.depends = cockpit

View file

@ -0,0 +1,9 @@
(defsystem cockpit
:serial t
:defsystem-depends-on (:asdf-package-system)
:class :package-inferred-system
:around-compile (lambda (thunk)
(proclaim '(optimize (debug 3) (safety 3) (speed 0)))
(funcall thunk))
:depends-on ("sextant")
:components ((:file "cockpit")))

View file

@ -0,0 +1,43 @@
(uiop:define-package :cockpit
(:use :cl :eql :sextant))
(in-package :cockpit)
(qrequire :quick)
(defun initialize ())
(defun finalize ())
(defun start ()
(initialize)
(ext:catch-signal ext:+SIGTERM+ :catch)
(ext:set-signal-handler ext:+SIGTERM+ #'terminate)
(qconnect qml:*quick-view* "statusChanged(QQuickView::Status)"
(lambda (status)
(case status
(#.|QQuickView.Ready| (qml-reloaded)))))
(qconnect qml:*quick-view* "closing(QQuickCloseEvent*)"
(lambda (close)
(declare (ignore close))
(finalize))))
(defun terminate ()
(finalize)
(qrun #'qquit))
(defun reload-qml (&optional (url "http://localhost:8000/"))
"Reload QML file from an url, directly on the device."
(qrun*
(let ((src (|toString| (|source| qml:*quick-view*))))
(if (x:starts-with qml:*root* src)
(|setSource| qml:*quick-view* (qnew "QUrl(QString)" (x:string-substitute url qml:*root* src)))
(qml:reload))
(|toString| (|source| qml:*quick-view*)))))
(defun set-qml (url)
(|setSource| qml:*quick-view* (qnew "QUrl(QString)" url))
(|toString| (|source| qml:*quick-view*)))
(defun qml-reloaded ())
(qlater #'start)

View file

@ -1,8 +1,6 @@
#-eql5 #-eql5
(error "Please use the EQL5 executable") (error "Please use the EQL5 executable")
(push :sextant-repl *features*)
(load "lisp/bundle.lisp") (load "lisp/bundle.lisp")
(asdf:load-system "sextant") (asdf:load-system "cockpit")

13
make-sextant-app.lisp Normal file
View file

@ -0,0 +1,13 @@
#-eql5
(error "Please use the EQL5 executable")
(asdf:make-build "sextant-app"
:monolithic t
:type :static-library
:move-here "./"
:init-name "init_sextant_app")
(let ((lib-name "libsextant-app.a"))
(when (probe-file lib-name)
(delete-file lib-name))
(rename-file (x:cc "sextant-app--all-systems" ".a") lib-name))

View file

@ -1,9 +1,4 @@
#-eql5 (asdf:make-build "cockpit"
(error "Please use the EQL5 executable")
(push :harbour-sextant *features*)
(asdf:make-build "sextant"
:monolithic t :monolithic t
:type :static-library :type :static-library
:move-here "./" :move-here "./"
@ -12,4 +7,4 @@
(let ((lib-name "libsextant.a")) (let ((lib-name "libsextant.a"))
(when (probe-file lib-name) (when (probe-file lib-name)
(delete-file lib-name)) (delete-file lib-name))
(rename-file (x:cc "sextant--all-systems" ".a") lib-name)) (rename-file (x:cc "cockpit--all-systems" ".a") lib-name))

60
sextant-app.pro Normal file
View file

@ -0,0 +1,60 @@
# NOTICE:
#
# Application name defined in TARGET has a corresponding QML filename.
# If name defined in TARGET is changed, the following needs to be done
# to match new name:
# - corresponding QML filename must be changed
# - desktop icon filename must be changed
# - desktop filename must be changed
# - icon definition filename in desktop file must be changed
# - translation filenames have to be changed
CONFIG += debug
SEXTANT_FILES = make.lisp \
dependencies.sexp \
lisp/system-index.txt \
lisp/local-projects/sextant/editor/all.lisp \
lisp/local-projects/sextant/editor/gap-buffer.lisp \
lisp/local-projects/sextant/sextant.lisp \
lisp/local-projects/sextant/sextant.asd \
lisp/local-projects/cockpit/cockpit.lisp \
lisp/local-projects/cockpit/cockpit.asd
sextant.output = libsextant.a
sextant.commands = $$PWD/cockpit -platform minimal make
sextant.input = SEXTANT_FILES
sextant.CONFIG = combine target_predeps
QMAKE_EXTRA_COMPILERS += sextant
# The name of your application
TARGET = harbour-sextant
OBJECTS_DIR = $$PWD/tmp/$$QMAKE_HOST.arch/harbour-sextant
QMAKE_CXXFLAGS += -std=c++2a -Wno-parentheses -Wno-unused-local-typedefs -Wno-array-bounds -Wno-maybe-uninitialized -Wno-restrict
CONFIG += sailfishapp
LIBS += -L. -lsextant-parser -lsextant -lecl -leql5
QT += widgets qml multimedia network quick sql
SOURCES += src/harbour-sextant.cc
DISTFILES += qml/harbour-sextant.qml \
qml/cover/CoverPage.qml \
rpm/harbour-sextant.changes.in \
rpm/harbour-sextant.changes.run.in \
rpm/harbour-sextant.spec \
# rpm/harbour-sextant.yaml \
# translations/*.ts \
harbour-sextant.desktop
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
# to disable building translations every time, comment out the
# following CONFIG line
# CONFIG += sailfishapp_i18n
# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the
# following TRANSLATIONS line. And also do not forget to
# modify the localized app name in the the .desktop file.
# TRANSLATIONS += translations/harbour-sextant-de.ts

View file

@ -1,4 +1,4 @@
#include "parser/parser.hh" #include "ts-parser/ts-parser.hh"
#include <string> #include <string>
@ -22,17 +22,14 @@ int main(int argc, char** argv)
si_select_package(ecl_make_constant_base_string("COMMON-LISP-USER", 16)); si_select_package(ecl_make_constant_base_string("COMMON-LISP-USER", 16));
std::string code("(progn (load \"load.lisp\")"); std::string code("(progn (load \"load-cockpit.lisp\")");
if (args.contains("-repl")) { if (args.contains("make"))
code += "(funcall (intern (symbol-name 'start-slynk) :sextant)) ";
code += "(si:top-level)";
}
else {
if (args.contains("-tests"))
code += "(load \"tests.lisp\")";
if (args.contains("-make"))
code += "(load \"make.lisp\")"; code += "(load \"make.lisp\")";
else
{
code += "(funcall (intern (symbol-name 'start-slynk) :sextant))";
code += "(si:top-level)";
} }
code += ")"; code += ")";
@ -43,5 +40,7 @@ int main(int argc, char** argv)
} }
CL_CATCH_ALL_END; CL_CATCH_ALL_END;
sextant::parser::shutdown_parser_lib();
return 0; return 0;
} }

View file

@ -10,7 +10,7 @@
#include <QQuickView> #include <QQuickView>
#include <QTextCodec> #include <QTextCodec>
#include "parser/parser.hh" #include "ts-parser/ts-parser.hh"
extern "C" void init_sextant (cl_object); extern "C" void init_sextant (cl_object);