mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-06 02:30:38 -08:00
make example work on android; revisions
This commit is contained in:
parent
113386fdae
commit
99ea5a081d
49 changed files with 637 additions and 133 deletions
6
examples/9999/app.asd
Normal file
6
examples/9999/app.asd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(defsystem :app
|
||||
:serial t
|
||||
:depends-on ()
|
||||
:components ((:file "lisp/package")
|
||||
(:file "lisp/main")))
|
||||
|
||||
53
examples/9999/app.pro
Normal file
53
examples/9999/app.pro
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# changes to these files will re-compile the Lisp library when running 'make'
|
||||
LISP_FILES = \
|
||||
lisp/package.lisp \
|
||||
lisp/main.lisp \
|
||||
app.asd \
|
||||
make.lisp
|
||||
|
||||
android {
|
||||
lisp.commands = $$(ECL_ANDROID)/../ecl-android-host/bin/ecl \
|
||||
-norc -shell $$PWD/make.lisp
|
||||
} else:ios {
|
||||
lisp.commands = $$(ECL_IOS)/../ecl-ios-host/bin/ecl \
|
||||
-norc -shell $$PWD/make.lisp
|
||||
} else:unix {
|
||||
lisp.commands = ecl -shell $$PWD/make.lisp
|
||||
}
|
||||
|
||||
lisp.input = LISP_FILES
|
||||
lisp.output = tmp/libapp.a
|
||||
|
||||
QMAKE_EXTRA_COMPILERS += lisp
|
||||
|
||||
QT += quick qml
|
||||
TEMPLATE = app
|
||||
CONFIG += no_keywords release
|
||||
DEFINES += INI_LISP
|
||||
INCLUDEPATH = /usr/local/include
|
||||
LIBS = -L/usr/local/lib -lecl
|
||||
DESTDIR = .
|
||||
TARGET = app
|
||||
OBJECTS_DIR = ./tmp
|
||||
MOC_DIR = ./tmp
|
||||
|
||||
linux: LIBS += -L../../../platforms/linux/lib -llqml -llisp -Ltmp -lapp
|
||||
macx: LIBS += -L../../../platforms/macos/lib -llqml -llisp -Ltmp -lapp
|
||||
|
||||
android {
|
||||
QT += androidextras
|
||||
INCLUDEPATH = $$(ECL_ANDROID)/include
|
||||
LIBS = -L$$(ECL_ANDROID)/lib -lecl
|
||||
LIBS += -L../../../platforms/android/lib -llqml -llisp -Ltmp -lapp
|
||||
|
||||
ANDROID_ABIS = "arm64-v8a"
|
||||
ANDROID_EXTRA_LIBS += $$(ECL_ANDROID)/lib/libecl.so
|
||||
#ANDROID_PACKAGE_SOURCE_DIR = ../platforms/android/sources
|
||||
}
|
||||
|
||||
SOURCES += ../../src/cpp/main.cpp
|
||||
|
||||
RESOURCES = app.qrc
|
||||
|
||||
QMAKE_CXXFLAGS += -std=c++17
|
||||
|
||||
5
examples/9999/app.qrc
Normal file
5
examples/9999/app.qrc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>qml/main.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
2
examples/9999/build-android/.gitignore
vendored
Normal file
2
examples/9999/build-android/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
2
examples/9999/build-ios/.gitignore
vendored
Normal file
2
examples/9999/build-ios/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
2
examples/9999/build/.gitignore
vendored
Normal file
2
examples/9999/build/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
(in-package :qml-user)
|
||||
(in-package :app)
|
||||
|
||||
(defvar *number* 0)
|
||||
|
||||
|
|
|
|||
6
examples/9999/lisp/package.lisp
Normal file
6
examples/9999/lisp/package.lisp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(defpackage :app
|
||||
(:use :cl :qml)
|
||||
(:export
|
||||
#:draw-number
|
||||
#:paint))
|
||||
|
||||
47
examples/9999/make.lisp
Normal file
47
examples/9999/make.lisp
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
(when (search "/ecl-android/" (first (ext:command-args)))
|
||||
(pushnew :android *features*))
|
||||
|
||||
(require :asdf)
|
||||
|
||||
(push (merge-pathnames "../")
|
||||
asdf:*central-registry*)
|
||||
|
||||
(setf *default-pathname-defaults*
|
||||
(truename (merge-pathnames "../../../"))) ; LQML root
|
||||
|
||||
(defvar *current*
|
||||
(let ((name (namestring *load-truename*)))
|
||||
(subseq name
|
||||
(length (namestring *default-pathname-defaults*))
|
||||
(position #\/ name :from-end t))))
|
||||
|
||||
;; load all LQML symbols
|
||||
(dolist (file (list "package" "x" "ecl-ext" "ini" "qml"))
|
||||
(load (merge-pathnames file "src/lisp/")))
|
||||
|
||||
(defun cc (&rest args)
|
||||
(apply 'concatenate 'string args))
|
||||
|
||||
#-android
|
||||
(progn
|
||||
(asdf:make-build "app"
|
||||
:monolithic t
|
||||
:type :static-library
|
||||
:move-here (cc *current* "/build/tmp/")
|
||||
:init-name "ini_app")
|
||||
(let* ((from (cc *current* "/build/tmp/app--all-systems.a"))
|
||||
(to "libapp.a")
|
||||
(to* (cc *current* "/build/tmp/" to)))
|
||||
(when (probe-file to*)
|
||||
(delete-file to*))
|
||||
(rename-file from to)))
|
||||
|
||||
#+android
|
||||
(progn
|
||||
(defvar *asdf-system* "app")
|
||||
(defvar *ql-libs* (cc *current* "/ql-libs.lisp"))
|
||||
(defvar *library-name* (cc *current* "/build-android/tmp/app"))
|
||||
(defvar *init-name* "ini_app")
|
||||
(defvar *epilogue-code* nil)
|
||||
(load "platforms/shared/make"))
|
||||
|
||||
3
examples/9999/mkdirs.sh
Executable file
3
examples/9999/mkdirs.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
mkdir build
|
||||
mkdir build-android
|
||||
mkdir build-ios
|
||||
3
examples/9999/ql-libs.lisp
Normal file
3
examples/9999/ql-libs.lisp
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
;;; define here eventual Quicklisp dependencies
|
||||
;;; e.g. (ql:quickload :alessandria)
|
||||
|
||||
|
|
@ -1,17 +1,37 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import Lisp 1.0
|
||||
|
||||
Rectangle {
|
||||
width: 220
|
||||
height: 320 + input.height
|
||||
id: main
|
||||
width: 200
|
||||
height: 300 + input.height
|
||||
color: "lavender"
|
||||
|
||||
TextField {
|
||||
id: input
|
||||
objectName: "input"
|
||||
width: parent.width
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
text: "0000"
|
||||
inputMask: "9999"
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
focus: true
|
||||
|
||||
onTextChanged: Lisp.call("app:draw-number", Number(text))
|
||||
}
|
||||
|
||||
Canvas {
|
||||
id: canvas
|
||||
objectName: "canvas"
|
||||
width: 220
|
||||
height: 320
|
||||
y: input.height
|
||||
width: parent.width
|
||||
height: {
|
||||
var h = Qt.inputMethod.keyboardRectangle.y
|
||||
h = (h === 0) ? main.height : h / Screen.devicePixelRatio
|
||||
return (h - input.height)
|
||||
}
|
||||
|
||||
property var ctx
|
||||
|
||||
|
|
@ -36,23 +56,13 @@ Rectangle {
|
|||
onPaint: {
|
||||
ctx = getContext("2d")
|
||||
ctx.reset()
|
||||
ctx.translate(110, 160)
|
||||
ctx.translate(canvas.width / 2, canvas.height / 2)
|
||||
var s = height / 340
|
||||
ctx.scale(s, s)
|
||||
|
||||
Lisp.call("qml-user:paint")
|
||||
Lisp.call("app:paint")
|
||||
|
||||
ctx.stroke()
|
||||
}
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: input
|
||||
objectName: "input"
|
||||
width: parent.width
|
||||
anchors.bottom: parent.bottom
|
||||
horizontalAlignment: Qt.AlignHCenter
|
||||
text: "0000"
|
||||
inputMask: "9999"
|
||||
|
||||
onTextChanged: Lisp.call("qml-user:draw-number", Number(text))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
32
examples/9999/readme-build.md
Normal file
32
examples/9999/readme-build.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
Run desktop
|
||||
-----------
|
||||
|
||||
```
|
||||
$ lqml run.lisp
|
||||
```
|
||||
|
||||
|
||||
Build desktop app
|
||||
-----------------
|
||||
|
||||
```
|
||||
$ cd build
|
||||
|
||||
$ qmake ../app.pro
|
||||
$ make
|
||||
```
|
||||
|
||||
|
||||
Build android APK
|
||||
-----------------
|
||||
|
||||
```
|
||||
$ cd build-android
|
||||
|
||||
$ qmake-android ../app.pro
|
||||
$ make apk
|
||||
|
||||
$ adb install -r android-build/*.apk
|
||||
```
|
||||
|
||||
|
|
@ -1,12 +1,17 @@
|
|||
(in-package :qml-user)
|
||||
|
||||
(load "lisp/main")
|
||||
(require :asdf)
|
||||
|
||||
(push (merge-pathnames "./")
|
||||
asdf:*central-registry*)
|
||||
|
||||
(asdf:operate 'asdf:load-source-op :app)
|
||||
|
||||
(qset *quick-view*
|
||||
|x| 75
|
||||
|y| 75)
|
||||
|
||||
;;; for Slime after copying 'qml-start-swank.lisp' from LQML sources
|
||||
;;; for Slime after copying 'lqml-start-swank.lisp' from LQML sources
|
||||
;;; to your Slime directory, which is assumed to be '~/slime/'
|
||||
|
||||
(when (find "-slime" (ext:command-args) :test 'string=)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue