Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update creating-an-asteroid-app.md for more indepth information for app development #220

Merged
merged 3 commits into from
Feb 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 78 additions & 1 deletion pages/wiki/creating-an-asteroid-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ cmake -B build
cmake --build build
```


# Configure QtCreator for cross compilation

---
Expand Down Expand Up @@ -152,10 +151,88 @@ Change the following `Environment` variables:

Your app should now be able to run from the application when you click the start button in the bottom left sidebar.

# Learn QML

Main docs: https://doc.qt.io/ (AOS uses qt5)
lepras marked this conversation as resolved.
Show resolved Hide resolved
lepras marked this conversation as resolved.
Show resolved Hide resolved

AOS specific component/API: https://github.com/AsteroidOS/qml-asteroid
lepras marked this conversation as resolved.
Show resolved Hide resolved

Examples of use of most of those can be found by searching the AsteroidOS codebase: https://github.com/search?q=org%3AAsteroidOS+StatusPage&type=code
lepras marked this conversation as resolved.
Show resolved Hide resolved

# Development Cycle
lepras marked this conversation as resolved.
Show resolved Hide resolved

Have 2 terminals:

1. Do ssh and journalctl in one
2. Other build app or vim
lepras marked this conversation as resolved.
Show resolved Hide resolved

QML Tester is an **on-watch** app to quickly test and debug qml's. You can install by running this command **on-watch**:
lepras marked this conversation as resolved.
Show resolved Hide resolved

```
opkg install qmltester
```

Then you can Edit qmls by vim and scp
lepras marked this conversation as resolved.
Show resolved Hide resolved

```
vim scp://user@myserver[:port]//path/to/file.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already know the user, myserver, port and path/to/file so let's just specify them here.

[email protected] and wherever qmltester reads its QML files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qmltester can pick up any file so it depends on the dev so "//path/to/file.qml" is alright I think.

```

You can debug by reading the system logs by following along:
lepras marked this conversation as resolved.
Show resolved Hide resolved

```
journalctl -f
```

# Tips and tricks

---

Add these lines at the end of CMakeLists.txt for package automation:
lepras marked this conversation as resolved.
Show resolved Hide resolved

```
set(CPACK_GENERATOR "DEB")
string(TOLOWER "${CMAKE_PROJECT_NAME}" lcproject_name)
set(CPACK_DEBIAN_FILE_NAME "${lcproject_name}-${CMAKE_PROJECT_VERSION}.ipk")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE armv7vehf-neon)
if (NOT CPACK_PACKAGE_CONTACT)
set(CPACK_PACKAGE_CONTACT [email protected])
message(WARNING "No package contact specified: using ${CPACK_PACKAGE_CONTACT}")
endif()
include(CPack)
```

here is a shell script to quickly install an app:
lepras marked this conversation as resolved.
Show resolved Hide resolved

```
#!/bin/sh

source /usr/local/oecore-x86_64/environment-setup-armv7vehf-neon-oe-linux-gnueabi
export CMAKE_PROGRAM_PATH=/usr/local/oecore-x86_64/sysroots/armv7vehf-neon-oe-linux-gnueabi/usr/bin/
cmake -B build
cmake --build build
cmake --build build -t package

file="$(ls ./build/*.ipk | sort -V | tail -n1)"
filename="$(basename $file)"
sshpass -p "<password>" scp $file [email protected]:/home/ceres/
sshpass -p "<password>" ssh [email protected] << EOF
cd /home/ceres/
opkg install --force-overwrite $filename
EOF
```

Useful Vs Code Extensions:
lepras marked this conversation as resolved.
Show resolved Hide resolved

1. ms-vscode.cpptools
2. twxs.cmake
3. tonka3000.qtvsctools
4. felgo.felgo **or** bbenoist.QML
5. Gruntfuggly.todo-tree: for project management

not related to qml/qt but `Codeium.codeium` is the only thing that works well for qml autocomplete

If you want to start your app from the command line, open a shell with [SSH]({{rel 'wiki/ssh'}}), connect to ceres and use invoker:

```
Expand Down