my qt app hello-world

Sergio Schvezov sergio.schvezov at canonical.com
Thu Feb 2 13:07:56 UTC 2017


On Thu, 2 Feb 2017 15:53:33 +0300, Vasilisc wrote:
> Please, help me. I have qt-app HelloWorld. I create HelloWorld in QtCreator.
>
> /sp/qt1/ $ tree qtprogram1
> qtprogram1
> ├── qt1
> │   ├── main.cpp
> │   ├── mainwindow.cpp
> │   ├── mainwindow.h
> │   ├── mainwindow.ui
> │   ├── qt1.pro
> │   └── qt1.pro.user
> └── qt1-build-desktop
>      ├── Makefile
>      ├── moc_mainwindow.cpp
>      └── ui_mainwindow.h
>
> 2 directories, 9 files
> -----------------------------------
>
> snapcraft.yaml contain
>
> name: qt1
> version: "1"
> summary: My first Qt app
> description: Qt Hello World
> confinement: strict
> architectures: [amd64]
>
> apps:
>   qt1:
>    command: desktop-launch $SNAP/opt/myapp/qt1
>    plugs: [home, unity7, x11]
>
> parts:
>   project-files:
>    plugin: qmake
>    source: .
>    qt-version: qt5
>    project-files: [qtprogram1/qt1/qt1.pro]
>    after: [integration]
>
>   integration:
>    plugin: nil
>    stage-packages:
>     - libc6
>     - libstdc++6
>     - libc-bin
>    after: [desktop-qt5]
> ---------------------------
>
> After "snapcraft" I find only one binary file qt1
>
> /sp/qt1# find . -name "qt1" -type f
> ./parts/project-files/build/qt1
>
> How to locate qt1 in opt/myapp/qt1 (for example)?

The best approach is to make qtprogram1/qt1/qt1.pro do that. If you want snapcraft to do this you can use `organize` such that...

parts:
  project-files:
    plugin: qmake
    source: .
    qt-version: qt5
    project-files: [qtprogram1/qt1/qt1.pro]
    organize:
      qt1: opt/myapp/qt1
    after: [integration]

But give our result in `find` you have no install rule at all so instead would need to do something like:

parts:
  project-files:
    plugin: qmake
    source: .
    qt-version: qt5
    project-files: [qtprogram1/qt1/qt1.pro]
    install: |
      install -d $SNAPCRAFT_PART_INSTALL/opt/myapp
      install qt1 $SNAPCRAFT_PART_INSTALL/opt/myapp/qt1
    after: [integration]

More about this here https://snapcraft.io/docs/build-snaps/scriptlets

-- 
Sent using Dekko from my Ubuntu device




More information about the Snapcraft mailing list