Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Building an(or multiple) android app(s) as part of an existing cmake project
QtWS25 Last Chance

Building an(or multiple) android app(s) as part of an existing cmake project

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 358 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MS_36
    wrote on last edited by MS_36
    #1

    I am currently trying to simplify the build of android apps using cmake and the changes made in Qt 5.14.

    The project structure I am working with looks like this:

    | CMake project libraries
    |- Library 1
    |- Library 2
    |- Library x
    

    Before Qt 5.14 I had the following workflow to deploy my android apps:
    1.) Build the CMake project (libraries) for android armv7
    1.) Build the CMake project (libraries) for android arm64
    2.) Opening the QtCreator projects(one per app) to build the app (once for armv7 and arm64 apks)

    With Qt 5.14 I was hoping to simplify this to one single step:

    | CMake project
    |- Library 1
    |- Library 2
    |- Library x
    |- App 1
    |- App x
    

    What I would like to have:
    1.) Build the Cmake project -> It gets built for armv7 and arm64 and the aabs for the apps are generated

    The CMake project existed before the android apps and from that perspective the apps are just another "executable" to me.
    In fact I use the app built for Linux/Windows for debugging and developing so it really is just another executable to me that should be built with CMake.
    I have the app projects in the one CMake project and building this for Linux/Windows works of course as expected.

    I got as far as having the CMake project building all libraries correctly for armv7 and arm64.
    Multiple FIND_PACKAGE( Qt5 ) calls lead to CMake failing to generate because of the aab/apk target beeing defined multiple times.
    This can be solved by playing around with set( Projectname-MultiAbiBuild ON ), but it also limits the project to only having one app in it.
    I never got it to build an aab or apk for me because the variables for that to work need to be set before the first FIND_PACKAGE( Qt5 ) call.

    I may be wrong but to me it seems the new capabilities of Qt 5.14 expect me to have something like this:

    | CMake project libraries
    |- Library 1
    |- Library 2
    |- Library x
    
    | CMake project App1
    |- App1
    
    | CMake project AppX
    |- AppX
    

    1.) Build Cmake project libaries for armv7 and arm64(in one go)
    2.) Build CMake project App1 aab for armv7 and arm64 (in one go)
    3.) Build CMake project AppX aab for armv7 and arm64 (in one go)

    If I assume correct there is no advantage for me in using CMake for the apps.
    I guess I could get my one CMake project to build the apps using ExternalProject_Add(<name> [<option>...]) but I dont like that.
    I would have to duplicate things again in the App CMake projects similar to what I have to do now in the QtCreator project.

    Am I missing something obvious?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jheaff
      wrote on last edited by
      #2

      I also have the same requirement of several Android applications within one CMake project. @MS_36 May I ask how you overcame this?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved