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. [QMAKE/CMAKE] Build apk and ios App via terminal
Qt 6.11 is out! See what's new in the release blog

[QMAKE/CMAKE] Build apk and ios App via terminal

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 3 Posters 1.2k Views 2 Watching
  • 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.
  • J Offline
    J Offline
    jhayar
    wrote on last edited by jhayar
    #1

    Hi ,
    i know there's a qt creator that can build apk and ios app easily , but there are times that i have no access on the company mac machine , and the only way to connect to the mac is via ssh , our company doesn't allow us to connect to mac via vnc /remote

    so the only way i think is to build apk / ios app via terminal .
    in normal android app and normal ios app , i can easily done this using the gradle command for android and the xcodebuild command for ios, but for the qmake i have no idea how can i build both apps via terminal .

    thanks in advance for the help :)

    if possible please post both cmake command and qmake command :) thank you very much.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      When you build in Qt Creator, see the first line in "Compile Output" tab - it contains full command line used to run qmake. Once qmake is done, you just need to follow it with make -j X where X is the number of cores in your cpu.

      You may need to follow that with a call to androiddeployqt later.

      (Z(:^

      J 1 Reply Last reply
      0
      • sierdzioS sierdzio

        When you build in Qt Creator, see the first line in "Compile Output" tab - it contains full command line used to run qmake. Once qmake is done, you just need to follow it with make -j X where X is the number of cores in your cpu.

        You may need to follow that with a call to androiddeployqt later.

        J Offline
        J Offline
        jhayar
        wrote on last edited by
        #3

        @sierdzio said in [QMAKE] Build apk and ios App via terminal:

        When you build in Qt Creator, see the first line in "Compile Output" tab - it contains full command line used to run qmake. Once qmake is done, you just need to follow it with make -j X where X is the number of cores in your cpu.

        You may need to follow that with a call to androiddeployqt later.

        noted thanks ,
        what is counterpart of "androiddeployqt" on ios ? iosdeployqt?

        also , if i use the cmake . is it the same ? thanks

        sierdzioS 1 Reply Last reply
        0
        • J jhayar

          @sierdzio said in [QMAKE] Build apk and ios App via terminal:

          When you build in Qt Creator, see the first line in "Compile Output" tab - it contains full command line used to run qmake. Once qmake is done, you just need to follow it with make -j X where X is the number of cores in your cpu.

          You may need to follow that with a call to androiddeployqt later.

          noted thanks ,
          what is counterpart of "androiddeployqt" on ios ? iosdeployqt?

          also , if i use the cmake . is it the same ? thanks

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @jhayar said in [QMAKE/CMAKE] Build apk and ios App via terminal:

          what is counterpart of "androiddeployqt" on ios ? iosdeployqt?

          I think there is no counterpart, xcode already builds the whole package. But it's been a few years since I worked on any iOS app, maybe I don't remember well.

          also , if i use the cmake . is it the same ? thanks

          In a nutshell yes. But I think there are some helper methods that will run deployment automatically for you. You'll need to search, Qt company has put up a few blog posts about cmake, Android and Qt.

          (Z(:^

          1 Reply Last reply
          0
          • KH-219DesignK Offline
            KH-219DesignK Offline
            KH-219Design
            wrote on last edited by
            #5

            I cannot speak to the CMake part of the question. I have never used Cmake with iOS apps.

            But for qmake and iOS, it is possible to build in a terminal.

            However, after building, I normally still open XCode manually ("point and click") in order to either submit the app to the Apple Store or to deploy to a locally-connected device. There are probably (??) additional exclusively-command-line ways to achieve those subsequent tasks, but I do not know them.

            Compiling for iOS is definitely possible, though. I do it in CI (continuous integration) to make sure no commits made from other platforms "break the build" for iOS.

            In what is a typical pattern for qmake, the main "trick" is just to make sure you invoke the iOS-specific qmake.

            So instead of invoking:

            • Qt_desktop/5.15.0/clang_64/bin/qmake # <<--- this would NOT produce an iOS app.

            You make sure to invoke:

            • Qt_desktop/5.15.0/ios/bin/qmake

            If you manage to run the correct qmake, then from there, the Qt/qmake build infrastructure should successfully drive XCode to run a build with iOS specific options, things that look like:

            • -target x86_64-apple-ios12.0-simulator
            • -isysroot .../iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.7.sdk

            Instead of the MacOS desktop options:

            • -mmacosx-version-min=10.13
            • -isysroot ...MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

            To be clear: those last bullet points all show options passed to clang, but you do not have to manually deal with any of that. All you should need to worry about is locating the correct qmake binary. If you start with the right qmake, the rest should fall into place automatically.

            Here is the script that I use in CI:

            • https://github.com/219-design/qt-qml-project-template-with-ci/blob/master/build_ios_app.sh

            (as of Nov 2022) It is working! I just ran a CI build this morning to make sure (before posting this).

            You might also find it useful to look at the commit when our iOS build script was added to CI:

            • https://github.com/219-design/qt-qml-project-template-with-ci/pull/34

            www.219design.com
            Software | Electrical | Mechanical | Product Design

            1 Reply Last reply
            1

            • Login

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