make example work on iOS; revisions

This commit is contained in:
pls.153 2022-02-12 14:08:16 +01:00
parent e1ece6dc50
commit a4d2405ca7
14 changed files with 317 additions and 25 deletions

View file

@ -45,6 +45,13 @@ android {
#ANDROID_PACKAGE_SOURCE_DIR = ../platforms/android/sources
}
ios {
INCLUDEPATH = $$(ECL_IOS)/include
LIBS = -L$$(ECL_IOS)/lib -lecl
LIBS += -leclatomic -leclffi -leclgc -leclgmp
LIBS += -L../../../platforms/ios/lib -llqml -llisp -Ltmp -lapp
}
SOURCES += ../../src/cpp/main.cpp
RESOURCES = app.qrc

View file

@ -0,0 +1,3 @@
../../../platforms/ios/cross-compile.sh ../make.lisp
open app.xcodeproj

View file

@ -1,5 +1,9 @@
(when (search "/ecl-android/" (first (ext:command-args)))
(pushnew :android *features*))
(let ((arg (first (ext:command-args))))
(mapc (lambda (name feature)
(when (search name arg)
(pushnew feature *features*)))
(list "/ecl-android/" "/ecl-ios/")
(list :android :ios)))
(require :asdf)
@ -22,7 +26,7 @@
(defun cc (&rest args)
(apply 'concatenate 'string args))
#-android
#-(or android ios)
(progn
(asdf:make-build "app"
:monolithic t
@ -36,12 +40,14 @@
(delete-file to*))
(rename-file from to)))
#+android
#+(or android ios)
(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 *library-name* (cc *current* (format nil "/build-~A/tmp/app"
#+android "android"
#+ios "ios")))
(defvar *epilogue-code* nil)
(load "platforms/shared/make"))

View file

@ -29,7 +29,8 @@ Rectangle {
width: parent.width
height: {
var h = Qt.inputMethod.keyboardRectangle.y
h = (h === 0) ? main.height : h / Screen.devicePixelRatio
var f = (Qt.platform.os === "android") ? Screen.devicePixelRatio : 1
h = (h === 0) ? main.height : h / f
return (h - input.height)
}

View file

@ -1,7 +1,6 @@
Run desktop
-----------
```
$ lqml run.lisp
```
@ -9,7 +8,6 @@ $ lqml run.lisp
Build desktop app
-----------------
```
$ cd build
@ -20,7 +18,6 @@ $ make
Build android APK
-----------------
```
$ cd build-android
@ -30,3 +27,21 @@ $ make apk
$ adb install -r android-build/*.apk
```
Build iOS app
-------------
```
$ cd build-ios
$ qmake-ios ../app.pro
$ ./xcode.sh
```
The script above first cross-compiles the Lisp code, then opens **Xcode**.
N.B: Before building the app, go to Build Settings / Build Options and set
**Enable Bitcode** to **No**.
The simulator will not work here, because we didn't cross-compile ECL and
the app code for the simulator.