File: README.md

package info (click to toggle)
kirigami2 5.78.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,876 kB
  • sloc: cpp: 9,938; sh: 79; xml: 31; makefile: 7
file content (133 lines) | stat: -rw-r--r-- 5,191 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Kirigami

QtQuick plugins to build user interfaces based on the KDE UX guidelines

## Introduction

Kirigami is a set of QtQuick components at the moment targeted for mobile use (in the future desktop as well) targeting both Plasma Mobile and Android. It’s not a whole set of components, all the “Primitive” ones like buttons and textboxes are a job for QtQuickControls (soon QtQuickControls2) but it’s a set of high level components to make the creation of applications that look and feel great on mobile as well as desktop devices and follow the Kirigami Human Interface Guidelines.

## Build examples to desktop

Build all examples available

```sh
mkdir build
cd build
cmake .. -DBUILD_EXAMPLES=ON
make
```

Than, you can run:

```sh
./examples/applicationitemapp/applicationitemapp
# or
./examples/galleryapp/kirigami2gallery
```

## Build the gallery example app on Android

Make sure to install **android-sdk**, **android-ndk** and **android-qt5-arch**, where **arch** should be the same architecture that you aim to deploy.

```sh
mkdir build
cd build
cmake .. \
    -DQTANDROID_EXPORTED_TARGET=kirigami2gallery \
    -DBUILD_EXAMPLES=on \
    -DANDROID_APK_DIR=../examples/galleryapp \
    -DECM_DIR=/path/to/share/ECM/cmake \
    -DCMAKE_TOOLCHAIN_FILE=/usr/share/ECM/toolchain/Android.cmake \
    -DECM_ADDITIONAL_FIND_ROOT_PATH=/path/to/Qt5.7.0/5.7/{arch} \
    -DCMAKE_PREFIX_PATH=/path/to/Qt5.7.0/5.7/{arch}/path/to/Qt5Core \
    -DANDROID_NDK=/path/to/Android/Sdk/ndk-bundle \
    -DANDROID_SDK_ROOT=/path/to/Android/Sdk/ \
    -DANDROID_SDK_BUILD_TOOLS_REVISION=26.0.2 \
    -DCMAKE_INSTALL_PREFIX=/path/to/dummy/install/prefix
```

You need a `-DCMAKE_INSTALL_PREFIX` to somewhere in your home, but using an absolute path.

If you have a local checkout of the breeze-icons repo, you can avoid the cloning of the build dir
by passing also `-DBREEZEICONS_DIR=/path/to/existing/sources/of/breeze-icons`

```sh
make create-apk-kirigami2gallery
```

Apk will be generated at `./kirigami2gallery_build_apk/build/outputs/apk/kirigami2gallery_build_apk-debug.apk`.

To directly install on a phone:

```sh
adb install -r ./kirigami2gallery_build_apk/build/outputs/apk/kirigami2gallery_build_apk-debug.apk
```

To perform this, your device need to be configureted with `USB debugging` and `install via USB` in `Developer options`.

> Some ambient variables must be set before the process: `ANDROID_NDK`, `ANDROID_SDK_ROOT`, `Qt5_android` and `JAVA_HOME`

```sh
export ANDROID_NDK=/path/to/android-ndk
export ANDROID_SDK_ROOT=/path/to/android-sdk
export Qt5_android=/path/to/android-qt5/5.7.0/{arch}
export PATH=$ANDROID_SDK_ROOT/platform-tools/:$PATH
# adapt the following path to your ant installation
export ANT=/usr/bin/ant
export JAVA_HOME=/path/to/lib/jvm/java-8-openjdk/
```

# Build on your application Android, ship it together Kirigami

1) Build kirigami

   Use the same procedure mentioned above (but without `BUILD_EXAMPLES` switch):
    - `cd` into kirigami sources directory;
    - Execute build script:
        ```sh
        mkdir build
        cd build
        
        cmake ..  \
            -DCMAKE_TOOLCHAIN_FILE=/path/to/share/ECM/toolchain/Android.cmake\
            -DCMAKE_PREFIX_PATH=/path/to/Qt5.7.0/5.7/android_armv7/\
            -DCMAKE_INSTALL_PREFIX=/path/to/dummy/install/prefix\
            -DECM_DIR=/path/to/share/ECM/cmake
        
        make
        make install
        ```
    - Note: omit the `make create-apk-kirigami2gallery` step.

2) Build your application

   This guide assumes that you build your application with CMake and use [Extra CMake Modules (ECM)](https://api.kde.org/ecm/) from KDE frameworks.
    - `cd` into your application sources directory;
    - Replace `$yourapp` with the actual name of your application;
    - Execute build script:
        ```sh
        mkdir build
        cd build
        
        cmake .. \
            -DCMAKE_TOOLCHAIN_FILE=/path/to/share/ECM/toolchain/Android.cmake \
            -DQTANDROID_EXPORTED_TARGET=$yourapp \
            -DANDROID_APK_DIR=../examples/galleryapp/ \
            -DCMAKE_PREFIX_PATH=/path/to/Qt5.7.0/5.7/android_armv7/ \
            -DCMAKE_INSTALL_PREFIX=/path/to/dummy/install/prefix
            
        make
        make install
        make create-apk-$yourapp
        ```
    - Note: `-DCMAKE_INSTALL_PREFIX` directory will be the same as where Kirigami was installed,
    since you need to create an apk package that contains both the kirigami build and the
    build of your application.

# Build an application with qmake

* Use `examples/minimalqmake` example as a template.
* It links statically for Android, but on desktop systems it links to the shared library provided by your distribution. However, static linking mode may be useful for other systems such as iOS or Windows.
* Static linking only: clone `kirigami` and `breeze-icons` git repositories under the 3rdparty folder.
* Android only: in your `main()` call `KirigamiPlugin::getInstance().registerTypes();` to register QML types.
* QtCreator should be able to deploy on Android out of the box via auto-detected Android Kit, provided that SDK, NDK and other relevant tools are installed.